- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Serious Sudo Help!
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
01-28-2011 08:01 AM
01-28-2011 08:01 AM
# visudo
Host_Alias LINUXHELP = test_server
User_Alias USERS = tester
Cmnd_Alias SERVICES = /etc/init.d/ntpd restart
USERS LINUXHELP = SERVICES
-----------------------------------------------
Saved the above and tried to login to the node as the user. And ran the following, however errored out:
[Test_Server: /home/tester]# sudo -u tester'/etc/init.d/ntpd restart'
tester is not allowed to run sudo on test_server. This incident will be reported.
-----------------------------------------------
The /var/log/secure file reports the following:
Jan 28 10:55:17 test_server sudo: tester: user NOT authorized on host ; TTY=pts/2 ; PWD=/home/tester ; USER=tester; COMMAND=/etc/init.d/ntpd restart
+++++++++++++++++++++++++++++++++++++++++
Please help me to fix. I did this before, and not sure hy it is not working. What am I doing wrong?
Thank you in an advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2011 08:57 AM
01-28-2011 08:57 AM
Re: Serious Sudo Help!
Based on a quick bit of testing on RHEL 5.5,
sudo seems to regard the quoted and unquoted versions as two different commands. Try without the quotes:
# sudo -u tester /etc/init.d/ntpd restart
If that does not work either, please run "sudo -l" as user "tester". If it does not list "/etc/init.d/ntpd restart" as an allowed command, it might be a hostname lookup mismatch. The hostname (or Host_alias) must exactly match the output of the "hostname" command.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2011 12:23 PM
01-31-2011 12:23 PM
Re: Serious Sudo Help!
[test_server: /home/tester]# sudo -l
[sudo] password for tester:
User tester may run the following commands on this host:
(root) /etc/init.d/ntpd restart
[test_server: /home/tester]# sudo -u tester /etc/init.d/ntpd restart
Sorry, user tester is not allowed to execute '/etc/init.d/ntpd restart' as tester on test_server.
[test_server: /home/teser]# hostname
tester
[test_server: /home/tester]#
Please guide.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2011 01:21 PM
01-31-2011 01:21 PM
Solution(root) /etc/init.d/ntpd restart
Your SUDO rights means user tester is allowed to run that command with "root" priviliges.
So:
tester% sudo /etc/init.d/ntpd restart
should do it. It will however prompt for tester's password.
Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2011 09:08 AM
02-01-2011 09:08 AM
Re: Serious Sudo Help!
Thank you, again.