ssh的用户登陆限制 |
http://www.chinaunix.net 作者:sunaska 发表于:2004-03-16 23:34:04 |
想限制某个网段的用户能用ssh登陆本机,某个网段不能登陆,请问是用host.allow 来控制吗?tcp-wrapper好象是用来控制xinetd里的服务的好象,求教。。
|
|
【发表回复】【查看论坛原帖】【添加到收藏夹】【关闭】 |
網中人 回复于:2004-03-17 03:32:07 | 預設上,sshd 不受 xinetd 管,但可支援 tcpd 。 你可在 hosts.allow 中設: sshd: 192.168.0. sshd: ALL: deny
當然,用 iptables 也行: iptables -I INPUT -p tcp --dport 22 -j DROP iptables -I INPUT -p tcp --dport 22 -s 192.168.0.0/32 -j ACCEPT (註:用 -I 命令,且順序不能顛倒...)
| 網中人 回复于:2004-03-17 03:39:52 | 再補:
若你還想限制哪些用戶可用,請 man sshd_config 找找 AllowGroups 與 AllowUsers 設定。 或用 pam 也行: 1) 修改 /etc/pam.d/sshd auth required pam_listfile.so item=user sense=allow file=/etc/sshusers onerr=fail 2) 將你要的用戶寫進 /etc/sshusers ,如: echo "root" >> /etc/sshusers
| express 回复于:2004-03-17 10:18:56 | 網中人,写的好详细,谢了 :lol: 。
| sunaska 回复于:2004-03-17 15:08:22 | 好棒,测试去偶现在
|
|
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理