Re: No benefit for running sash as root shell?
On 29 Aug 1998, Guy Maor wrote:
> Raul Miller <rdm@test.legislate.com> writes:
>
> > (1) mechanism for adding the alias (locking /etc/passwd falls in
> > this area).
>
> Something like this is safe. (this is untested)
>
> adduser --system toor
> echo "#!/bin/perl -ipe\ns/(^toor:[^:]+):\d+/$1:0/; > /etc/sashfixpw
Isn't there a window here where another concurrent invocation of this
script might step on /etc/sashfixpw during the processing below?
> chmod +x /etc/sashfixpw
> VISUAL=/etc/sashfixpw vipw
> rm /etc/sashfixpw
How about something like (also untested):
TMPFILE=`mktemp /tmp/$0.XXXXXX` || exit 1
echo "#!/bin/perl -ipe\ns/(^toor:[^:]+):\d+/$1:0/; >$TMPFILE
chmod +x $TMPFILE
VISUAL=$TMPFILE
vipw
rm $TMPFILE
Reply to: