I need to mirror some uploaded files to another server on the network. The solution I'm currently using is using ssh2_connect()
and ssh2_scp_send()
to copy the files as soon as they are uploaded. I'm using RSA public key authentication. Everything works fine, but the account we're using to copy the files has an expiring password that must be changed every six months. Between the expiration and the password change the public key authentication is disabled as well.
To fix the issue I've decided to move the transfer to the user nobody
who has no password and has scponly
as its login shell. The transfer works fine with the scp
and unison
shell commands but the PHP ssh2
functions do nothing.
Should the SSH2 library's functions work with scponly
or should I be looking elsewhere? Or is this an scponly
configuration issue?
libssh2 provides fairly limited diagnostic capabilities. I'd almost recommend you try to connect with phpseclib, a pure PHP SCP implementation, and, if it doesn't work with that, enable logging.
eg. (without logging)
And with logging...
Assuming you don't just want to use phpseclib for the whole thing you get might get some useful info from it none-the-less that'd assist you in diagnosing the problem.