scp command with alert message scp command with alert message unix unix

scp command with alert message


Unless you have administrative control of the server, what you ask is not possible -- Unix filesystems simply don't work that way. You can set your file permissions so that other users can't find or read your files, but there is no way for you, as an unprivileged user, to request email notification upon attempted or successful access attempts, via scp or any other method.


Are you on the server, or client side?

server side: Key-based ssh authentication has the ability to start custom commands when the user log into the system (can by bypassed if the user can change the authorized_keys file). There you can add a hook to send a mail on the login, or start a own sftp server with the desired logging enabled.


The right way to do that is to replace the scp program on the server by your own version (or by a wrapper).