Linux - how to disable commands for SSH users - use only Port forwarding / SSH tunnel
Hello,
I only need to allow one user via SSH Port forwarding + SSH tunnel. Is it safe to set up in Linux? I want to prevent him from doing anything else via SSH - entering commands, etc. Thanks
Hi,
restrict the permissions of the test2 user to SSH, or forbid him to enter commands can be done as shown below.
Restrict rights - the user cannot enter displays, he will only see the message: "You can use only SSH port forwarding" for 999999999999999 seconds.
Then reboot or restard sshd ....
I only need to allow one user via SSH Port forwarding + SSH tunnel. Is it safe to set up in Linux? I want to prevent him from doing anything else via SSH - entering commands, etc. Thanks
REPLY
Hi,
restrict the permissions of the test2 user to SSH, or forbid him to enter commands can be done as shown below.
Restrict rights - the user cannot enter displays, he will only see the message: "You can use only SSH port forwarding" for 999999999999999 seconds.
vim /etc/ssh/sshd_config
GatewayPorts yes
Match User test2
#AllowTcpForwarding yes
#X11Forwarding no
#PermitTunnel no
#GatewayPorts no
AllowAgentForwarding no
#PermitOpen localhost:62222
ForceCommand echo 'You can use only SSH port forwarding';sleep 999999999999999;
Then reboot or restard sshd ....