LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 01-17-2006, 01:14 PM   #1
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Rep: Reputation: 17
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.


Regards,
John aka loadedmind
 
Old 01-17-2006, 03:33 PM   #2
shizzy-t
Member
 
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, 07:11 AM   #3
qs_tahmeed
Member
 
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, 07:57 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,522

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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-19-2006, 12:11 AM   #5
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
Quote:
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.

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

Quote:
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!
 
  


Reply


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 06:43 PM
can i change my passwd and login to ssh? pippet Linux - Newbie 1 10-27-2004 02:41 AM
how do i override intial login and passwd dogma Linux - General 3 07-18-2003 05:14 PM
cannot login as root /etc/passwd mistake swenz Linux - Software 3 03-27-2003 09:41 AM
can't login (corrupt etc/passwd ?) nimrod Linux - General 4 03-01-2003 11:26 PM


All times are GMT -5. The time now is 04:17 PM.

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