ユーザー固有の設定ファイルに `ForceCommand`を置きます。

ユーザー固有の設定ファイルに `ForceCommand`を置きます。

頑張るSSHトンネルユーザー制限

# sudo cat /home/user/.ssh/config
Banner none
ChrootDirectory /home/%u
PasswordAuthentication no
AllowTcpForwarding yes
X11Forwarding no
AllowAgentForwarding no
ForceCommand /bin/false

しかし、これらのどれも効果がないようです。

/home/user/.ssh/authorized_keys前に追加するとうまくno-pty,no-agent-forwarding,no-X11-forwarding,command="/bin/false"いきますが、これらのディレクティブを永続構成に含めたいと思います。

更新せずにこのようにユーザーを制限できますか/etc/ssh/sshd_config

修正する私も知っていますMatch UserMatch Groupポイントはそれを置くことです。ユーザー別構成。

ベストアンサー1

/home/user/.ssh/configこれは純粋にSSHクライアント自体のためのものであり、システムで使用されます。始めるSSH接続。だからここでは役に立たない。

ユーザー固有の設定が必要なため、追加Match UserまたはMatch Groupアイテムの可能性を排除したという質問が更新されました。/etc/ssh/sshd_config

特定のユーザーを自分のホームディレクトリにルート指定するには、特におよびをMatch Group使用してこれらのグループメンバーシップを利用できますChrootDirectory %h

Match Group jailed
  Banner none
  ChrootDirectory %h
  PasswordAuthentication no
  AllowTcpForwarding yes
  X11Forwarding no
  AllowAgentForwarding no
  ForceCommand /bin/false

おすすめ記事