CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Sudo command not working !!!

 



Vishza
New User

Dec 24, 2014, 12:15 AM

Post #1 of 2 (1111 views)
Sudo command not working !!! Can't Post

 

I am new to perl and have been trying a test script to perform a simple task by connecting to the root user and executing a command. I have not been very successful in this. Please assist. I have below: the sudoers file as well as my code piece. the test.log has no data in it.

# User alias specification User_Alias ROOT_ALLOW_SU=<myuser>
# Cmnd alias specification
# Defaults specification
# Runas alias specification
# User privilege specification
root ALL=(ALL) ALL
ROOT_ALLOW_SU ALL = NOPASSWD: /usr/local/bin/suroot
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now

I run the following in perl and my file is not populated:

Code
 system("sudo suroot -i /usr/bin/df -k > test.log");



Laurent_R
Veteran / Moderator

Dec 24, 2014, 12:51 AM

Post #2 of 2 (1110 views)
Re: [Vishza] Sudo command not working !!! [In reply to] Can't Post

Is this really a Perl question? Hmm, not quite sure...

What happens when you run this command:

Code
sudo suroot -i /usr/bin/df -k > test.log

from the shell prompt?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives