- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Is this possible with sudo !!!
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
07-17-2007 08:23 AM
07-17-2007 08:23 AM
Is this possible with sudo !!!
Is it possible for a normal user to run WITHOUT password the below command, who got limited sudo permission,
sudo su - root -c <script>
I know, instead we can just give the script in sudo for that user, to have root priviledge.. WH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 08:39 AM
07-17-2007 08:39 AM
Re: Is this possible with sudo !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 08:40 AM
07-17-2007 08:40 AM
Re: Is this possible with sudo !!!
Now this is exactly the kind of command that you do not want sudo to do. Let sudo execute this command directly and set the effective UID.
It would probably lead to a more straightforward solution if you explained what you are trying to do rather than asking if this Plan A, Plan B, or Plan C will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 08:42 AM
07-17-2007 08:42 AM
Re: Is this possible with sudo !!!
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 09:05 AM
07-17-2007 09:05 AM
Re: Is this possible with sudo !!!
username ALL=(ALL) NOPASSWD: ALL
Both of the below commands work.
sudo su -
sudo su - root
$ sudo su - root -c /home/kumarts/ebrdo0pb_dgfiles
You have mail.
sh: /home/kumarts/ebrdo0pb_dgfiles: not found.
logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 12:35 PM
07-17-2007 12:35 PM
Re: Is this possible with sudo !!!
Yes, the user can do *ANYTHING* without any additional password. So you might as well remove the password for root because there is absolutely no security now. The above construct has given keys away and your system may need a complete reinstall in a few minutes.
sudo's design is to LIMIT the root capabilities, by command, even down to the parameters allowed for a command. ALL=(ALL) just disables all those capabilities.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 12:54 PM
07-17-2007 12:54 PM
Re: Is this possible with sudo !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 06:29 PM
07-17-2007 06:29 PM
Re: Is this possible with sudo !!!
better is to find another (saner) solution to your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 07:05 PM
07-17-2007 07:05 PM
Re: Is this possible with sudo !!!
/usr/sbin/visudo
Under Cmnd alias specification
Cmnd_Alias ABCD=<script path>
Under User privilege specification
Username NOPASSWD: ABCD
If the user is already present in sudoers file, add (NOPASSWD: ABCD) at the end of the line.
Now run the scipt as
sudo <script path>
Please remove write permission for the user on the script. He shud have only read and execute. If he is given write permission on the script, he can modify the script for his needs.
This shud work, without a password and with violating security issues.
Ravi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 07:21 PM
07-17-2007 07:21 PM
Re: Is this possible with sudo !!!
I think this madness derives from settings in certain Live Linux or Ubuntu distros?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2007 11:24 PM
07-17-2007 11:24 PM
Re: Is this possible with sudo !!!
user host = (root) NOPASSWD: /usr/bin/su - root -c <script>
This will allow the user to run only this one script as root without asking for a password.
The user must then run the script _using exactly that specified command line_. The "<script>" should be specified as a full path, and the user must then always write it exactly the same way.
If you're sure you won't *ever* copy this sudoers file to other hosts without carefully inspecting it first, you can replace the "host" part with "ALL".
Note that you must always use a full path when identifying the commands the user may execute (i.e. "/usr/bin/su" instead of just "su"). If you don't use a full path, visudo will not accept it, because the user would be able to exploit the definition easily by changing his PATH setting.
Because visudo cannot verify the command arguments, it cannot force you to use a full path in "<script>". To keep your system secure, you must use a full path in this too.
As others have noted, the script (and the directory the script is located in) *must not* be writeable by the user.
Furthermore, if the script uses command line parameters or other user-supplied data, the script must be written *very very carefully*: if the script contains even a single unquoted parameter or variable expansion (like $1 or $something), the user might be able to gain unrestricted root by using strategically-placed semicolons in the parameters or other input.
MK