This is a discussion on Sticky bit to allow access permission? within the Linux Operating System forums, part of the Unix Operating Systems category; --> Hi there, can someone tell me how the sticky bit can be used in a shell script to allow ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi there, can someone tell me how the sticky bit can be used in a shell script to allow a normal user to run a root command such as adding a new user? So far im working with a simple script: echo "I dont like" $1 exec $1 I obviously need to alter the first line with something that will set permissions but i dont know what to put. Please help! |
| |||
| richardrothwell@gmail.com <richardrothwell@gmail.com> wrote: > Hi there, can someone tell me how the sticky bit can be used in a shell > script to allow a normal user to run a root command such as adding a > new user? You cannot use the sticky bit for it, what you probably mean is the setuid bit. My advice is to forget that idea. It would make your system insecure, and you do not seem to know enough about Linux to really know what you are doing. If you are really, really certain that you want a normal user execute a root command, look at 'sudo', a utility that lets you do exactly that. Yours, Laurenz Albe |
| ||||
| On 22 Jun 2006, in the Usenet newsgroup comp.os.linux.setup, in article <1150982317.699003.264750@i40g2000cwc.googlegroups .com>, richardrothwell@gmail.com wrote: >Hi there, can someone tell me how the sticky bit can be used in a shell >script to allow a normal user to run a root command such as adding a >new user? 1. It's not the sticky bit (which shows up as a 't' or 'T' in the execute permission for others), but the SUID bit (which shows up as an 's' or 'S' in the execute permission for the owner). See the 'chmod' man page. 2. The kernel ignores SUID (and SGID) on shell scripts - it's a massive security problem. 3. Use 'sudo' to run the 'adduser' or 'useradd' command. 'man sudo' >So far im working with a simple script: > >echo "I dont like" $1 >exec $1 Well, that certainly won't do much. Perhaps you should start with the Bash-Prog-Intro-HOWTO -rw-rw-r-- 1 gferg ldp 31540 Jul 27 2000 Bash-Prog-Intro-HOWTO and then wander over to the Linux Documentation Project at http://tldp.org/guides.html and grab a copy of The Grendel's fabulous "Advanced Bash Scripting Guide". From a recent post to comp.os.linux.announce Announcing the version 3.9 release of the "Advanced Bash Scripting Guide." This e-book tutorial and reference is the equivalent of a 700-page print book. With 320 illustrative examples (including such goodies as an anti-spammer script), the book covers virtually every aspect of scripting. The web site has the document in a number of file formats. I'd recommend the HTML tarball Old guy |