Root ShelI Change - changed /etc/passwd /sbin/sh to /sbin/bash and gave No Shell
Solaris / OpenSolarisThis 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.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Root ShelI Change - changed /etc/passwd /sbin/sh to /sbin/bash and gave No Shell
Dear Sirs,
I was troublshooting something about crontab, and I got carried away and went to /etc/passwd and changed /sbin/sh to /sbin/bash of root...
DUUHHH, /sbin/bash does NOT exist so when i tried to log in again it gave me, No Shell, and exits.
I have a Solaris 8, i have other login but it is NOT Super-User -admin. I wanted to add a script in /sbin named bash that would run /bin/sh just to bypass the issue but no permission on /sbin ( and obviously no permission on /etc/passwd ).
I read how would Solaris 10 fallback to /sbin/sh if 'No Shell' problem. But does Solaris 8 do the same ??
Is there any way to undo that? any way around it??
Please H.E.L.P.
regards.
-----------------------------------------
Life is about relativity of expectations.
You should boot from the Solaris cdrom and then mount the / partition, so you can edit /etc/passwd and undo the changes
Regards
IDK Solaris but is it not possible to log in as a non-root user and then use su to assume root privileges while continuing to use the non-root user's shell?
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Catkin,
Interesting. But I don't think it's going to work. I'm not going to mess up one of my root logins to see, but I did try it on another login. For example, the sasl account has /dev/null as its "shell" on one of my systems (Solaris 9, I don't have any 8 anymore). When I tried (from root) to `su sasl`, I got the reply "su: No shell" and was left at root.
Interesting. But I don't think it's going to work. I'm not going to mess up one of my root logins to see, but I did try it on another login. For example, the sasl account has /dev/null as its "shell" on one of my systems (Solaris 9, I don't have any 8 anymore). When I tried (from root) to `su sasl`, I got the reply "su: No shell" and was left at root.
Not quite what I was suggesting; I was thinking of logging in as a user that does have a valid shell and then "su"ing to root. AFAIK that simply changes the effective userid without changing the shell as opposed to su - root which simulates logging in as root, including changing to the shell configured for root in /etc/passwd.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Quote:
Originally Posted by catkin
Not quite what I was suggesting; I was thinking of logging in as a user that does have a valid shell and then "su"ing to root. AFAIK that simply changes the effective userid without changing the shell as opposed to su - root which simulates logging in as root, including changing to the shell configured for root in /etc/passwd.
But, `su sasl` is exactly what I tested. Not `su - sasl`.
So, just now I tested another one. I picked a user whose shell is bash. Mine is ksh. If I `su thatuser` (no "-"), I find that my shell is now bash. However, my environment otherwise (current directory, etc) is the same. If I had done `su - thatuser` I would have also gotten their login environment.
Bathory, is right. I'll go through the procedure. The only way to do it is from rebooting .. but i still didn't fix it yet.
(When i got to another login and su root [or - root or else ] it still gives me: No Shell . I even tried $ su root -c "vi /etc/passwd" but that didn't work as well)
I have a question, i have FTP running on this box and I have root in /etc/ftpusers being commented
$ cat /etc/ftpusers
# root
daemon
bin
but when i try to FTP in as root it tells me access denied (NB: there is no /etc/ftp/ the / is the ftp folder).
I wanted to use FTP to open /etc/passwd and change it, can you tell me why is it giving me access denied ?
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Sorry if the side discussion confused things. It has always been my understanding that boot off cd, mount the root file system, edit /etc/passwd is the only solution. I should have made that clear when I chased the side discussion. Check the link bathory gave for recovery details.
Cheegendyk,
At first i also thought of a way which will ask for root credentials and utilize the 'others' shell .. but i couldn't think of anything, i thought about piping, forking, a script ..something .. i couldn't find a solution. Then -as mentioned above- i thought of FTP, i already had the FTP site open from a windows computer but with a different account, i tried FTP via root, but that also didn't work, i think the reason is that the root 'shell' verifies the login of the root; and launches FTP binaries or so - so that didn't work as well.
I have a bigger problem now, i dont have the Solaris 8 CD anymore, i have 9 and 10 .... lucky me.
I'll probably sleep for a couple of days and hope the problem would vanish .. by itself.
one last thing: if it was my own box and was able to shut it down for a short time, i would have physically pulled of the HardDisk, mounted it on windows system, took ownership of the /etc/passwd and modified it.
(I'll probably do that since i dont have the boot CD of solaris 8)
Can windows write on a UFS file system? Even linux support for writing on UFS is experimental
You best bet is to get an Opensolaris live-cd and boot from it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.