[ale] to sudo or not to sudo
Lightner, Jeff
JLightner at water.com
Thu Jan 26 10:06:38 EST 2012
So you have a command string that does something like:
"sudo script"
to do it all in one script?
-OR-
You have a cron job that runs something like:
"script"
and script contains a line that does "sudo otherscript"?
You can do the latter quite easily. When script runs the sudo otherscript command it will run and exit with a return code just like any other command. The rest of the script after the sudo otherscript line would have your python command in it.
The key in either case is to make sure that script is only writable by root (and ideally even only readable by root) including being in a directory that only root can modify. Anyone who can edit the script called by sudo can gain root privileges.
-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of John Pilman
Sent: Thursday, January 26, 2012 9:53 AM
To: Atlanta Linux Enthusiasts
Subject: [ale] to sudo or not to sudo
Gentle Folk
I have a bash script I often run which requires root access, so I
precede the command with sudo. It looks like this:
sudo bin/mount_some_network_folders
After that, I usually run a command that does not require root access.
It looks like this:
idle bin/ascript.py
So I thought, why not append that command to the end of my script and
save a score of keystrokes. My question is, can I return back from
the sudo while inside the bash script before executing that last line?
...John
_______________________________________________
Ale mailing list
Ale at ale.org
http://mail.ale.org/mailman/listinfo/ale
See JOBS, ANNOUNCE and SCHOOLS lists at
http://mail.ale.org/mailman/listinfo
Athena(r), Created for the Cause(tm)
Making a Difference in the Fight Against Breast Cancer
---------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
----------------------------------
More information about the Ale
mailing list