I am trying to run a command (server-side) every time a user connects, so I set the ForceCommand keyword at the very bottom of the /etc/ssh/sshd_config file:
ForceCommand /bin/test
where:
# cat /bin/test
#!/bin/bash
echo "1" >> ~/test.txt
/bin/bash
and
# ls -l /bin/test
-rwxr-xr-x 1 root root 47 Mar 8 10:15 /bin/test
To make it simple, I am trying to make it working for root user first, but nothing happens (after connecting, the test.txt file is not created in /root)
What am I doing wrong?
Thank you very much, Andrea
Using Ubuntu 14.04.6 LTS and OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13, OpenSSL 1.0.1f 6 Jan 2014