Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does CentOS add users to sudoers

2025-01-21 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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report