LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-29-2009, 11:39 AM   #1
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Rep: Reputation: 15
Root Account Disabled (not smart) Can not root LOGIN


Hello,
I mistakenly disabled the root account in kuser and now can not log in as root.
I did this when I repeatedly received an error when trying to log in as su saying that 'could not connect to x'.

How can I regain login access with my root password? or have I finally made the BIG error?
Mitchell
 
Old 06-29-2009, 12:05 PM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,553

Rep: Reputation: 424Reputation: 424Reputation: 424Reputation: 424Reputation: 424
you can try to use Slackware CD 1 to boot the system and change the entries in /etc/passwd after you mounted the / (root) partition and chroot to it.
 
Old 06-29-2009, 12:19 PM   #3
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Root Account Disabled; Can not root LOGIN

Hello willysr,
I installed slackware 12.2 from iso.
Could you please advise step by step how to do the boot and mounting and the change of status on the root account.
I am not clear on if I am to unlock the password or to create a new root user account.
Thank you.
Mitchell
 
Old 06-29-2009, 12:47 PM   #4
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
First try something simple. Log in as normal user, then start Kuser. You'll have to type root's password. If you are lucky and can start Kuser, then clear the 'Account disabled' check box in the root account.

If you are using GRUB as a boot loader, you could try booting into run level 1 (single user mode). Manually add 'init 1' to the boot options. If you can log in at that point, type 'passwd' to change the root password.

If you are using Lilo then proceed with Willy's solution. When you boot with the installation CD/DVD, don't run setup. Just log in. Then type:

mkdir /hd
mount /dev/hda(x) /hd [You have to know the partition number in place of (x)]

With the installation CD/DVD you have to use vi as a text editor, so be sure to know the basics of vi (:w, :q, insert, Esc).

After mounting the root partition, type:

vi /hd/etc/passwd

Somewhere in /etc/passwd, usually as the very first line, you should see something like this:

root:x:0:0::/root:/bin/bash

Notice the colons, which is why you have to understand the colon syntax with vi. You have to be in text insert mode before typing the colons, otherwise vi interprets the colon as a command.

Also notice that no password is present in /etc/passwd. That is because the password is stored in /etc/shadow. But you need an entry in /etc/passwd to enable the root account. Restoring that entry might be all you need.

If you need to edit /etc/shadow, here is a nice introduction to that file: Understanding /etc/shadow file . You might need to delete the encrypted password before trying to run the passwd command.

Yes, there is a passwd command as well as a passwd text file in /etc.
 
Old 06-29-2009, 02:29 PM   #5
gegechris99
Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 14.1 32bit
Posts: 723
Blog Entries: 3

Rep: Reputation: 77
Quote:
Originally Posted by mitchellray View Post
I installed slackware 12.2 from iso.
If you do not have Slackware CD1, then boot with any GNU/linux LiveCD and mount the Slackware "/" partition. After that, just follow Woodsman's instructions.
 
Old 06-29-2009, 06:30 PM   #6
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Root Account Disabled; Can not root LOGIN

Thank you Woodsman and gegechris99.
I am using lilo for Slackware 12.2 and also chainloading Fedora10.
This is going to require a lot of new learning.
I will begin with the reading and update my progress on this thread.

I can not log in to the KUser application. However, interestingly, I can open it as a normal user after running a 'find file'. However, when I try to 'ok' the change of account status (for any account, including root), I receive the error messages - "cannot open file /etc/passwd.bak for writing" and "Can't create back up file for /etc/passwd".

Are there any pitfalls (beyond what I have already done) that I should beware of so that I do not have to re-install the entire Slackware again?
Mitchell
 
Old 06-29-2009, 07:08 PM   #7
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
Quote:
I receive the error messages - "cannot open file /etc/passwd.bak for writing" and "Can't create back up file for /etc/passwd".
Those are interesting messages. As normal user, can you see the files /etc/passwd and /etc/passwd.bak? What are the permissions on the files? They should be 644 (rw-r--r--) or at least 600 (rw-------).

Then again, perhaps the messages are related only to the fact that you are trying to modify those files as a normal user, who doesn't have permissions to modify those files.

