New answers tagged sftp
The default logging of all ssh/sftp is to syslog AUTH facility edit /etc/openssh/sshd_config change Subsystem internal-sftp -l INFO to Subsystem internal-sftp -l INFO -f LOCAL3 where LOCAL3 is a facility not used by any applications in your system. You can choose any LOCAL0 to LOCAL7 instead of LOCAL3 then open your syslog or rsyslog config and add ...
If rsync is not an option, I would next recommend lftp: lftp sftp://firstname.lastname@example.org/path/path/ Then use the mirror command to recursively upload, like this: mirror -R Or to upload just: mirror You have to cd into the directories you want to mirror. Works great!
There are 3 avenues that I can conceive of that might provide you with a solution. 1. Custom sftp Subsystem You could wrap the sftp-server daemon via sshd_config and "override" it with your own script that could then intercept what sftp-server is doing, and then act when you see that a file was downloaded. Overriding the default sftp-server in sshd_config ...
If you know the path and name then you can do this if [ -f $filename ]; then archive else echo "" fi However you did not add any such information.
Configure the SSH server to log the activity, then you can parse the log to know if such file has been downloaded. To enable logging append -l INFO to the sftp subsystem line in the /etc/ssh/sshd_config file, it should look something like (the path may vary by distro, I'm using SuSE 11): Subsystem sftp /usr/lib64/ssh/sftp-server -l INFO Now the ...
Sure you can use lsof to see what activity is currently taking place on the server. Here's what the output would look like for an idle connection to an SFTP server. $ sudo /usr/sbin/lsof -p $(pgrep sftp) COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sftp-serv 30268 sam cwd DIR 0,19 20480 28312529 /home/sam ...
Calling the subsystem with sudo worked for me. To an Ubuntu host for example: sftp -s "sudo /usr/lib/openssh/sftp-server" targethost.fqdn
Top 50 recent answers are included