In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to grant and remove sudo permissions for users on Ubuntu". In the daily operation, I believe that many people have doubts about how to grant and remove sudo permissions for users on Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "how to grant and remove sudo permissions for users on Ubuntu"! Next, please follow the editor to study!
As you know, users can perform any administrative task on the Ubuntu system with sudo privileges. When you create new users on the Linux machine, they cannot perform any administrative tasks until you add them to the sudo group. In this short tutorial, we will show you how to add a normal user to a sudo group and remove a given permission to make it a normal user.
Grant sudo permissions to ordinary users on Linux
Typically, we use the adduser command to create a new user, as shown below.
$sudo adduser ostechnix
If you want the 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 makes the user named ostechnix a member of the sudo group.
You can also use this command to add users to the sudo group.
$sudo adduser ostechnix sudo
Now log out and log in as a new user for this change to take effect. At this point, the user has become an administrative user.
To verify it, simply use sudo as a prefix in any command.
$sudo mkdir / test [sudo] password for ostechnix: removes a user's sudo permission
Sometimes, you may want to remove a specific user's sudo permissions without having to delete it in Linux. To make any user a normal user, simply remove it from the sudo group.
For example, if you want to remove a user named ostechnix from the sudo group, simply run:
$sudo deluser ostechnix sudo
Sample output:
Removing user `ostechnix' from group `sudo'... Done.
This command only removes the user ostechnix from the sudo group, but does not * remove the user from the system. Now it is a normal user, unable to perform any administrative tasks like a sudo user.
In addition, you can revoke a user's sudo access using the following command:
$sudo gpasswd-d ostechnix sudo
Be careful when removing users from the sudo group. Do not remove real administrators from the sudo group.
Use the command to verify that the user ostechnix has been removed from the sudo group:
$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 removing users from the sudo group. If you have only one sudo user on your system and you remove him from the sudo group, you will not be able to perform any administrative actions, such as installing, removing, and updating programs on the system.
At this point, the study on "how to grant and remove sudo permissions to users on Ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.