CentOS6创建用户并授权--桌面版

1.登录root用户

右键打开终端:
在这里插入图片描述

2.创建新用户

[root@localhost Desktop]# adduser Linging

并设置密码:

[root@localhost Desktop]# passwd Linging
Changing password for user Linging.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

提示密码太简单,不管它,继续输入(密码是不可见的,直接输入)。

3.授权

个人用户的权限只可以在本home下有完整权限,其他目录需要授权。
而经常需要root用户的权限,这时候sudo可以化身为root来操作。
sudo命令的授权管理是在sudoers文件里的。

可以看看sudoers在什么位置:

[root@localhost Desktop]# whereis sudoers
sudoers: /etc/sudoers.d /etc/sudoers /usr/libexec/sudoers.so /usr/share /man /man5/sudoers.5.gz

然后再查看这个文件的操作权限:

[root@localhost Desktop]# ls -l /etc/sudoers
-r–r-----. 1 root root 3729 Dec 8 2015 /etc/sudoers

可以看到只有读权限,下面就添加写权限:

[root@localhost Desktop]# chmod -v u+w /etc/sudoers
mode of `/etc/sudoers’ changed to 0640 (rw-r-----)

接下来添加内容:

[root@localhost Desktop]# vim /etc/sudoers

回车,并找到如下的位置,并添加:
在这里插入图片描述
然后按Esc键,输入 :wq,保存并退出。

最后把写权限收回:

[root@localhost Desktop]# chmod -v u-w /etc/sudoers
mode of `/etc/sudoers’ changed to 0440 (r–r-----)

最后我们可以查看用户:
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值