当前位置:网站首页 / Linux / 正文

linux环境下的账户和登录安全

时间:2016年12月06日 | 作者 : liuhui | 分类 : Linux | 浏览: 6480次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

1.jpg

删除特殊的用户和组:

可删除的用户: 
adm,lp,sync,shutdown,halt,news,uucp,operator,games,gopher等 
可删除的组: 
adm,lp,news,uucp,games,dip,pppusers,popusers,slipusers等 
删除不必要的用户命令:

userdel games

删除不必要的用户组命令:

groupdel games

禁止nagios用户登录系统的功能:

usermod -s /sbin/nologin nagios

根据服务器要求来删除特定的用户和组,如果服务器用来做web,那么apache用户和用户组就无需删除,如果服务器用来做数据库,那么建议删除apach的用户和用户组

关闭系统不必要的服务: 
anacron,auditd,avahi-daemon,avahi-dnsconfd,bluetooth,cpuspeed,firstboot,gpm,haldaemon,hidd,ip6tables,ipsec,isdn,lpd,mcstrans,messagebus,netfs,nfs,nfslock,nscd,pcscd,portmap,readahead_early,restorecond,rpcgssd,rpcidmapd,rstatd,sendmail,setroubleshoot,yppasswdd ypserv

关闭bluetooth服务:

chkconfig --level 345 bluetooth off

密码安全策略:

设置普通用户ixdba使用SSH2协议:

mkdir /home/ixdba/.sshchmod 700 /home/ixdba/.ssh

将秘钥文件上传到Linux服务器,导入秘钥:

ssh-keygen -i fIdentity.pub >> /home/ixdba/.ssh/authorized_keys2

修改服务器端文件只接受PublicKey认证方式验证用户:

vi /etc/ssh/sshd_config

修改配置:

Protocol 2 #启用SSH2PublicAuthentication yes #开启PublicKey认证AuthorizedKeyFile .ssh/authorized_key2 #PublicKey文件路径PasswordAuthentication no #不启用口令认证

重启SSHD服务:

/etc/rc.d/init.d/sshd restart

合理使用su,sudo命令:

一般用户无法访问/etc/shadow文件:

more /etc/shadowPermission denied

给user01用户sudo权限访问/etc/shaodow文件权限: 
vi /etc/sudoers 
添加以下内容:

user01  ALL = /bin/more /etc/shadow

给用户user01 sudo无需输入密码具有/etc/init.d/nagios脚本重启权限: 
添加以下内容:

user01 ALL = NOPASSWD: /etc/init.d/nagios restart

给用户user01 sudo无需输入密码即可具有超级用户权限: 
添加以下内容:

user01 ALL = NOPASSWD : ALL

删减系统登陆欢迎信息:

/etc/issue(本地终端显示内容) , /etc/issue.net(远程登陆终端显示内容)他们都记录了操作系统的名称和版本号 
禁止SSH显示信息:

vi /etc/ssh/sshd_config

添加以下内容:

Banner /etc/issue.net

同样,/etc/redhat-release文件也记录了操作系统的名称和版本号。

/etc/motd系统的公告信息,每次登陆,该文件内容就会显示在终端,可以用来发布硬件升级信息,维护信息,还可以发布警告信息,产生震慑作用。

奉上如来佛:

// //                                  _oo8oo_//                                 o8888888o//                                 88" . "88//                                 (| -_- |)//                                 0\  =  /0//                               ___/'==='\___//                             .' \|     |// './/                            / \|||  :  |||// \//                           / _||||| -:- |||||_ \//                          |   | \\\  -  /// |   |//                          | \_|  ''\---/''  |_/ |//                          \  .-\__  '-'  __/-.  ///                        ___'. .'  /--.--\  '. .'___//                     ."" '<  '.___\_<|>_/___.'  >' "".//                    | | :  `- \`.:`\ _ /`:.`/ -`  : | |//                    \  \ `-.   \_ __\ /__ _/   .-` /  ///                =====`-.____`.___ \_____/ ___.`____.-`=====//                                  `=---=`// // //               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~////                          佛祖保佑         永不宕机/永无bug//

禁止Control+Alt+Del重启命令

Centos5.x:

vi /etc/inittab

注释掉如下行:

# ca::ctrlaltdel:/sbin/shutdown -t3 -r now

执行:

telinit q

Centos6.x

vi /etc/init/control-alt-delete.conf

注释掉如下行:

# exec /sbin/shutdown -r now "Control-Alt-Delete pressed"


本文链接:http://junjiang.pw/post/41.html


推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信