Visit Jeremy's Blog.
Go Back > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.


  Search this Thread
Old 01-17-2006, 12:14 PM   #1
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 295
Blog Entries: 4

Rep: Reputation: Disabled
Can't login after modifying /etc/passwd

I can just hear the thoughts as the thread is read... I'll just say I know I messed up real bad and any/all help I can get to retrieve login short of reinstalling would be awesome. The system is Solaris 10 on a SunBlade 1000 with a gig of RAM.

The problem: I modified the /etc/passwd file and changed the shell for root but included an extra / in the path for the shell. Obviously, now, when attempting to login with the root account, I'm prompted with, "Unable to login, invalid shell".

What I've tried: I got to the ok> prompt and typed boot cdrom -s and modified the /etc/passwd to the correct path for the shell but, lo and behold, I'm probably not modifying the right file considering I booted off a cdrom disk. So, the question becomes, I suppose I need to mount my hard drive from the # prompt so that I can modify the passwd file. The prroblem is, I'm not entirely sure what that should be. I know I have an ide hard drive and I did try to mount what I thought to be the path, but obviously I'm doing something wrong. The system is in another side of the building so I'll have to go back and forth to it when information is requested which is no big deal, just FYI. Any/all help would be awesome. Perhaps there's a faster way to do this than booting from cdrom, but I'm not the guru on Solaris 10.

Thanks in advance and please let me know if I need to include more information than what I've given.

John aka loadedmind
Old 01-17-2006, 02:33 PM   #2
Registered: Dec 2003
Location: Maine/USA
Distribution: Fedora Core, Centos, Solaris
Posts: 34

Rep: Reputation: 15
It happens to the best of us. I know I've done it a few times in the past. He's what I did to fix it.

At the ok prompt do the boot cdrom -s
When the system comes up mount what you think is your root partition to /a
ie; mount /dev/dsk/c0t0d0s0 /a
Then cd /a/etc
Set your term so vi dosen't look all weird.
TERM=sun;export TERM
Then vi passwd
Fix the file, save it and you should be all set.

Good Luck!
Old 01-18-2006, 06:11 AM   #3
Registered: Nov 2003
Location: Bangladesh
Distribution: Solaris 10, FreeBSD 5.4
Posts: 101

Rep: Reputation: 15
You can also try to switch to Single user mode without booting from cdrom.

You will be prompted for root passwd and will be signed in with the
default shell SH. From there you can change the "/etc/passwd" and
exit - which will take you to the default runlevel.

I messed up in the same manner few days back. Put an extra "s" in
the shell's name.

Old 01-18-2006, 06:57 AM   #4
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,707

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Anyway, it is always a wrong idea to change root's shell.
This /etc/passwd entry is part of the system, and shouldn't be customized.
Old 01-18-2006, 11:11 PM   #5
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 295
Blog Entries: 4

Original Poster
Rep: Reputation: Disabled
ie; mount /dev/dsk/c0t0d0s0 /a
shizzyt - thanks! I actually just mounted the /dev/dsk/ to /mnt which seemed to work. From there, I vi'ed /mnt/etc/passwd which allowed me to change what I needed to change. Of course, as if on cue, I found the "exec" command for changing things for the root account so that one doesn't have to hold one's breath while editing such an important file.

You can also try to switch to Single user mode without booting from cdrom.
gs_tahmeed - awesome! Didn't know that.

Anyway, it is always a wrong idea to change root's shell.
jlliagre - I agree completely! lol... So idiotic on my part, I know... Guess it all goes back to that ole adage, "RTFM". Heh heh heh...

Thanks again everyone for your posts!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shutdown login in /etc/passwd khurdp Linux - General 1 01-05-2006 05:43 PM
can i change my passwd and login to ssh? pippet Linux - Newbie 1 10-27-2004 01:41 AM
how do i override intial login and passwd dogma Linux - General 3 07-18-2003 04:14 PM
cannot login as root /etc/passwd mistake swenz Linux - Software 3 03-27-2003 08:41 AM
can't login (corrupt etc/passwd ?) nimrod Linux - General 4 03-01-2003 10:26 PM > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration