Link to home
Start Free TrialLog in
Avatar of atozer
atozer

asked on

su: No shell when su-ing to root

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.
Avatar of jonke
jonke

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.
Avatar of atozer

ASKER

Exactly right.  Ta.  Also have been told that if login shell for root is changed from the bourne shell Solaris will slowely die.
ASKER CERTIFIED SOLUTION
Avatar of pheur
pheur

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of atozer

ASKER

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.
Can I have my points then please as pheur seems to have nicked them........ Where's pheur?
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:

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

darinw
Customer Service
Avatar of atozer

ASKER

I think I've worked it out.  Jonke posted his answer as a comment to which I cannot give points.  
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
Avatar of atozer

ASKER

I think I've worked it out.  Jonke posted his answer as a comment to which I cannot give points.