|
|
The SUID Bit
Alternatively, you could set the owner of the shell script to root and set the uid (SUID) bit. Then you could run the script w/o having to type sudo (the SUID bit causes the script to run with the rights of the owner). A note of caution here: setting the uid bit on a script could compromise your system. Be sure you know what the script does (everything it does) before doing so. Think twice before setting the SUID bit for scripts (owned by root) that take arguments at the command line. Since you never know what parameters a malicious user may pass to your script. Since the script would run as root it could do great damage if misused. So, here's what you'd do:
Now when you want to run the script, just type the name of the script (if it's in your path) or ./update_codes.sh when you're in the same directory. Jennifer
The SUID Bit
I'm not sure, but I don't believe the SUID bit works on shell scripts...
The SUID Bit
It does... try it. I have a few scripts set up this way, works great
The SUID Bit
Think twice before setting the SUID bit for scripts (owned by root) that take arguments at the command line. Since you never know what parameters a malicious user may pass to your script. Since the script would run as root it could do great damage if misused.Not enough. The invoker could set an environment variable which causes the script to be parsed differently by the shell. Take $IFS for example, normally containing SP TAB NEWLINE. Add a well-chosen letter to that and the script does something the author never dreamed of. Setuid shell scripts are Bad Juju. If you think you must have one, write a setuid C wrapper that cleans the environment, then does setreuid() and runs the script. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.14 seconds |
|