1 libpwmd supports remote access to a pwmd server by using the libssh2 library.
2 The pwmd_connect() function is used to connect to the remote socket just as
3 the local socket by prefixing the socket with ssh:// followed by the hostname.
4 After resolving the hostname and connecting, an ssh session is created and the
5 hostkey is verified against a file containing known hosts. Note that only
6 public key 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 on the machine running the ssh and pwmd server. It
14 should be prepended to the public key portion of the private key that your
15 libpwmd client will use:
17 command="socat UNIX-CONNECT:$HOME/.pwmd/socket -"
19 Now when libpwmd spawns the SSH shell, 'socat' will read the stdout of the SSH
20 shell and redirect it to the pwmd socket. The output of pwmd works the same:
21 redirecting pwmd's socket output to the stdin of the SSH shell and back to the
24 You can use pwmc to try it out:
25 # Generate an SSH key that the client will use. Then copy the contents of
26 # the generated public key to the SSH servers authorized_keys file and
27 # prepend the above mentioned line to it. You will need both the generated
28 # public and private keys when connecting to the server.
31 # If you have an ssh agent running, you can also do the following:
34 # List the contents of the pwmd 'datafile' on the remote SSH server by
35 # connecting as the specified 'user'. If you have an ssh agent running and
36 # did the above command, you can omit the keyfile argument to the --url
38 echo list | pwmc --url ssh://user@hostname --identity keyfile datafile
40 Ben Kibbey <bjk@luxsci.net>
41 http://pwmd.sourceforge.net/