码迷,mamicode.com
首页 > 系统相关 > 详细

linux ssh连接设置

时间:2017-07-07 11:40:03      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:firewall   live   port   连接   密码   防火墙   roo   启动   加固   

suselinux11 ssh设置。关闭root用户连接,使用sshd用户连接。然后通过sshd用户跳转root用户。

 

1.设置 /etc/ssh/sshd_config

 #vi /etc/ssh/sshd_config

port 22   (使用22的端口)

ClientAliveInterval 300   (连接300s后,记录一次超时)
ClientAliveCountMax 0  (如果发现客户端没有相应,则判断一次超时,这个参数设置允许超时的次数)

AllowUsers sshd           (服务器加固后仅限sshd用户登录)

 

 

2.将sshd加入用户组

(1)/etc/pam.d/su 文件 看看下面这句是不是设成有效了
auth required pam_whell.so use_uid

(2)注释SU_WHEEL_ONLY yes

vi /etc/login.defs
#SU_WHEEL_ONLY yes

(3)/bin/su的权限为‘-rwsr-xr-x’

ll /bin/su

-rwsr-xr-x 1 root root 40016 Mar 18  2013 /bin/su

 

3. su - root 密码正确,报错su:incorrect password

(1)因为 /etc/pam.d/su 中auth required pam_whell.so use_uid

(2)需要将sshd用户加入whell组

 #usermod sshd -g whell

 

 4.关闭防火墙

(1)临时关闭防火墙

rcSuSEfirewall2_setup stop

rcSuSEfirewall2_init stop

(2)永久关闭防火墙

chkconfig SuSEfirewall2_setup off   

chkconfig SuSEfirewall2_init off 

 

5.、启动ssh

/etc/init.d/sshd start

 chkconfig sshd on    (ssh加入自动启动)

 

 

 

 

 

 

 

linux ssh连接设置

标签:firewall   live   port   连接   密码   防火墙   roo   启动   加固   

原文地址:http://www.cnblogs.com/eugenebo/p/7131128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!