我的目标是:将跳转用户(进入OpenSSH跳转箱)限制在另一台服务器上。除了从jumpbox到另一台服务器的ssh之外,用户不应该能够列出目录、cd或其他任何内容。
我所拥有的:
我所做的:编辑了/etc/ssh/sshd_config:
Match User testuser
AllowTcpForwarding yes
X11Forwarding no
AllowAgentForwarding no
ForceCommand /bin/false当我添加ForceCommand /bin/false时,testuser甚至不能跳过服务器。没有它,用户可以登录跳转服务器,但仍然可以列出目录和cd。
发布于 2022-02-21 11:36:53
rbash。有关此问题的信息,请参阅man bash“受限SHELL”。echo "PATH=/usr/restricted/bin" > /home/username/.bash_profile
/usr/restricted/bin中:ln -s /usr/bin/ssh /usr/restricted/bin/ssh (对每个主机来说都是ssh )
您可以使用名为/usr/restricted/bin/ssh的脚本限制目标主机,该脚本检查第一个参数,如果这是允许的主机名之一(S)。
https://unix.stackexchange.com/questions/691514
复制相似问题