How can an SSH command be setup to allow port forwarding but not execute commands.
I know that the ssh login can use -N to stop commands executing, but can the ssh config file be setup to disallow it?
Restricting the type of shell and the path in Linux is on option, but can it be done in the SSH configuration itself?
Look at
man sshd
and search forAUTHORIZED_KEYS FILE FORMAT
What you want to do is create a public/private key pair, and put the public key in the
~/.ssh/authorized_keys
file as normal. Then edit theauthorized_keys
file to add the string:It will end up looking kind of like:
You would want to change the argument to 'permitopen' and possibly change some of the other settings, but I think that's basically it.
this article should set you in the right path
http://www.semicomplete.com/articles/ssh-security/