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

Unix/Linux
Linux 网管 123 --- 第6章. 一般系统管理问题 -3.变更使用者密码
Linux 网管 123 --- 第6章. 一般系统管理问题 -4.关闭删除使用者帐号
Linux 网管 123 --- 第6章. 一般系统管理问题 -5.Linux 密码及 S
Linux 网管 123 --- 第6章. 一般系统管理问题 -6.关闭系统及重新启动
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -1.HTTP
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -2.DNS
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -3.使用 TACACS
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -4.使用 Samba
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -5.使用 Netata
Linux 网管 123 --- 第7章. 自订的组态及管理内容 -6.NFS
Linux 网管 123 --- 第13章. 其他的问题 2.哪里可以找到帮助
Linux 网管 123 --- 第13章. 其他的问题 3.附带文件的指示
RedHat 6.2 中文显示与输入的设置
RedHat 6.2 中文 TrueType 字体的使用
Linux 网管 123 --- 第13章. 其他的问题 1.系统损毁
Linux系统中网络配置详解
如何配置linux与win2000/NT 双重引导
kernel hacking简单入门
Linux下如何刻录任何文件系统格式的光盘?
编译内核make dep 是啥意思 ?

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 177 ::
收藏到网摘: 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