ssh authorized keys – limit ssh session to custom command
If you want a ssh key to be able to run a custom command only and nothing beyond that, then you can use the “command” option in the authorized_keys file of ssh.
For example, to limit user to run only top command with a key, you can add the key like this:
echo 'command="/usr/bin/top" ssh-rsa ' >>~/.ssh/authorized_keys
Related Articles:
- 2014/09/01 Debuggging bash cron scripts.
- 2011/05/14 Terminating a SSH session after starting background process.
- 2010/05/24 Menu driven ssh.
- 2009/09/08 Database of vulnurability at milw0rm.com – udpate and makeindex with cron.
- 2015/01/22 shell script for some quick tests on Linux
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.