Re: Shell Script and SUID?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well, thank you, Tom and Keith.
I've checked the man page of 'passwd' and it actually has the option
'--stdin', which tells the command to accept the new password from standard
input just once; making it easy to automate things.

Regarding my SUID problem, I'll take a look at SUDO. Thanks for your
suggestion.

Vidol

----- Original Message -----
From: Keith Winston <kwinston@xxxxxxxxxxx>
To: <psyche-list@xxxxxxxxxx>
Sent: Friday, April 18, 2003 6:53 PM
Subject: Re: Shell Script and SUID?


> Loeung Vidol wrote:
> > Hi all:
> >
> > Can I set SUID to a shell script that looks like the following:
> > ---------------------
> > #!/bin/bash
> >
> > #Name: add4all.sh
> > #Usage: add4all.sh username password
> >
> > /usr/sbin/useradd $1
> > /bin/echo "$2" | /usr/bin/passwd --stdin $1
> > ------------------------
> >
> > so that any user can use it?
> >
> > Well, it's not really important but i'd like to know if it can be done.
>
> Other than your script having errors (there is no --stdin option AFAIK),
> you can set the SUID bit on any executable, including a shell script and
> it will run as root, allowing anyone who can execute the script to use it.
>
> Of course, it is very dangerous to do this, because once you get the
> script working above, anyone could change the root password and own your
> machine.  Generally, SUID programs/scripts are a bad idea.  Look at the
> sudo command if you want to share some admin responsibilities without
> sharing root.
>
> Best Regards,
> Keith
> --
> LPIC-2, MCSE, N+
> Droplets of yes and no in an ocean of maybe
> Got spam? Get spastic http://spastic.sourceforge.net
>
>
>
> --
> Psyche-list mailing list
> Psyche-list@xxxxxxxxxx
> https://listman.redhat.com/mailman/listinfo/psyche-list




-- 
Psyche-list mailing list
Psyche-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux