- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using Sudo with changing commandline "su root -c $...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 12:08 AM
02-13-2006 12:08 AM
Got this little problem to be solved:
Application X has an own adduser.sh script in which new users are being created.
In this script the command "su root -c $commandline" is being used.
Problem is that a regular user (application manager) now needs the root password to execute this command. I don't want to give the root password to this regular user. I want to seperate the system admin and the application admin completely.
I thought off using SUDO. But the problem is that the "$commandline" changes everytime. So It's not a fixed command that I can add to the list with "visudo"
Has anyone got an idea?
System:
Unix HP-UX B.11.11 U 9000/800
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 12:16 AM
02-13-2006 12:16 AM
Re: Using Sudo with changing commandline "su root -c $commandline"
Suggestion: create a control script that has sudo privileges.
That script can be permitted to accept certain command lintes. If not carefully crafted, this creates a security hole.
You must limit the command line via some mechanism.
Its not outside the world of possibilities to grant sudo priviledges to the command that the adduser.sh script calls. Perhaps go through it and look for a safe candidate for sudo.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 12:29 AM
02-13-2006 12:29 AM
Re: Using Sudo with changing commandline "su root -c $commandline"
Let me see if I understand this correctly:
create a script with all possibilities that the "$commandline" can have?
That should be a problem because the $commandline contains 5 variables, including a username. The username changes everytime, hundreds of users are being created.
Maybe it is possible to make a script that adds the "su root -c $command" to the sudo list using visudo, and removes it afterwards. But that would be a somewhat ridiculous way to compensate for the lack of security in the application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 02:09 AM
02-13-2006 02:09 AM
SolutionWhat is the problem of granting to the user the executing of the script without parameters?
If your script is called /usr/local/sbin/myscript.sh, and you grant the execution of that script, it does not matters the parameters passed to the script. You can control what parameters can't be passed for example or fine tune. So, in your script, instead of "su root -c $cmdline" you will have "sudo /usr/local/sbin/myscript.sh $cmdline". If myscript.sh is allowed in sudoers, this will run without problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 06:50 PM
02-13-2006 06:50 PM
Re: Using Sudo with changing commandline "su root -c $commandline"
In my place we have sudo configured where it do not consider arguments. In such a scenario I think there will be problems in giving su permissions to users.
A user allowed to do "sudo su - user" can easily do "sudo su - root" and then whatever he wants. Even if this is not the case check this out before finally giving it to users.
BTW, we have sudo for some other commands where arguments do not matter much.
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 06:57 PM
02-13-2006 06:57 PM
Re: Using Sudo with changing commandline "su root -c $commandline"
If you are going to use specific utility of useradd then you can add useradd command to get access for execution as root.
Put that in a script and execute it as $commandline.
or setup r* commands setup with .rhosts file to that regular user and root user.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2006 12:26 AM
02-24-2006 12:26 AM
Re: Using Sudo with changing commandline "su root -c $commandline"
#visudo
username ALL= NOPASSWD: /usr/bin/su *
In the applicationscript I added the sudo command at beginning of the command line.
So you get:
sudo -u root adduser username homedir etc.
Think this will also work, got to to test it:
#visudo
username ALL= NOPASSWD: /usr/bin/su *adduser*