Using sudo in scripts

Brent Fortman Brent.Fortman at radioshack.com
Wed Aug 7 14:01:12 EDT 2002


No, you do not have to pre-fix every command with sudo.  Sudo <myscript>
will execute all commands in <myscript> as root.

Brent

-----Original Message-----
From: Gary Call [mailto:gcall at starcalif.com] 
Sent: Wednesday, August 07, 2002 11:38 AM
To: sudo-users at sudo.ws
Subject: Using sudo in scripts


This may sound like a basic question, but I have not been able to find
an answer anywhere.

Here is my scenario:
I need to give "userA" sudo access to a menu driven script.  The menu
driven script will execute other system commands (i.e. cpio, tar, mt).

Question:
If the user executes the script (using sudo), will all of the other
commands (cpio, tar, mt....) be executed with sudo prefixed, or will I
need to prefix every command with sudo into the script?

Any help or guidance is greatly appreciated!

Thanks,
Gary

____________________________________________________________ 
sudo-users mailing list <sudo-users at sudo.ws>
For list information, options, or to unsubscribe, visit:
http://www.sudo.ws/mailman/listinfo/sudo-users



More information about the sudo-users mailing list