Linux为普通用户添加sudo权限:
有时候,Linux下面运行sudo命令,会提示类似:
xxx is not in the sudoers file. This incident will be reported.
这里,xxx是用户名称,然后导致无法执行sudo命令,这时候,如下解决:
进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用)
为系统增加普通用户:
[root@localhost ~]# useradd marry
[root@localhost ~]# echo "redhat" --stdin | password marry
添加文件的写权限:
[root@localhost ~]# chmod u+w /etc/sudoers
编辑/etc/sudoers文件,进入编辑模式,找到"root ALL=(ALL) ALL"这行在其下面添加sodu授权
[root@localhost ~]# vim /etc/sudoers
root ALL=(ALL) ALL
marry ALL=(ALL) ALL //此处的marry是系统中的普通用户
保存退出。
撤销文件的写权限:
[root@localhost ~]# chmod u-w /etc/sudoers
退出后以普通用户登录并使用sudo命令进行维护操作:
[root@localhost ~]# su - marry
[root@localhost ~]$ sodu iostart
有时候,Linux下面运行sudo命令,会提示类似:
xxx is not in the sudoers file. This incident will be reported.
这里,xxx是用户名称,然后导致无法执行sudo命令,这时候,如下解决:
进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用)
为系统增加普通用户:
[root@localhost ~]# useradd marry
[root@localhost ~]# echo "redhat" --stdin | password marry
添加文件的写权限:
[root@localhost ~]# chmod u+w /etc/sudoers
编辑/etc/sudoers文件,进入编辑模式,找到"root ALL=(ALL) ALL"这行在其下面添加sodu授权
[root@localhost ~]# vim /etc/sudoers
root ALL=(ALL) ALL
marry ALL=(ALL) ALL //此处的marry是系统中的普通用户
保存退出。
撤销文件的写权限:
[root@localhost ~]# chmod u-w /etc/sudoers
退出后以普通用户登录并使用sudo命令进行维护操作:
[root@localhost ~]# su - marry
[root@localhost ~]$ sodu iostart
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9034054/viewspace-2106554/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9034054/viewspace-2106554/