LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-26-2011, 12:29 PM   #1
asemani
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Rep: Reputation: Disabled
Unhappy how can I change my shell without login!


hi.
I work with a text mode debian6.0 and when I was testing some commands, I changed default shell to ash. system replied that it has not ash shell.so I thought the shell did not change.
but when I start the system again and enter root password, I see a message like "can not execute ash. No such file or directory" and then system return to login page again. root is the only user on that system. so what should I do?
great thanks.

Last edited by asemani; 07-26-2011 at 12:30 PM.
 
Old 07-26-2011, 12:36 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852
Edit your bootloader so that it contains the option init=/bin/bash for starting with a bash shell. Then set the new shell and reboot.
 
Old 07-26-2011, 12:38 PM   #3
tinyTux
Member
 
Registered: Mar 2011
Location: Extended Memory
Distribution: Gentoo
Posts: 64

Rep: Reputation: 9
Quote:
Originally Posted by asemani View Post
hi.
I work with a text mode debian6.0 and when I was testing some commands, I changed default shell to ash. system replied that it has not ash shell.so I thought the shell did not change.
but when I start the system again and enter root password, I see a message like "can not execute ash. No such file or directory" and then system return to login page again. root is the only user on that system. so what should I do?
great thanks.
I believe this would work:
1. boot into linux using systemrescuecd or a gentoo cd or some other such tool.
2. mount the root filesystem
3. edit the /etc/passwd file (within the mounted partition). There should be a root entry. change the last part of it from /bin/ash to /bin/bash
4. reboot back into your normal system

I'm assuming you know how to do all the above, but let me know if you have any questions.
 
Old 07-26-2011, 03:17 PM   #4
asemani
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tinyTux View Post
I believe this would work:
1. boot into linux using systemrescuecd or a gentoo cd or some other such tool.
2. mount the root filesystem
3. edit the /etc/passwd file (within the mounted partition). There should be a root entry. change the last part of it from /bin/ash to /bin/bash
4. reboot back into your normal system

I'm assuming you know how to do all the above, but let me know if you have any questions.
thank you for replying...
unfortunately I don't have systemrescuecd and gentoo cd. are there any other way?
 
Old 07-26-2011, 03:34 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852
As stated above, when your bootloader starts press the right keys (should be printed on screen) to edit your boot config and add init=/bin/bash to the kernel line. The system will start to a simple bash shell, change your shell back with chsh root and reboot.
 
Old 07-26-2011, 04:03 PM   #6
asemani
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
As stated above, when your bootloader starts press the right keys (should be printed on screen) to edit your boot config and add init=/bin/bash to the kernel line. The system will start to a simple bash shell, change your shell back with chsh root and reboot.
I do that. but after editing and boot, when I type chsh, system shows PAM authentication failed! now what should I do?
 
Old 07-26-2011, 04:13 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852Reputation: 4852
Try it with chsh root or edit the /etc/passwd file as mentioned in a previous post.
 
Old 07-28-2011, 06:00 AM   #8
asemani
LQ Newbie
 
Registered: Jul 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
I login to recovery mode and type gedit /etc/passwd. but system did not do any thing!
 
Old 07-28-2011, 06:23 AM   #9
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Ah, had you started up an X server by that point? It might have given you an error along the lines of "cannot connect to display". Try
Code:
nano /etc/passwd
 
Old 07-28-2011, 09:23 AM   #10
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
Quote:
Originally Posted by tinyTux View Post
I believe this would work:
1. boot into linux using systemrescuecd or a gentoo cd or some other such tool.
2. mount the root filesystem
3. edit the /etc/passwd file (within the mounted partition). There should be a root entry. change the last part of it from /bin/ash to /bin/bash
On a system with shadow? Are you mad? Or are you a troll trying to make a bad situation worse?
 
Old 07-28-2011, 10:40 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by Andrew Benton View Post
On a system with shadow? Are you mad? Or are you a troll trying to make a bad situation worse?
Why would it be problematic? Maybe there's something I don't know but I would do exactly as asemani suggested ... ?
 
Old 07-29-2011, 05:28 PM   #12
tinyTux
Member
 
Registered: Mar 2011
Location: Extended Memory
Distribution: Gentoo
Posts: 64

Rep: Reputation: 9
Quote:
Originally Posted by Andrew Benton View Post
On a system with shadow? Are you mad? Or are you a troll trying to make a bad situation worse?
Why would that be a problem? We are only editing the default shell (which is stored in /etc/passwd) not changing the password.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change login shell in KDE? lucmove Linux - Desktop 2 09-06-2009 07:00 PM
How to change the default login Shell in FreeBSD paragkalra *BSD 6 04-16-2009 03:40 AM
how to change current bash to a login shell jackandking Linux - Newbie 13 10-22-2008 12:24 PM
Howto change the shell Automatically each time i login??? teddyZA Linux - Software 5 04-27-2007 10:39 AM
change login shell in mac os x, which file to edit feetyouwell Linux - Software 5 02-28-2004 07:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration