LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-03-2007, 01:56 PM   #1
automata
Member
 
Registered: Oct 2006
Posts: 51

Rep: Reputation: 15
Problem with root shell


Hello all,

I have a problem with root shell.When I try to loggin as root with correct password I see
NO SHELL
this comes on very next line of the line in which I typed my password.

Can anyone help as soon as possible?

Automata
 
Old 06-03-2007, 02:12 PM   #2
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
You could check the etc/passwd file to see if root has no shell.

Code:
 grep root /etc/passwd
You can cat the /etc/passwd file to see how things should appear (compare to your normal user) you'll want bash i imagine
 
Old 06-07-2007, 01:02 AM   #3
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
grep root /etc/passwd gives
root:x:0:0:root:/root:bash

grep user /etc/passwd
user:x:1005:1005:user:home/parag:/bin/bash

Can you suggest me some solution on this.

Automata.
 
Old 06-07-2007, 12:45 PM   #4
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
root's shell (bash) is invalid, you need the absolute path (/bin/bash) as you have for your user, so just change it to /bin/bash. Of course, you need to be root to edit /etc/passwd but you can't become root because the shell is invalid. So, you'll need to boot straight into a shell. If you don't know how to do that, see my post in this thread http://www.linuxquestions.org/questi...d.php?t=557113 (post #6).

Note that the OP in that thread got a bit confused about the first line of my instructions. My fault, I should've been more clear. I meant of course that the init=/bin/sh should be appended to the grub/lilo prompt when you first boot up. If you're using lilo, type in linux (or whatever the label for your default kernel is) and then append the init=/bin/sh. If you're using grub, hit e to edit the default entry (or whichever entry you want to boot with) and append it to the command line, then hit b to boot (NOTE: do not escape back the the main menu or it'll wipe out your changes).

Last edited by dawkcid; 06-07-2007 at 01:08 PM.
 
Old 06-20-2007, 11:20 AM   #5
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
Root shell

Hello all,

Really thsnks for the great support.

I tried
append 'init=/bin/sh'
remount /rw
edit /etc/passwd
remount ro
exec /sbin/init

Now there are few things that i will like to clear.

I am using Knoppix 3.6 and it is not having append command. I dont know whether his code has to be written in editor or in root shell.
I dont know how to write and run the code in editor.

I can log in as root and go in to root shell from root.

Even remount is not an option in the knoppix 3.6.

Please tell me solution for this.

Regards,

Automata..
 
Old 06-20-2007, 03:39 PM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
"append" isn't a command. dawkcid is telling you to add "init=/bin/sh" to the end the GRUB or LILO prompt. For example, with LILO, you usually see something like:

boot: Linux,

where "Linux" is the title of your entry for Linux (not that it necessarily has to be "Linux" of course). You are to add "init=/bin/sh" to the end, so you have

boot: Linux init=/bin/sh

and then you can hit Enter and boot as normal. dawkcid has already given you the instructions for GRUB.
 
Old 06-24-2007, 03:34 AM   #7
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
Hello,

I tried

boot:Linux and boot:Linux init=/bin/sh

by pressing the tab while booting but it simply boots the machine and it gave

mount:fs type devfs not supported by kernel.
unmount:devfs:not mounted
sh-3.00#

i tried to change and lilo.conf by adding the line init=/bin/sh
I was just playing with it.but that didnot changed the things.

Regards,

automata..
 
Old 06-24-2007, 01:14 PM   #8
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
Quote:
sh-3.00#
Right, so it worked, you have a shell prompt. Now proceed as indicated above.
 
Old 06-25-2007, 01:51 AM   #9
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
yes when I get
sh3.0 and I try su root I again get No shell.
So how should i go further..

Automata.
 
Old 06-25-2007, 02:03 AM   #10
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You're already root.
 
Old 06-28-2007, 03:02 AM   #11
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
When i am using Ubuntu and i am root and if I again type
Su root
i can go to root or i can go to root when i have logged in as different user.but that is not happening here.Or please tell me how I can use sh 3.00$ where I am root.I am not able to halt the machine or operate anything

regards,

automata..

Last edited by automata; 06-28-2007 at 03:06 AM.
 
Old 06-28-2007, 06:49 AM   #12
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
By booting directly into a shell, you're automatically root.
So no "su root" is needed.

Normally, you should be able to become root (using "su root") when you're already
root (no password needed) or another user (in this case, root password is required).
But, su starts a new shell and it determines which shell to start from the /etc/passwd file. So, yes, you'll see an error whenever you "su" to root.

A quick look in su's man page indicates that you can force the selection of the shell to start. This is really what you need:
Code:
su --shell=/bin/bash
You don't have to boot directly into a shell (using the init=/bin/sh boot option) to do this.

If you did boot directly into the shell, you can also use the command
Code:
chsh
at the
sh-3.00#
prompt.
chsh will change the login shell for root.
 
Old 06-28-2007, 02:34 PM   #13
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
Quote:
su --shell=/bin/bash
Is that a new option? I don't have it here (Slack 10.1).

chsh is usually in /usr/bin, so you'd need to mount /usr.
 
Old 06-28-2007, 10:30 PM   #14
automata
Member
 
Registered: Oct 2006
Posts: 51

Original Poster
Rep: Reputation: 15
This is what I get

su -shell = /bin/sh
unknown id:=
sh-3.00#bash (I have a bourne shell)
root@(none):/#su root
No shell

root@(none):/# edit /etc/passwd
warning unknown mime-type for "/etc/passwd" -- using "application/*"
Error:No Edit mailcap rules found for type "application/*"
root@(none):#

I tried the "edit" as you had mentioned it in previous thread.

Also when I tried to delete user
userdel:unable to lock passwd file
/usr/sbin/deluser:/usr/sbin/userdel user returned error code 1.aborting.

regards,

automata..
 
Old 06-29-2007, 02:06 AM   #15
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Quote:
Originally Posted by automata
su -shell = /bin/sh
Please pay more attention to the exact syntax. The spaces will mess up the command and the "shell" option has a double dash "-" in front. Finally, you may want "bash" shell instead of "sh".
From the man pages, I gather that it should be
Code:
su --shell=/bin/bash
#or
su -s /bin/bash
When I mentioned "edit", I didn't imply the "edit" command. I was implying to use your favorite text editor (nano, pico, vi, emacs, kedit, gedit, nedit,...) to edit the file.

Why did you try to delete a user? I hope you're not trying to delete the "root" user, because that will make things only worse, not better...
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
root has no shell how do i get out of this evzen Linux - Software 2 05-10-2006 09:06 PM
changing root shell surfbass Linux - General 1 10-28-2005 02:03 PM
How to login root shell satimis Linux From Scratch 7 07-11-2005 08:07 PM
get root shell with gdb Musikolo Linux - Security 1 02-15-2005 04:06 PM
su to root in my shell script? lel800 Programming 2 08-20-2003 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration