LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-19-2024, 05:45 AM   #1
donvito7
LQ Newbie
 
Registered: Nov 2023
Posts: 2

Rep: Reputation: 0
How to prevent giving sudo access to developers?


I have a group of dev team that keep asking me to be added to sudo users.

I do not want to do it because it is fat too much they need.

They all belong to a (tomcat) group and can do all of they need but when they need to start the application they script if calling sudo and tomcat user.

sudo -u tomcat /and the rest path to start it.

So when they execute the command they are propped about users password that is not in a sudo users group.

The access list does not resolve the issue in this case I suppose.

Could you advise what would be the best way to avoid it?
 
Old 04-20-2024, 04:08 PM   #2
blunix2
LQ Newbie
 
Registered: Apr 2024
Posts: 12

Rep: Reputation: 1
Not sure if I get this correctly but if your devs "dont listen", you could just override sudo by editing their PATH and replacing sudo with a command that simply discards all arguments and does nothing, but just execute the actual command.
 
Old 04-21-2024, 12:20 AM   #3
lvm_
Member
 
Registered: Jul 2020
Posts: 941

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
If you cared to peruse sudoers man page, you would've learned that sudo is not a 'gimme root' but fully granular control tools and lets one specify which user may run which command with which credentials.
 
Old 04-21-2024, 01:13 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,327
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by lvm_ View Post
If you cared to peruse sudoers man page, you would've learned that sudo is not a 'gimme root' but fully granular control tools and lets one specify which user may run which command with which credentials.
Indeed. sudo and sudoers are usually misunderstood, misconfigured, and abused. Ask your developers and find out which very specific tools they are really asking for and adjust the configuration to allow that and only that.

I would recommend Michael W Lucas' book, sudo Mastery, to take a deep dive into the capabilities of sudo as a tool for providing granular access. While the book is on order from your college library or via your local bookstore you can hunt down the video of his talk, "sudo: You're Doing It Wrong", to get a rather quick overview of the tool.

Then keep checking the manual page, using the command "man sudoers", as you go through the book. It is one of the more daunting manual pages out there, but is the ultimate reference (besides the source code) as to what the utility can do for you.
 
Old 04-21-2024, 07:17 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
I don't understand the requirement.
Perhaps you can give some invocation examples, what is allowed/denied for whom?

And list what you have already:
Code:
grep -s "^[^#]" /etc/sudoers /etc/sudoers.d/*
Perhaps the following examples are helpful.

Allow the members of a group to run certain commands as root without a password:
Code:
%tomcat ALL = (root) NOPASSWD: /path/to/cmd1, /path/to/cmd2
Exclude the members of a group:
Code:
User_Alias NOWEB = ALL, !%tomcat
Allow all the others to run ALL commands as ALL users (that's pretty unsafe of course):
Code:
NOWEB ALL = (ALL) ALL
 
Old 04-21-2024, 07:26 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
with other words: with sudo you can allow start/stop (or any other script) script to run only, nothing else. You just need to take care of that script (so nobody should be able to modify it).
 
Old 04-21-2024, 07:28 AM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,533

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Quote:
sudo is not a 'gimme root' but fully granular control tools and lets one specify which user may run which command with which credentials.
I agree with that and think that Canonical/Ubuntu bear a lot of responsibility for the abuse. The ubuntu.com site at the link below gives Advantages and Disadvantages of always using sudo and reading through the Advantages they are pretty silly reasons and seem to be pandering to the lazy. Number 8 on that list is what sudo is supposed to be used for.

https://help.ubuntu.com/community/RootSudo
 
  


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
LXer: The Differences between Su, Sudo Su, Sudo -s and Sudo -i LXer Syndicated Linux News 0 09-15-2022 07:47 PM
[SOLVED] sudo apt update and sudo apt-get update giving error cryptonic472 Linux - Software 7 08-24-2019 08:16 AM
Giving sudo access to a user by adding to a group lslack Linux - Server 4 11-03-2013 11:48 PM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
LXer: Microsoft! needs! Yahoo! developers! developers! developers! LXer Syndicated Linux News 0 02-01-2008 11:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:25 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