I am using the current OpenSSH version on Debian 7.7 Whezzy, which is, according to dpkg, 1:6.0p1-4+deb7u2.

I configured OpenSSH to allow clients to connect using SFTP, and read and modify (upload or replace) arbitrary files in a chroooted environment.

I want a script to be triggered whenever a change (deletion, upload or replacement) occurs, and, if possible, as well if the change succeeded or failed.

For example, if Alice uploads a file /foo/bar.png, a script notify.sh alice /home/alice/foo/bar.png UPLOAD SUCCESS would be invoked.

Is there a way to realize this?


AFAIK OpenSSH doesn't have a support for that. <opinion>The probable reason behind that, that the OpenSSH guys favorize the minimal feature, maximal security concept which is quite visible on their other projects, too.</opinion> But it is not unconditionally a problem.

  1. You can do this by watching the system log, and setting up condition for that (at least syslog-ng can do this).
  2. There is incron for the task. It is a daemon, using the inotify feature of the linux kernel to call scripts, triggered by file changes.
| improve this answer | |

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.