LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-09-2018, 01:52 PM   #1
nix84
Member
 
Registered: Apr 2014
Posts: 276

Rep: Reputation: Disabled
Steps to regain access


Having forgotten my password I need to get access.
I tried the following set of instructions without success.
Can someone tell me where the instructions are not working and why and
how to fix?
1. Power on the PC
2. Boot the Installation CD.
3. Press: Enter-Key when asked about keymap
4. Login as: root
5. Now you are superuser!
TO DO IT:
6. If lacking which partition on which root resides, type fdisk -l
and check what is on each partition.
Presuming it is on /dev/sda2 for arguement sake.
7. mkdir test <OK>
8. mount /dev/sda2 test # Mount the root partition to a directory
???Why What purpose? [pwd showed test dir is on /, i.e. root]
9. chroot test # Change root directory to test <Doesn't work>
???why not working?? cuz of #8??
10. vi /etc/shadow # <?OK>
11. Note the root:<encryption number>:<ID>:0:::::
12. Delete ONLY the encryption number or replace it with: "" or blank or *
?Tried all, unless ? above a fixed this is not working
13. :wq Saves and closes the shadow file.
14.?umount test #?? Seems to be working but unsure
15. Take the LiveCD from the DVD/CD player
16. Reboot system.
17. Enter the slackware login as root with blank password also tried "", "*"
18. Change the password(s) with passwd
19. finish ^^
17 and on didn't work obviously, THANX appreciated! My notes are with "?".

Last edited by nix84; 02-09-2018 at 01:54 PM.
 
Old 02-09-2018, 01:59 PM   #2
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
No need to mess with the installation CD. Believe or not, usually is enough to append on boot, to lilo entry command line:
Code:
Linux init=/bin/bash
(note that I used "Linux" as boot entry)

When the boot process finalize, you are directly logged in as root and you can reset your password or even mess with the system as you wish. BUT, before that, you should execute:
Code:
mount -n -o remount,rw /
I know, I know, Linux is super-secure... BUT that's unless the offender has physical access to computer. In this case, only the system encryption can save your ass.

Last edited by Darth Vader; 02-09-2018 at 02:09 PM.
 
1 members found this post helpful.
Old 02-09-2018, 03:27 PM   #3
nix84
Member
 
Registered: Apr 2014
Posts: 276

Original Poster
Rep: Reputation: Disabled
Not sure where the "Linux" should be entered?? Is there a "boot" prompt somewhere I dont recall. Probably cuz I don't have it handy to check right now.
What is the mount command, what does it do and when?
Would prefer to follow my notes if I can get them corrected, but thanks anyway will check later.
 
Old 02-09-2018, 05:32 PM   #4
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
Originally Posted by nix84 View Post
6. If lacking which partition on which root resides, type fdisk -l
and check what is on each partition.
Presuming it is on /dev/sda2 for arguement sake.
7. mkdir test <OK>
8. mount /dev/sda2 test # Mount the root partition to a directory
???Why What purpose? [pwd showed test dir is on /, i.e. root]
9. chroot test # Change root directory to test <Doesn't work>
???why not working?? cuz of #8??
10. vi /etc/shadow # <?OK>
If you mounted /dev/sda2 successfully on /test as read/write then you should be able to change your directory to /test/etc the then edit password (or shadow).

Try editing /test/etc/password and just remove the 'x' in the second field. I haven't done this for decades but I believe that should work. Once this is done I don't believe any edit is necessary for shadow.

No need for chroot.
 
1 members found this post helpful.
Old 02-12-2018, 11:53 PM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by nix84 View Post
Not sure where the "Linux" should be entered?? Is there a "boot" prompt somewhere I dont recall. Probably cuz I don't have it handy to check right now.
This is done during the boot process... but the process depends on your bootloader. The default for Slackware is lilo, which will present you a screen to select your system to load, and at that point, I believe you can press *TAB* to allow you to enter your own startup command. Or you can edit your "appends" line in your bootloader's config file, which will add that for you automatically. Since you can't boot your computer now, you can use a Slackware install "disk" to boot your system and make any changes you need.

But to go to your original post, why didn't the chroot work? What errors did you get? If you did indeed mount your root partition, and that partition contained the required files, it should've been a nonevent to chroot. So, since it didn't work, I'm curious what your error was. That could give us the info to give you an idea on how to solve this. Your steps seem to be right. You should be able to boot the installer, mount the root partition, chroot the root partition, then run passwd for the root user (which would be the default user). Then reboot the system and you should have root access with the new password.
 
Old 02-13-2018, 04:58 AM   #6
koloth
Member
 
Registered: Jun 2004
Location: Athens, Greece
Distribution: Slack@Home - RHEL@Work
Posts: 150

Rep: Reputation: 29
Let me try to clarify what the process you try to follow does:

Steps 1-5: Booting the system using the boot CD gives you a prompt - keep in mind the the / directory you login resides at is not your hard disk's one but the one created in memory by the boot CD. As a result altering any file would have absolutely to impact to your installed system. What you need to do is mount your disk and change YOUR files.

Steps 6-8: Mount your root partition as the test dir. now you can see and change your files. Keep in mind that your files reside in /test. for example your passwd file is :
/test/etc/passwd.

At this point my advice is to break with that process and do the following (I'm reusing where necessary) :
Quote:
vi /test/etc/shadow
Note the root:<encryption number>:<ID>:0:::::
Delete ONLY the encryption number or replace it with: "" or blank or *
:wq Saves and closes the shadow file.
Quote:
umount test
Take the LiveCD from the DVD/CD player
Reboot system.
Enter the slackware login as root with blank password also tried "", "*"
Change the password(s) with passwd
finish

Last edited by koloth; 02-13-2018 at 05:04 AM.
 
  


Reply



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
On RHEL7 steps to restrict direct login to postgres but get elevated access to it with my account. srao01 Linux - Security 1 01-12-2018 01:14 PM
LXer: How to create FTP user with specific directory access in 7 easy steps LXer Syndicated Linux News 0 02-22-2017 07:12 PM
how do i regain root access on ubuntu? tongsak77 Linux - Newbie 6 12-19-2011 12:03 PM
LXer: Shuttleworth steps down as Ubuntu 10.04 alpha steps up LXer Syndicated Linux News 0 12-18-2009 09:50 AM
Steps I need to take to get my laptop internet access via a wireless card? {-_-} SUSE / openSUSE 2 11-18-2004 06:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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