pwmc: let the -i option have priority over the ssh agent. The --url
[libpwmd.git] / README.SSH
blob74bdfb9c92d98977b9f2529dab72776452465b2d
1 Beginning with version 6 of libpwmd remote access to a pwmd server using
2 libssh2 has been available. The functions pwmd_ssh_connect() and
3 pwmd_ssh_connect_async() are used to connect to the server. After resolving
4 the hostname and connecting, an ssh session is created and the hostkey is
5 verified against a file containing known hosts. Note that only public key
6 authentication is supported and without a passphrase.
8 After verification succeeds, a channel is opened which spawns a shell. This
9 shell should execute a proxy to the pwmd server by connecting to the local
10 socket. I use 'socat', it's really handy.
12 In order to get this to work you need to put the following in your
13 ~/.ssh/authorized_keys file. It should be prepended to the public key that
14 your libpwmd client will use:
16     command="socat UNIX-CONNECT:$HOME/.pwmd/socket -"
18 So now when libpwmd spawns the SSH shell, 'socat' will read the stdin of the
19 SSH shell and redirect it to the pwmd socket. The output of pwmd works the
20 same: redirecting pwmd's socket output to the stdin of the SSH shell.
22 You can use pwmc to try it out:
24     # Get the servers public key. Make sure the hostname is correct and not
25     # hijacked when getting the hostkey. This step is optional. It can be done
26     # for you when you first connect to the host.
27     pwmc --get-hostkey --host hostname > host_file
29     # Generate an SSH key that the client will use. Copy the contents of
30     # the generated public key to the SSH servers authorized_keys file and
31     # prepend the above mentioned line to it. You will need both the generated
32     # public and private keys when connecting to the server.
33     ssh-keygen -f keyfile
35     # If you have an ssh agent running do the following and pass --use-agent
36     # to the next command after this:
37     ssh-add keyfile
39     # List the contents of the pwmd 'datafile' on the remote SSH server by
40     # connecting as the specified 'user'.
41     echo list | pwmc --url ssh://user@hostname,keyfile datafile
43 Ben Kibbey <bjk@luxsci.net>
44 http://pwmd.sourceforge.net/