In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Xiaobian to share with you how to authorize users and remove sudo permissions in Linux, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
As you know, users can perform any administrative task with sudo privileges on Ubuntu systems. When creating new users on Linux machines, they cannot perform any administrative tasks until you add them to the sudo group.
Granting sudo privileges to ordinary users on Linux
Typically, we create new users using the adduser command, as shown below.
$ sudo adduser ostechnix
If you want your newly created user to perform administrative tasks using sudo, simply add it to the sudo group using the following command:
$ sudo usermod -a -G sudo hduser
The above command will make a user named ostechnix a member of the sudo group.
You can also use this command to add users to sudo groups.
$ sudo adduser ostechnix sudo
Now log out and log in as the new user for this change to take effect. The user has become an administrative user.
To verify it, simply prefix any command with sudo.
$ sudo mkdir /test[sudo] password for ostechnix: remove sudo privileges from user
Sometimes, you may want to remove sudo privileges for a particular user without removing it in Linux. To make any user normal, simply remove them from the sudo group.
For example, if you want to remove a user named ostechnix from the sudo group, you simply run:
$ sudo deluser ostechnix sudo
Example output:
Removing user `ostechnix' from group `sudo' ... Done.
This command only removes user ostechnix from the sudo group, but does not permanently remove the user from the system. Now, it's a regular user, unable to perform any administrative tasks like sudo users.
In addition, you can revoke sudo access from users using the following command:
$ sudo gpasswd -d ostechnix sudo
Be careful when deleting users from sudo groups. Do not remove real administrators from sudo groups.
Verify that user ostechnix has been removed from the sudo group with the command:
$ sudo -l -U ostechnixUser ostechnix is not allowed to run sudo on ubuntuserver.
Yes, user ostechnix has been removed from the sudo group and he cannot perform any administrative tasks.
Be careful when deleting users from sudo groups. If you have only one sudo user on your system and you remove him from the sudo group, you cannot perform any administrative operations, such as installing, removing, and updating programs on your system. So be careful. In our next tutorial, we will explain how to restore sudo permissions to users.
The above is "How to authorize and remove sudo permissions for users in Linux" all the content of this article, thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.