How to Quickly Give Users sudo Privileges in Linux

We Keep you Connected

How to Quickly Give Users sudo Privileges in Linux

How to Quickly Give Users sudo Privileges in Linux
Your email has been sent
If you have users that need certain admin privileges on your Linux machines, here’s a walk-through of the process for granting full or specific rights.
How many times have you created a new user on a Linux machine, only to find out that new user doesn’t have sudo privileges? Without the ability to use sudo, that user is limited in what they can do. This, of course, is by design; you certainly don’t want every user on your system to have admin privileges. However, for those users you do want to enjoy admin rights, they must be able to use the sudo command.
Jump to:
Most modern Linux distributions have a user group which grants sudo privileges simply by virtue of being a member of that group. While sudo configurations do allow for individual accounts to have sudo privileges, this is not encouraged because it leads to user management headaches, especially if a user ID is changed or if that user’s account is removed or deactivated.
SEE: Learn how to start, stop and restart services in Linux.
You can determine which group this is by looking at the /etc/sudoers file. You can safely view the contents of this file using the command:
sudo less /etc/sudoers
In Federa and Red Hat, this group is usually the wheel group (Figure A):
## Allows people in group wheel to run all commands
%wheel   ALL=(ALL)         ALL

Figure A
In Ubuntu and Kali, this group is usually the sudo group, not to be confused with the sudo command (Figure B):
# Allow members of group sudo to execute any command
%sudo    ALL=(ALL:ALL)  ALL

Figure B
This means all members of the admin group have full sudo privileges. To add your user to the admin group, you would issue the command (as a user who already has full sudo privileges):
sudo usermod -a -G sudo USERNAME
Where USERNAME is the name of the user to be added. Once the user logs out and logs back in, they will now enjoy full sudo privileges. If you were using Fedora or a Red Hat-based distribution, you would use the wheel group instead:
sudo usermod -a -G wheel USERNAME
Note that the user will continue to have sudo privileges as long as that user has this group assignment. To revoke sudo privileges, you will need to remove that user from that group.
Obviously, you do not want to add every user to the sudoers file or to the admin group. Use this with caution; otherwise, you run the risk of jeopardizing system security. But with care, you can manage what your users can and cannot do with ease.
Using your newfound sudo privileges, you can add a new user to your Linux system, list system services and search for files from the command line.
In addition, you’ll want to make administration easier by combining multiple commands into a single bash prompt.
Stay up to date on the latest in technology with Daily Tech Insider. We bring you news on industry-leading companies, products, and people, as well as highlighted articles, downloads, and top resources. You’ll receive primers on hot tech topics that will help you stay ahead of the game.
How to Quickly Give Users sudo Privileges in Linux
Your email has been sent
Your message has been sent
TechRepublic Premium content helps you solve your toughest IT issues and jump-start your career or next project.
Microsoft is also running a grant competition for ideas on using AI training in community building.
Generative AI will be a game changer in cloud security, especially in common pain points like preventing threats, reducing toil from repetitive tasks, and bridging the cybersecurity talent gap.
Does your business need a payroll provider that offers international payroll services? Use our buyer’s guide to review the best solutions, from ADP to Oyster.
Get up and running with ChatGPT with this comprehensive cheat sheet. Learn everything from how to sign up for free to enterprise use cases, and start using ChatGPT quickly and effectively.
Looking for an alternative to monday.com? Our comprehensive list covers the best monday alternatives, their key features, pricing, pros, cons and more.
Stay up to date on the latest in technology with Daily Tech Insider. We bring you news on industry-leading companies, products, and people, as well as highlighted articles, downloads, and top resources. You’ll receive primers on hot tech topics that will help you stay ahead of the game.
Vendors are key to the success of almost every information technology consultant. Strong vendor relationships help good consultants excel, but a dysfunctional vendor alliance can sink even the most astute of consulting firms. Thus, vendor relationships are critical, yet their importance is often (and easily) overlooked. So what’s a time-pressed consultant to do? This checklist …
Wearable devices are becoming more common as a result of technological advancements and new capabilities. These devices may exist in the form of clothing, watches or eyewear and can serve as standalone gadgets or may link to another device such as a smartphone, tablet or laptop. This Wearable Device Policy, from TechRepublic Premium, is designed …
Companies have relied upon data for decades as a means to engage in business practices and achieve operational success, but the relatively new concept of “big data” has grown rapidly over the past few years. Businesses both large and small are leveraging the advantages of big data to ensure relevance and flexibility in today’s ever-changing …
By deploying the right help desk ticket management system, successful growing businesses can document, manage and solve technical problems for employees and customers systematically and efficiently. The following guidelines from TechRepublic Premium will help you evaluate solution criteria and find, document and deploy the best solution for your business. From the guide: When choosing which …

source

GET THE LATEST UPDATES, OFFERS, INFORMATION & MORE