I'd really recommend avoiding editing /etc/password directly when
there are tools designed for doing it for you. You can either use the
usermod command:

# usermod -s /sbin/bash root

Or the passwd command:
# passwd -e
Old shell: /sbin/sh
New shell: 

The problem with simply editing /etc/passwd is that users using the
appropriate tools might make changes between the time you load the
file in the editor and the time you write it out, thus overwriting
their changes. Presumably, Sun will have made the above commands to
the appropriate locking.

For that matter, I'd recommend avoiding changing roots shell at all,
unless you're going to audit all of roots shell scripts to make sure
they all use /bin/sh, and never $SHELL (even implicitly). If you
really must work as root, set up your .bash_* stuff properly, and just
get used to running the one extra command "exec bash" after you su to
root. Better yet, get used to doing "exec zsh", and get a much better
shell :-).

        <mike


On Sat, 2 Aug 2008 16:43:09 -0400
"Nicholas Senedzuk" <nicholas.senedzuk at gmail.com> wrote:

> If you edit the the password file while someone is logged in it is not going
> to cause any problems. The next time the person opens a shell then they will
> receive the new shell.
> 
> 
> Yes you can use gedit or something like that but you should really use vipw.
> The one thing with this is that it does require you to know VI to edit the
> file.
> 
> 
> 
> On Sat, Aug 2, 2008 at 4:36 PM, andrew <andrum04 at gmail.com> wrote:
> 
> > The default shell for each user is stored in the /etc/passwd file on the
> > end of each line. Change into single user mode (init S) then edit the passwd
> > file using vi (vi /etc/passwd and change it.
> >
> > That's the safe, recommended way to do it. If you like to live dangerously,
> > you can simply make sure you're the only person logged in and do this in a
> > terminal window:
> >
> > su
> > (enter root password)
> > gedit /etc/passwd &
> >
> > Then edit the passwd file in the Gnome text editor (gedit).
> >
> > Cheers
> >
> > Andrew.
> >
> >
> > This message posted from opensolaris.org
> > _______________________________________________
> > opensolaris-help mailing list
> > opensolaris-help at opensolaris.org
> >


-- 
Mike Meyer <mwm at mired.org>           http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Reply via email to