Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Locked out from root (su not working)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Prospero
n00b
n00b


Joined: 29 Nov 2003
Posts: 70
Location: The Netherlands

PostPosted: Thu Apr 28, 2005 5:01 pm    Post subject: [Solved] Locked out from root (su not working) Reply with quote

Ok, I have a problem - I've been following the Gentoo Security guide:

http://www.gentoo.org/doc/en/gentoo-security.xml

Up to a certain point (just before firewall install)

And now I have a problem - after logging into my box through SSH, I try this:

Code:

# su
Password:
su: Authentication failure
Sorry.


I tried 15 times, I am 100% sure the password is correct, and before rebooting it worked fine - so I figure I either screwed up something with PAM, or did something else I shouldn't have. Now since I can't login to root (disabled in SSH config), I have no idea how to fix this. I'm not sure if hooking up a monitor and keyboard to the computer will work, since I removed all terminals from SecuryTTY.

Anybody have an idea? I could try booting from LiveCD and mounting the drive from there and then making the changes, but I'm not sure if that'll work.

Any suggestions?


Last edited by Prospero on Thu Apr 28, 2005 8:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
moocha
Watchman
Watchman


Joined: 21 Oct 2003
Posts: 5722

PostPosted: Thu Apr 28, 2005 5:04 pm    Post subject: Re: Locked out from root (su not working, ssh secured) Reply with quote

Prospero wrote:
I could try booting from LiveCD and mounting the drive from there and then making the changes, but I'm not sure if that'll work.
If you've locked yourself out via PAM (i.e. if login refuses to cooperate), something like that is the only way of getting back in in a reasonable amount of time. Basically mount the file systems just like you did when you installed Gentoo, i.e. (adjust node names as fit):
Code:
mount /dev/hda2 /mnt/gentoo (note - adjust hda2 to whichever device holds your root file system)
mount --bind /proc /mnt/gentoo/proc
mount --bind /sys /mnt/gentoo/sys (note - this line only for a 2.6 kernel!)
mount --bind /dev/pts /mnt/gentoo/dev/pts
and chroot in:
Code:
chroot /mnt/gentoo /bin/bash
source /etc/profile
You'll then be logged in having bypassed the login procedure and can make the necessary adjustments (whichever those are - you know what you changed).
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
GBob
Tux's lil' helper
Tux's lil' helper


Joined: 13 Nov 2004
Posts: 110
Location: Portland, Oregon

PostPosted: Thu Apr 28, 2005 5:07 pm    Post subject: Reply with quote

Making changes with the live cd should work, but if su is saying your password is incorrect, your SOL. You could elevate your normal user to the root group I suppose; but then you'd need to give files group write thoughout your system. I'm guessing it's going to be a long hard road, if you don't format and re-install.
_________________
rank[0]-=('n'-'d');
rank[3]-=('b'-'d');

It is better to say nothing and have people think your are an idiot,
Than open your mouth and remove all doubt.
Back to top
View user's profile Send private message
Prospero
n00b
n00b


Joined: 29 Nov 2003
Posts: 70
Location: The Netherlands

PostPosted: Thu Apr 28, 2005 8:20 pm    Post subject: Reply with quote

I managed to regain terminal access, so I can at least log in as root through the virtual console

It turns out I took out the suid bit in su's permissions, so a simple

Code:

chmod +s /bin/su


Solved the problem

Stupid me :oops:
Back to top
View user's profile Send private message
GBob
Tux's lil' helper
Tux's lil' helper


Joined: 13 Nov 2004
Posts: 110
Location: Portland, Oregon

PostPosted: Thu Apr 28, 2005 9:29 pm    Post subject: Reply with quote

Better then the alternative, and by far not the dumbest thing I've seen. Ever have someone remove the r from root? "Bow before me, for I am oot" just doesn't have the same affect.
_________________
rank[0]-=('n'-'d');
rank[3]-=('b'-'d');

It is better to say nothing and have people think your are an idiot,
Than open your mouth and remove all doubt.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum