In Linux, how does one add a user to sudoers? sometimes when we execute sudo, xxxisnotintthesudoersfile tells us that the current user is not sudoer, so we need to add the current user as follows: 1. modify the/etc/sudoers file and enter the Super... in Linux, how does one add a user to sudoers? sometimes when we execute sudo, xxx is not int the sudoers file tells us that the current user is not sudoer, so we need to add the current user as follows: 1. modify the/etc/sudoers file and enter the Super User. because there is no write permission, add the write permission to chmod u + w/etc/sudoers first. 2. edit the/etc/sudoers file and find this line: "root ALL = (ALL) ALL" add "zhc ALL = (ALL) ALL "(here zhc is your user name), and then save. 3. Finally, the system restores the write permission mode and revokes the write permission for the file. chmod u-w/etc/sudoers. Then we can use zhc users to edit the root file, such as vi/etc/sysconfig/network-scripts/ifcfg-eth0 after modification, can not be saved directly, because there is no permission, so we can execute: w! Sudo tee % This command inputs the current buffer content to stdin, then the tee command from standard input to standard output, and then another shunt to the file, here % represents the current file.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.