LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-06-2022, 04:45 AM   #1
NewRH
LQ Newbie
 
Registered: Sep 2022
Posts: 18

Rep: Reputation: 0
Sudoers file: how to add only certain tasks


Hello,

I should allow one user to manage storage and install and manage softwares, but nothing more. I know I should modify the /etc/sudoers file but I cannot find the exact syntax to do so.

Thank you!
 
Old 10-06-2022, 05:26 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Hello,

Start by listing the specific commands along with the exact options those commands need and the user groups which will need each specific list of commands+options. The details of managing packages will depend on your distro, and whether you mean graphically or via the shell.

The manual page for sudoers is useful but it is also very long and very hard to understand at first. So here are some examples to look at before checking the manual page "man sudoers" again:

Code:
%sys ALL=(root:root) /sbin/shutdown, /usr/bin/updatedb ""
That allows the accounts in the group 'sys' to run, as root, the utility shutdown with as many options as they want. At the same time the utility updatedb can be run as root but only without any options.

Code:
%adm ALL=(root:root) /usr/sbin/service apache2 start, \ 
     /usr/sbin/service apache2 stop, \
     /usr/sbin/service apache2 reload
That allows the accounts in the group 'adm' to run the utility service but only with the options "apache2 start", "apache2 stop", or "apache2 reload".


Which distro is this for, including version?
 
Old 10-06-2022, 06:26 AM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Make sure you use 'visudo' to make changes, it is much safer than regular editor.
 
1 members found this post helpful.
Old 10-06-2022, 08:58 AM   #4
NewRH
LQ Newbie
 
Registered: Sep 2022
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Turbocapitalist View Post
Hello,

Start by listing the specific commands along with the exact options those commands need and the user groups which will need each specific list of commands+options. The details of managing packages will depend on your distro, and whether you mean graphically or via the shell.

The manual page for sudoers is useful but it is also very long and very hard to understand at first. So here are some examples to look at before checking the manual page "man sudoers" again:

Code:
%sys ALL=(root:root) /sbin/shutdown, /usr/bin/updatedb ""
That allows the accounts in the group 'sys' to run, as root, the utility shutdown with as many options as they want. At the same time the utility updatedb can be run as root but only without any options.

Code:
%adm ALL=(root:root) /usr/sbin/service apache2 start, \ 
     /usr/sbin/service apache2 stop, \
     /usr/sbin/service apache2 reload
That allows the accounts in the group 'adm' to run the utility service but only with the options "apache2 start", "apache2 stop", or "apache2 reload".


Which distro is this for, including version?
Thank you! I am on RHEL 8.5
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [sudoers]How-to edit '/etc/sudoers'? anon093 Linux - Security 3 01-02-2021 01:51 PM
[SOLVED] User not in sudoers: How to add user? Permtion Denied for sudoers file esgol Linux - Newbie 3 07-13-2012 07:44 AM
LXer: Google Tasks Indicator: Quick Access To Your Google Tasks From The Ubuntu Panel LXer Syndicated Linux News 0 03-06-2012 11:40 PM
Fedora /etc/sudoers file and sudoers.d directory davejjj Linux - Newbie 2 10-21-2011 06:19 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration