LinuxQuestions.org
Help answer threads with 0 replies.
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 05-15-2010, 02:14 PM   #1
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Rep: Reputation: 16
issue with 'su ' login


Code:
[avi@localhost ~]$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash:/sbin
bin:x:1:1:bin:/bin:/sbin/nologin
I made following change to the /etc/passwd file.I added /sbin with a hope to avoid setting PATH every time i need a command from /sbin but i ended up with following:
Code:
[avi@localhost ~]$ su
Password: 
su: /bin/bash:/sbin: No such file or directory
i cannot delete that entry from /etc/passwd as i cannot login as root.

please help!
 
Old 05-15-2010, 02:18 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

Why would you do that? The /bin/bash in the passwd file is just the shell that's been assigned to root and has nothing to do with your PATH environment. Remove it from the passwd file and you'll not have the error any more. If you want to know what's in your path variable then echo it:
Code:
echo $PATH
Kind regards,

Eric
 
Old 05-15-2010, 02:21 PM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Also check your /var/backups (if that exists), I seem to remember that Debian makes backups of passwd and shadow to that directory. Not sure if it's the same for your distro (CentOS wasn't it?).

Kind regards,

Eric
 
Old 05-15-2010, 02:36 PM   #4
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by EricTRA View Post
Hi,

Also check your /var/backups (if that exists), I seem to remember that Debian makes backups of passwd and shadow to that directory. Not sure if it's the same for your distro (CentOS wasn't it?).

Kind regards,

Eric
there is no place like /var/backups here.
Any other way??
 
Old 05-15-2010, 03:00 PM   #5
Awatto
Member
 
Registered: Aug 2003
Location: Halifax, NS
Distribution: Debian, Gentoo, Ubuntu, Fedora
Posts: 128

Rep: Reputation: 30
Try su with the --shell argument.

Code:
su --shell=/bin/bash
From there, edit that file back to the original. To change your shell please use chsh from now on.

If you'd like to change your path, look at .bash_profile
 
Old 05-15-2010, 03:04 PM   #6
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by Awatto View Post
Try su with the --shell argument.

Code:
su --shell=/bin/bash
From there, edit that file back to the original. To change your shell please use chsh from now on.

If you'd like to change your path, look at .bash_profile
Code:
[avi@localhost ~]$ su --shell=/bin/bash
Password: 
su: using restricted shell /bin/bash:/sbin
su: /bin/bash:/sbin: No such file or directory
is what i get.No change!
 
Old 05-15-2010, 03:07 PM   #7
Awatto
Member
 
Registered: Aug 2003
Location: Halifax, NS
Distribution: Debian, Gentoo, Ubuntu, Fedora
Posts: 128

Rep: Reputation: 30
err, try it without the equals, sorry.

Code:
su --shell /bin/bash
hope that works
 
Old 05-15-2010, 03:12 PM   #8
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Unhappy

Quote:
Originally Posted by Awatto View Post
err, try it without the equals, sorry.

Code:
su --shell /bin/bash
hope that works
nay...same result!
 
Old 05-15-2010, 03:21 PM   #9
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Try as the user you're logged in with:
Code:
sudo vi /etc/passwd
and see if that give you a result. When it asks for a password, you have to provide your user password, not the root one.

Kind regards,

Eric
 
Old 05-15-2010, 03:30 PM   #10
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by EricTRA View Post
Hi,

Try as the user you're logged in with:
Code:
sudo vi /etc/passwd
and see if that give you a result. When it asks for a password, you have to provide your user password, not the root one.

Kind regards,

Eric
Code:
[avi@localhost ~]$ sudo vi  /etc/passwd
Password: 
avi is not in the sudoers file.  This incident will be reported.
i cant edit the sudoers file without root access.i am in kinda "catch your own tail situation"

Last edited by avee137; 05-15-2010 at 03:32 PM. Reason: misprint
 
Old 05-15-2010, 03:34 PM   #11
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Quote:
Originally Posted by avee137 View Post
i cant edit the sudoers file without root access.i am in kinda "catch your own tail situation"
Hello,

That's what happens when you put stuff in places where it doesn't belong. I'm sure you've learned a lesson here, first study, learn, investigate before trying out stuff.

Kind regards,

Eric
 
Old 05-15-2010, 03:48 PM   #12
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by EricTRA View Post
Hello,

That's what happens when you put stuff in places where it doesn't belong. I'm sure you've learned a lesson here, first study, learn, investigate before trying out stuff.

Kind regards,

Eric
i fixed that with some help.thanks for suggestion.
I did that by booting in single user mode and using nano to edit the /etc/passwd file. It worked fine.
 
  


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
Login Issue smartgupta Solaris / OpenSolaris 2 10-03-2008 05:16 AM
Login issue. Can't login as root sqldbg Linux - Newbie 6 07-17-2007 03:32 AM
A little login issue help nostracosa Linux - General 1 08-14-2005 03:02 PM
KDE 3.0 Login issue LevesqueOnline Linux - General 2 08-22-2004 10:42 PM
Login Issue dvong3 Solaris / OpenSolaris 1 06-25-2003 10:21 AM

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

All times are GMT -5. The time now is 10:06 PM.

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