Linux怎么添加用户成为sudoers?
1修改/etc/sudoers文件,进入超级用户,因为没有写权限,所以要先把写权限加上chmodu+w/etc/sudoers。 2编辑/etc/sudoers文件,找到这一行:"rootALL=(ALL)ALL"在起下面添加"zhcALL=(ALL)ALL"(这里的zhc是你的用户名),然后保存。 3最后恢复没有写权限模式,撤销文件的写权限,chmodu-w/etc/sudoers。 然后我们就可以用zhc用户来编辑root的文件了,比如 vi/etc/sysconfig/network-scripts/ifcfg-eth0 修改后,不能直接保存,因为没有权限,所以我们可以执行 :w!sudotee% 这个命令将当前的缓冲区内容输入到stdin,然后tee命令从标准输入到标准输出然后还有一个分流到文件,这里%代指当前文件。
linux /etc/sudoers权限修改,该怎么解决?
查看/etc/sudoers文件权限,如果只读权限,修改为可写权限[root@localhost~]#ll/etc/sudoers-r--r-----.1rootroot403012月1009:55/etc/sudoers[root@localhost~]#chmod777/etc/sudoers[root@localhost~]#ls-l/etc/sudoers-rwxrwxrwx.1rootroot403012月1009:57/etc/sudoers

