当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > ssh的用户登陆限制

Unix/Linux
linux下一个网卡配置多个IP
linux下如何查看邮件
linux系统中如何查看日志
Linux操作系统主机名(hostname)简介
在UNIX或Linux中TTY是什么意思
SSH使用指南
SSH客户端之SSH Secure Shell 的连接方法
linux 如何查看开关机记录
kill命令的使用
Linux用户进程是如何释放内存的
Linux命令free的输出含义
PHP 4.4.1forlinux下载
Apache 2.0.55 for Linux 下载
PHPMyAdmin 2.7.0-pl1下载
linux怎么添加用户
在Linux中添加普通新用户
linux查看所有用户
linux下的用户权限
linux下查看端口命令 端口
LINUX的端口和服务

Unix/Linux 中的 ssh的用户登陆限制


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 152 ::
收藏到网摘: n/a

 

預設上,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 命令,且順序不能顛倒...)

再補:

若你還想限制哪些用戶可用,請 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