Linux - GeneralThis 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
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.
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.
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).
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.
"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.
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
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.
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.
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...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.