- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: change shell on login as root
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 09:56 PM
тАО08-19-2008 09:56 PM
change shell on login as root
I have a problem with the shell of user root, I changed the default shell directly in /etc/passwd file (big mistake), removing /sbin/sh and inserting /usr/local/bin/bash. But this shell, bash, is not properly installed, so now I cannot login or su - root.
Of course, I am not able also to modify back this file since I cannot login as root.
If I do su - root, I get an error when the system tries to load the bash shell and am disconnected.
The server is remote so I cannot access the console.
Is there any means to login as root but using sh shell and then fix the problem?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:14 PM
тАО08-19-2008 10:14 PM
Re: change shell on login as root
Now try this:
# su root -c /sbin/sh
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:16 PM
тАО08-19-2008 10:16 PM
Re: change shell on login as root
One way you could try is ftp the /etc/passwd to someother server, edit the file and put the file back using ftp.
Coz any other methods will use shell from passwd file and wont let you login.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:19 PM
тАО08-19-2008 10:19 PM
Re: change shell on login as root
This is HP recommendation also.
Doing ftp is good option as rajeev suggested..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:26 PM
тАО08-19-2008 10:26 PM
Re: change shell on login as root
I already tested su - root -c /sbin/sh but does not work coz shell is loaded before.
I have tried your suggestion but ftp also fails... I see in syslog file:
FTP LOGIN REFUSED (shell not in /etc/shells)
Would it be possible to fix at least connecting on the console? I suppose that shell is not loaded in single-user osr something like that and /etc/passwd might be changed, or not
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:30 PM
тАО08-19-2008 10:30 PM
Re: change shell on login as root
The only problem is to bring down the system - last effort will be a power cycle or hard reset.
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:34 PM
тАО08-19-2008 10:34 PM
Re: change shell on login as root
Would it be possible to fix at least connecting on the console? I suppose that shell is not loaded in single-user osr something like that and /etc/passwd might be changed, or not
Yes, but you will have to reboot your server. You don't have to boot in to single user mode, this will be done automaticly.
Login
# mount -a
set your TERM
# vi /etc/passwd
and change the root shell back to /sbin/sh
:wq!
# shutdown -r -y now
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2008 10:57 PM
тАО08-19-2008 10:57 PM
Re: change shell on login as root
You have not really tried what Torsten suggested!
su root -c /sbin/sh
You still used a hyphen in front of the root. Use it without the hyphen (dash). Just use
su root
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2008 12:27 AM
тАО08-20-2008 12:27 AM
Re: change shell on login as root
in fact I did test all possibilities, including without the hyphen:
som@gpparlay[HP-UX]:/home/som# su root -c /sbin/sh
Password:
/usr/lib/hpux32/dld.so: Unable to find library 'libtermcap.so'.
Killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2008 07:01 AM
тАО08-20-2008 07:01 AM
Re: change shell on login as root
If you have an NFS mount you might be able to put a setuid shell on the server and run it on the client to get root access.