前言
对于一台服务器,每小时可能就会收到几万次攻击,因此安全问题尤为重要。
人类的每一次操作都会留下痕迹,因此我们必须做好每一次操作的防护安全措施。
百密一疏,最好的程序员,也会有打盹的时候,因此必须狠狠狠慎重!!!
所以对于登录而言,root账号登录的无限制操作尤其危险,我们必须做好防护准备,因此有了分用户及权限登录,那么如何操作呢,现在开始吧
创建用户并授权
1、#创建用户xxx
adduser xxx
2、#创建xxx的密码
passwd xxx
eg:
passwd 123
Changing password for user 123.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
3、#增加sudoers文件的写的权限,默认为只读
chmod -v u+w /etc/sudoers
4、#修改sudoers
vi /etc/sudoers
enter i 进入编辑模式,找到下面对应行,增加权限
-------------------------------------------------------
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
xxx ALL=(ALL) ALL (添加这一行)
-------------------------------------------------------
保存退出
5、#删除sudoers的写的权限
chmod -v u-w /etc/sudoers
完成!!!