Solved

su: No shell when su-ing to root

Posted on 2000-04-13
9
491 Views
Last Modified: 2012-06-21
I've done something dumb and changed the shell field in the passwd file to /sbin/bash when it should be /bin/bash.  Now i can't login as root to fix it.
0
Comment
Question by:atozer
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:jonke
ID: 2715080
You're going to have to boot from cdrom, and change it this way. What OS are you using? In Solaris, you'd goto the ok prompt. You have to stop-a as obviously without super-user permission you cannot bring the machine down gently.

ok sync

ok boot cdrom -s

Once the machinne is up you need to find out what the boot device is. Use format or eeprom boot-device then grep the output through an ls -l of /dev to find this out. Often the boot disk is c0t0d0s2.

You then need to fsck it because you brought the system down harshly:

fsck /dev/rdsk/cXtXd0s0

Then mount the disk with the partiton on to any mount point:

# mount /dev/dsk/cXtXd0s0 /a

Then you can vi /a/etc/passwd and change the entry from here.

You'll have a similar sort of process to go through with other flavours of unix.
0
 

Author Comment

by:atozer
ID: 2715697
Exactly right.  Ta.  Also have been told that if login shell for root is changed from the bourne shell Solaris will slowely die.
0
 
LVL 2

Accepted Solution

by:
pheur earned 50 total points
ID: 2715716
If you are running Linux (linux puts bash in /bin, other OS'es put it it /usr/local/bin) reboot your system with Ctrl-alt-del and at the LILO prompt issue:
linux init=/bin/bash rw
It will drop you directly into a root shell. Then edit /etc/passwd, do `umount / ` and reboot. it does the job.

Alternatively, if you have sudo installed (this one works under any OS) du `sudo bash`. Of course, it is supposed that sudo is already set-up to allow you to become root, which I doubt it is on your machine.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:atozer
ID: 2718077
I was actually using Solaris.  I'm aware of how small a problem this is in Linux but I wanted to append an argument at boot or login to specify the login shell.  Im told it is not possible and jonke's answer is right on the mony.  This is my first time using experts exchange so somehow iv'e given the points to the wrong person.  Sorry jonke.
0
 
LVL 2

Expert Comment

by:jonke
ID: 2720133
Can I have my points then please as pheur seems to have nicked them........ Where's pheur?
0
 
LVL 3

Expert Comment

by:darinw
ID: 2720749
Hi all,

atozer: Please be very careful when accepting an answer to ensure that you award the right Expert. When you have 10 or 15 minutes, you can read through the Help Desk pages and perhaps get a better feel for how you manage your questions. The Help Desk link is at the top of every page. If you need assistance with the site, the Community Support link is at the bottom of every page.

jonke: Please see the question I have posted for you in this topic area:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=unix&qid=10329226 

darinw
Customer Service
0
 

Author Comment

by:atozer
ID: 2721156
I think I've worked it out.  Jonke posted his answer as a comment to which I cannot give points.  
0
 
LVL 3

Expert Comment

by:darinw
ID: 2721175
Yeah, it can be a challenge to know what to do with a question when you first start using Experts Exchange. Thankfully, it is not hard to get the hang of once you have posted a question or two.

Since an Expert had posted an answer, you had only two choices - reject it or accept it. If you had rejected it, you would have seen the 'Accept Comment as an Answer' button and you could have chosen one of jonke's comments as the solution.

Not to worry, we have everything straigtened out.

darinw
Customer Service
0
 

Author Comment

by:atozer
ID: 2721178
I think I've worked it out.  Jonke posted his answer as a comment to which I cannot give points.  
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LastLogonTimeStamp Attribute 7 49
auto mounter on solaris 1 71
Sed question 2 120
Showing a username in UNIX and using that name in the script 4 58
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question