1. 添加新用户
我们在Linux系统中经常需要根据不同的需求创建对应的新用户, 但是新用户作为一个普通用户, 权限是非常有限的,
默认不能够使用管理员权限执行某些管理员才能执行的命令
, 给大家演示一下操作步骤:
SHELL
# 添加新用户 sanji
[root@VM-8-14-centos ~]# adduser sanji
# 给新用户 sanji 设置一个密码
[root@VM-8-14-centos ~]# passwd sanji
Changing password for user sanji.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
# 切换到 sanji 用户
[root@VM-8-14-centos ~]# su - sanji
# 让 sanji 用户执行一个只有管理员才有权限执行的操作, 因此需要在命令前加 sudo
[sanji@VM-8-14-centos ~]$ sudo updatedb
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for sanji:
sanji is not in the sudoers file. This incident will be reported.
最后命令还是没能够执行, 原因是没有权限, 最后提示告诉我们sanji is not in t