/etc/sysconfig/iptables
/etc/ssh/sshd_config
Match User that-restricted-guy AllowTcpForwarding yes X11Forwarding no AllowAgentForwarding no ForceCommand /bin/false
Match User even-more-restricted-guy PermitOpen 127.0.0.1:12345 X11Forwarding no AllowAgentForwarding no ForceCommand /bin/false
ssh -L 12345:127.0.0.1:12345 -N even-more-restricted-guy@insert-your-machine
Match Group nicepeople PubkeyAuthentication yes PasswordAuthentication yes PermitEmptyPasswords no GatewayPorts no ChrootDirectory /opt/dummy_location/%u ForceCommand internal-sftp AllowTcpForwarding yes PermitOpen 192.168.0.8:22 PermitOpen 192.168.0.5:8080 # Or leave out the PermitOpen to allow forwarding to anywhere. HostbasedAuthentication no RhostsRSAAuthentication no AllowAgentForwarding no Banner none
Restringir acceso a la red:
/sbin/iptables -I OUTPUT -m owner --gid-owner 500 -j REJECT /sbin/iptables -I OUTPUT -m owner --gid-owner 500 -m tcp -p tcp -d 192.168.0.0/24 -j ACCEPT
/via: https://unix.stackexchange.com/questions/14312/how-to-restrict-an-ssh-user-to-only-allow-ssh-tunneling
/more: https://superuser.com/questions/229743/howto-disable-ssh-local-port-forwarding