问题描述
在创建了新的虚拟机和用户后,用户可能还没有超级管理员的操作权限:
[peng@localhost network-scripts]$ sudo su[sudo] password for peng: peng is not in the sudoers file. This incident will be reported.
解决方法:
使用su
切换到root用户,会需要root的密码:
[peng@localhost network-scripts]$ su Password: [root@localhost network-scripts]#
然后编辑sudoers文件nano /etc/sudoers
,找到下面的一行:
## Allow root to run any commands anywhereroot ALL=(ALL) ALL
增加新的用户名即可,我这里新用户为peng,后面ALL=(ALL) ALL照写
## Allow root to run any commands anywhereroot ALL=(ALL) ALLpeng ALL=(ALL) ALL
保存退出
附
一些用户相关常用的操作
adduser [用户名] : 新增用户 passwd [用户名] : 修改用户密码 userdel -r [用户名]: 删除用户