In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to add users to CentOS to sudoers. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
When we encounter this problem, we need to add the current user to the sudoers user group.
one。 Modify the permissions of / etc/sudoers file
1. Because the owner of the / etc/sudoers file is root, the current permissions for this file are
-rMurray, Murray. 1 root root # 440
two。 If we want to modify this file, we need to change its permissions to write to other users, or switch to superuser mode.
Switch users: switch directly to root mode and modify the file directly
Or
Modify permissions: access as the current user after the permissions are modified as root.
two。 Add users to sudoers
1.
Root ALL= (ALL) ALL # is followed by a new line and adds the current user to it
Xxx ALL= (ALL) ALL
two。 If you don't want to enter your password every time, you don't have to enter your password every time after you change it.
Xxx ALL= (ALL) NOPASSWD: ALL
three。 Revoke changes to the permissions of / etc/sudoers file
If you add a user by modifying the permissions of the file, you need to restore the permissions properties of the file after the addition.
four。 Matters needing attention
For convenience when modifying permissions, direct chmod 777 / etc/sudoers must restore permissions after adding users. If not, the following error message will appear when executing the sudo command:
Sudo:/etc/sudoers is world writable
Sudo:no valid sudoers sources found, quitting
Sudo:unable to initialize policy plugin
The problem can be fixed by executing the following command
Run as root: chmod 440 / etc/sudoers
This is the end of the article on "how to add users to CentOS to sudoers". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.