LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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:08 PM   #1
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Rep: Reputation: 16
unable to login as root!


I am using CentOS. When i try to login as root using login command,i get the following:
Code:
[avi@localhost ~]$ login root
Password: 

Login incorrect
why it is so?? what could be the colution.My password is correct,i provided this while installation and i have tried it more than one time,so i am sure that there is no typing mistake.
 
Old 05-15-2010, 02:11 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,

What looks weird to me is that you seem to already be on a console, logged in, so why would you login again on the same console? Are you logged in and wanting to su to root to perform an installation or so?

Kind regards,

Eric
 
Old 05-15-2010, 02:12 PM   #3
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 67
Instead of:
Code:
login root
Use:
Code:
su - root
When you are done issuing root commands be sure to:
Code:
su - <yourusername>
to switch back to normal user so you don't do anything you regret as root.

The su command is switch user.
 
Old 05-15-2010, 02:28 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 brucehinrichs View Post
Instead of:
Code:
login root
Use:
Code:
su - root
When you are done issuing root commands be sure to:
Code:
su - <yourusername>
to switch back to normal user so you don't do anything you regret as root.

The su command is switch user.
Code:
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:
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:32 PM   #5
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,

Have you tried the command suggested by brucehinrichs?
Code:
su -
or if you have sudo enabled for your user you can try:
Code:
sudo vi /etc/passwd
and providing your user password. Then you can change the line again to how it's supposed to be.

Next for resetting the root password you can use sudo again.

Kind regards,

Eric
 
Old 05-15-2010, 02:33 PM   #6
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by avee137 View Post
Code:
 
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!
who did that ? Be in as root in single user mode while system boots and change ..
 
Old 05-15-2010, 02:39 PM   #7
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,

Have you tried the command suggested by brucehinrichs?
Code:
su -
or if you have sudo enabled for your user you can try:
Code:
sudo vi /etc/passwd
and providing your user password. Then you can change the line again to how it's supposed to be.

Next for resetting the root password you can use sudo again.

Kind regards,

Eric
Code:
[avi@localhost ~]$ sudo vi /etc/passwd
Password: 
avi is not in the sudoers file.  This incident will be reported.
is what i get!
 
Old 05-15-2010, 02:47 PM   #8
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 divyashree View Post
who did that ? Be in as root in single user mode while system boots and change ..

Please elaborate how to do that.
 
Old 05-15-2010, 03:29 PM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,827

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
put the cencOS 5.4 install cd in and use the rescue mode ( fallow the on-screen instructions )

also google
" single user mode"
 
Old 05-15-2010, 03:32 PM   #10
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,

Bad luck, you're not in the sudoers list. So you only got the option to boot in single user mode or from a CD as indicated by Miss Divyashree and John VV.

Kind regards,

Eric
 
Old 05-15-2010, 03:38 PM   #11
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by avee137 View Post
Please elaborate how to do that.
(1) At grub boot screen (after restart)

(2) Select the kernel

(3) Press the e key to edit the entry

(4) Select second line (the line starting with the word kernel)

(5) Press the e key to edit kernel entry so that you can append single user mode

(6) Append the letter S (or word Single) to the end of the (kernel) line

(7) Press ENTER key

(8) Now press the b key to boot the Linux kernel into single user mode

(9) Now access the /etc/passwd file and remove that bad entry
 
Old 05-15-2010, 03:44 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 divyashree View Post
(1) At grub boot screen (after restart)

(2) Select the kernel

(3) Press the e key to edit the entry

(4) Select second line (the line starting with the word kernel)

(5) Press the e key to edit kernel entry so that you can append single user mode

(6) Append the letter S (or word Single) to the end of the (kernel) line

(7) Press ENTER key

(8) Now press the b key to boot the Linux kernel into single user mode

(9) Now access the /etc/passwd file and remove that bad entry
thanks man...i googled dat..it worked...working fine now!
 
Old 05-15-2010, 03:47 PM   #13
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,

Glad you got it solved. Please mark your thread as such using the Thread tools. Have fun with Linux. Great step by step guide by divyashree!

Kind regards,

Eric
 
  


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
unable to login as user; can login as root. rksanders Debian 24 02-09-2011 09:01 AM
root unable to login??? ajeetraina Linux - General 8 11-27-2007 03:39 AM
Unable to login as 'root' ajeetraina Linux - Desktop 4 11-23-2007 04:04 AM
Root Unable To Login manoj.u.kumar Red Hat 3 07-03-2007 05:32 AM
Unable to login as root. Rax42 Linux - Newbie 4 02-05-2007 09:57 AM


All times are GMT -5. The time now is 07:51 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