Quote:
Are there any pitfalls (beyond what I have already done) that I should beware of so that I do not have to re-install the entire Slackware again?
Measure twice, cut once.
 
Old 06-29-2009, 08:13 PM   #8
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
This should be quite easy to fix. Follow Woodsman's instructions to boot with the install disk and mount the Slackware parition. Then edit the /hd/etc/shadow file and look for the entry starting "root:!" it should have the exclamation mark here to mark logins as disabled. Just delete the exclamation and save the file then root should be able to login when you reboot your Slackware.
 
Old 06-29-2009, 11:05 PM   #9
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Root Account Disabled; Can not root LOGIN

Hello Woodsman,
I am able to read /etc/passwd, but not /etc/passwd.bak nor /etc/shadow.
In /etc/passwd I have 'root:x:0:0::/root:/bin/bash'.
It looks like what you posted above.

Thank you to all for taking time out to assist me.
I will try to follow your directions.
I have only gone through the Slackware install process once and am not confident about the directions regarding 'mounting' and then entering the /etc/passwd file to make changes.
Once I begin the process, in case of error, I will be left without any means of re-contacting this board (short of starting from scratch) -for further assistance.
Mitchell
 
Old 06-29-2009, 11:44 PM   #10
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
Quote:
It looks like what you posted above.
Then the account is not deleted. Sounds like the problem probably is the password being disabled. Follow bgeddy's solution just above.

Do know that when you delete the exclamations mark (there might be two), the root account then will have no password when you boot into Slackware. After logging in as root, run the passwd command to set a new password.
 
Old 06-30-2009, 07:06 AM   #11
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
I have only gone through the Slackware install process once and am not confident about the directions regarding 'mounting' and then entering the /etc/passwd file to make changes.
Well you should learn about mounting things as it not hard and a basic function of Linux systems. I'll give a step by step automated way of doing this - I really can't make this any easier !

1) Boot to the Slackware install disk.

You have to know the partition number in place of (x) for this next step - also the partition may be called sd(x) where (x) is the partition number. If you are unsure of partition names or numbers run "fdisk -l" to show them. Next we mount the Slackware partition on the hard disk to a directory "/hd" in the install directory.

2) Run this:
Code:
mkdir /hd
mount /dev/hda(x) /hd
3) Run this :
Code:
sed -i 's/root\:\!/root\:/' /hd/etc/shadow
4) Reboot to Slackware. Login as root.

Here you are using a utility "sed" to search and replace the disabled root login part of the file with a "login enabled" setting.
 
Old 06-30-2009, 12:39 PM   #12
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Original Poster
Rep: Reputation: 15
Root Account Disabled; Can not root LOGIN - RESOLVED

Hello,
Thank you for the rescue Woodsman, bgeddy, willysr and gegechris99.

I booted with the Slackware12.2 iso from dvd.
I logged in as root.
I did the
mkdir /hd
mount /dev/hda(x) /hd
vi /hd/etc/shadow
I removed the '!!' after the root in the entry.
I 'esc' ':wq'.
I rebooted normally and the system entered run level 4 to login.
I logged in as root with my original password and it succeeded. I did not have to do a new password setup.

I opened KUser to find that the root account 'Account disabled' toggle is now in the off position. The account is enabled.

With community help, this os, Slackware12.2, has been running without need of reloading for longer than any other os I have used.
I am very happy that it has been preserved again.
Thanks.
Mitchell

Last edited by mitchellray; 06-30-2009 at 12:41 PM.
 
Old 06-30-2009, 12:52 PM   #13
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
Quote:
Thanks.
As younger folks today would say: Woot!

As us older folks might say: Far out! Out of sight! Groovy! Nifty!
 
  


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
URGENT (server down) : All account disabled ! (and also root) jmcollin92 Mandriva 2 01-10-2006 03:57 PM
Auto-login (root account) sammykrupa Linux - Newbie 3 07-30-2005 11:27 PM
root account cann't login ringerxyz Linux - Newbie 7 02-02-2005 06:53 PM
Unable to login using non-root account saxophobe Linux - Security 4 06-28-2004 08:58 AM
can't login into root account eye Red Hat 5 11-21-2003 08:30 PM


All times are GMT -5. The time now is 11:44 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration