CentOS 5.5 系统安全配置(5)
执行/etc/init.d/sshd restart
这样SSH端口将同时工作与22和50000上。
现在编辑防火墙配置:vi /etc/sysconfig/iptables
启用50000端口。
执行/etc/init.d/iptables restart
现在请使用ssh工具连接50000端口,来测试是否成功。
如果连接成功了,则再次编辑sshd_config的设置,将里边的Port22删除,即可。
b 只使用SSH v2
将#Protocol 2,1改为 Protocol 2
c 限制用户的SSH访问
假设我们只要root,vivek和jerry用户能通过SSH使用系统,向sshd_config配置文件中添加:
- AllowUsers root vivek jerry
d 配置空闲超时退出时间间隔
用户可以通过ssh登录到服务器,你可以设置一个空闲超时时间间隔避免出现孤儿ssh会话,打开sshd_config配置文件,确保有如下的配置项:
- ClientAliveInterval 300
- ClientAliveCountMax 0
上面的例子设置的空闲超时时间间隔是300秒,即5分钟,过了这个时间后,空闲用户将被自动踢出出去(可以理解为退出登录/注销)。
e 禁用.rhosts文件
不要读取用户的~/.rhosts和~/.shosts文件,使用下面的设置更新sshd_config配置文件:
IgnoreRhosts yes
SSH可以模拟过时的rsh命令的行为,rsh被公认为是不安全的远程访问协议,因此必须得禁用掉。
6、限制不同文件的权限
- [root@localhost ~]# chmod 700 /usr/bin/
- [root@localhost ~]# chmod 750 /usr/bin/*++*
- [root@localhost ~]# chmod 750 /usr/bin/c++*
- [root@localhost ~]# chmod 750 /usr/bin/ld
- [root@localhost ~]# chmod 750 /usr/bin/as
- [root@localhost ~]# locate sqlaccess
- /opt/lampp/bin/mysqlaccess
- [root@localhost ~]# chmod 755 /opt/lampp/bin/mysqlaccess
- [root@localhost ~]# chattr +a .bash_history
- [root@localhost ~]# chattr +i .bash_history
- [root@localhost ~]# chmod 700 /bin/ping
顶(0)
踩(0)
- 最新评论
