0

I'm looking for a way to start a shell script after a sftp session exited.

Is it possible to trigger /home/user/.bash_logout via sftp, how does it work?

I tried to set RequestTTY force in ~/.ssh/config but this is not helping.

1

It's not possible on remote server to start any command after sftp session is over, it is because all what is executed on remote server while having sftp is content of SSH_ORIGINAL_COMMAND env variable which points to *sftp-server binary.

If you want to do anything on remote server, just create a wrapper and "force" it either via ForceCommand or via command= in your ssh public key in .ssh/authorized_keys.

For example I was playing with such wrapper to automatically rsync mirror users data after sftp session is over to another server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.