LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 10-04-2013, 02:33 PM   #1
manoj_hanse
Member
 
Registered: Mar 2008
Posts: 48

Rep: Reputation: 1
cannot login to system


Hi everyone,

I have just encountered a big problem on my system.

description: I was logged into my system and i used this command:

# usermod -s /sbin/nologin root

the command got executed properly.

now when i logged out and tried to log in as normal user, i could. But when i rebooted the system.....the problem started.

I got this message

Please provide root password for maintenance:
(or press Ctrl+D to continue)

when i entered the root password... the machine rebooted.

so i did the same process again n this time i pressed Ctrl+D. the system rebooted again.

i tried to boot in single mode but still same.

i tried to use rescue disk.

in an option when it says that it will load sysimage in /mnt/sysimage ...........continue or skip or advanced when i selected continue.....i got an unformatted output...with lines distorted....n @ bottom with message: press ctrl+alt+del ot ctrl+C to restart.

i tried this 2-3 times. no use.

in rescue mode when i selected skip in last option, where it ask to load the sysimage, i got a shell prompt:

i tried fcsk but it did not work since there was no /etc/fstab

i tried to edit /etc/passwd but it was readonly

i just cannot use my system. please help.

Thanks.
 
Old 10-04-2013, 04:12 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by manoj_hanse View Post
Hi everyone,
I have just encountered a big problem on my system. description: I was logged into my system and i used this command:

# usermod -s /sbin/nologin root

the command got executed properly. now when i logged out and tried to log in as normal user, i could. But when i rebooted the system.....the problem started.
Why, exactly, would you even CONSIDER doing this?? Did you not know what it was going to do? If not, then why on EARTH would you do it??
Quote:
I got this message

Please provide root password for maintenance:
(or press Ctrl+D to continue)

when i entered the root password... the machine rebooted.

so i did the same process again n this time i pressed Ctrl+D. the system rebooted again. i tried to boot in single mode but still same. i tried to use rescue disk. in an option when it says that it will load sysimage in /mnt/sysimage ...........continue or skip or advanced when i selected continue.....i got an unformatted output...with lines distorted....n @ bottom with message: press ctrl+alt+del ot ctrl+C to restart.

i tried this 2-3 times. no use.
Doing the same thing over and over will not give you different results.
Quote:
in rescue mode when i selected skip in last option, where it ask to load the sysimage, i got a shell prompt: i tried fcsk but it did not work since there was no /etc/fstab i tried to edit /etc/passwd but it was readonly i just cannot use my system. please help.
The "/etc/passwd" file you're trying to edit is likely on the CD/DVD you booted from. You first need to manually mount your hard drive after you get to the prompt, with a command similar to "mount /dev/sdaX /media". Replace the "X" with whatever device number contains your root partition. Then, type in "cd /media/etc" (to go onto your hard drive root partition), then edit the passwd file there with "vi passwd". Change the "nologin" to be "/bin/bash", save the file and reboot.
 
1 members found this post helpful.
Old 10-05-2013, 01:19 AM   #3
manoj_hanse
Member
 
Registered: Mar 2008
Posts: 48

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TB0ne View Post
Why, exactly, would you even CONSIDER doing this?? Did you not know what it was going to do? If not, then why on EARTH would you do it??

Doing the same thing over and over will not give you different results.

The "/etc/passwd" file you're trying to edit is likely on the CD/DVD you booted from. You first need to manually mount your hard drive after you get to the prompt, with a command similar to "mount /dev/sdaX /media". Replace the "X" with whatever device number contains your root partition. Then, type in "cd /media/etc" (to go onto your hard drive root partition), then edit the passwd file there with "vi passwd". Change the "nologin" to be "/bin/bash", save the file and reboot.
Thanks Tbone for your suggestion.
The only problem here is that I cannot login as root. When I open the passwd file without mounting the file system through shell promt I see this in the first line: root:x:/root:/sbin/nologin for root.
Also the lines below like etc,bin has /sbin/nologin.

Actually I am in learning phase. I recently knew about this nologin, n I thought if I disable root login I cannot login as root but still use su -.but I was wrong :-(. I not only cannot login as root but as any other user.

As you said I will try to mount my file system in rescue mode.
if it's successful will let you know.

Thanks.

Last edited by manoj_hanse; 10-05-2013 at 01:21 AM.
 
Old 10-05-2013, 06:35 PM   #4
manoj_hanse
Member
 
Registered: Mar 2008
Posts: 48

Original Poster
Rep: Reputation: 1
Here is what i did to solve the issue:

1. the rescue mode was useless since sysimage was not able to be mounted.
2. so i did : attached init=/bin/bash to end of the line for kernel boot parameter.
3. used command: (at bash prompt): mount -o remount,rw /
4. changed from /sbin/nologin to /bin/bash for root in /etc/passwd file.
5. ran this command : fsck -y

Problem solved. rebooted the system....and i was able to login as usual.

cheers.
 
  


Reply

Tags
centos6, fedora18, rhel6



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 setup system Login banner and Login message 06-03-05 Linux - Newbie 13 07-24-2020 02:05 PM
[SOLVED] System going down.... unable to login kaz2100 Linux - Software 4 07-07-2013 06:27 AM
No login on system JSLayton Linux - General 2 04-07-2006 03:49 PM
login to my system. bruse Linux - Networking 3 02-28-2006 08:30 AM
Login from a differnet system carnold Linux - Networking 0 05-10-2005 07:40 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 07:21 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
Open Source Consulting | Domain Registration