View previous topic :: View next topic |
Author |
Message |
jaghetertoffe Tux's lil' helper
Joined: 06 Mar 2004 Posts: 92
|
Posted: Sat Mar 06, 2004 9:30 am Post subject: root password |
|
|
I installed Gentoo recently and everything's been fine until now.
Suddenly the box didn't accept my root password!
I am absolutely sure I haven't forgotten it. At the time I discovered it, I was already su in another terminal, so I did a passwd and changed the password. I couldn't su using this new password either.
So I booted the box using the Gentoo CD-ROM, mounted my HDD, edited the /etc/shadow file. More specifically I replaced the ecrypted password for root with that of my ordinary user, which I could log in with.
Saved and rebooted. Still could't su. And yes, /etc/shadow was updated.
What to do?
-toffe |
|
Back to top |
|
|
slonocode Apprentice
Joined: 03 Jun 2002 Posts: 273
|
Posted: Sat Mar 06, 2004 9:35 am Post subject: |
|
|
First thing that came to mind...did you check to see that the user is still in the wheel group? |
|
Back to top |
|
|
jaghetertoffe Tux's lil' helper
Joined: 06 Mar 2004 Posts: 92
|
Posted: Sat Mar 06, 2004 9:39 am Post subject: |
|
|
I will check as soon as I can (not at home right now).
To prove that I am a total n00b:
Which user: root or my ordinary user (toffe)
If this is any help: I may have destroyed some config file(s) in /etc
-toffe |
|
Back to top |
|
|
superjaded l33t
Joined: 05 Jul 2002 Posts: 802
|
Posted: Sat Mar 06, 2004 9:57 am Post subject: |
|
|
Er, well, assuming you didn't destroy any of /etc/group, /etc/passwd or /etc/pam.d, you should be OK as far as being able to su.
And you'll need to check if toffe is added to wheel; users aren't added to the wheel group unless you explicitly tell useradd to add the user to that group, or add in the user manually.
I don't know an easy program to add a user to a group, but it should be fairly easy -- open /etc/group in your favorite editor and look for a line that starts off with "wheel:" and add toffe to the end of the line, ex:
Code: | wheel:x:10:root,chris,tronik,toffe |
And then re-login and you should be able to su, assuming that's all that's wrong.
to verify you're in wheel, you can use the "groups," program, ex:
Code: | $ groups
wheel audio video games users portage dos ftpgroup |
Of course, don't worry if you aren't in all these groups, but you should see atleast wheel in the output. |
|
Back to top |
|
|
slonocode Apprentice
Joined: 03 Jun 2002 Posts: 273
|
Posted: Sat Mar 06, 2004 1:27 pm Post subject: |
|
|
Superjaded covered what to look for. Hopefully all that happened was that you replaced /etc/group with a new config file after an emerge which of course would not have your users added to the groups they belonged to before. |
|
Back to top |
|
|
Deebster Tux's lil' helper
Joined: 16 Nov 2003 Posts: 126
|
Posted: Sat Mar 06, 2004 2:26 pm Post subject: |
|
|
jaghetertoffe, in case you haven't gathered, the 'wheel' group specifies which users are allowed to switch user (su) to root.
If you don't feel comfortable editing system files in case you break something*, then while in root do
# groups toffe
// this will give you a list of the groups user toffe belongs to
// likely candidates are:
// audio games users
then do
# usermod -G $group_list toffe
where $group_list is the list of groups, seperated by commas and no spaces.
You don't need to include the 'users' group in this list, so add wheel to the others.
Example:
# groups deebster
audio games apache users
# usermod -G audio,games,apache,wheel deebster
# groups deebster
wheel audio games apache users
deebster can now su, although if he runs
$ groups
he won't see wheel on there until he logs in again.
* I was very glad vim keeps backups the other day when I clobbered my group file breaking my system. Boot into single user and # mv /etc/group~ /etc/group and all was well |
|
Back to top |
|
|
jaghetertoffe Tux's lil' helper
Joined: 06 Mar 2004 Posts: 92
|
Posted: Sat Mar 06, 2004 6:41 pm Post subject: |
|
|
You were right:
I did an emerge system which changed /etc/group
Using the boot CD I added toffe to wheel in group, rebooted and verified that it still was in /etc/group. But I still can't su. In fact, I can't log in as root directly either.
So I changed the root password using the CD again, but still no success.
What am I missing? |
|
Back to top |
|
|
Deebster Tux's lil' helper
Joined: 16 Nov 2003 Posts: 126
|
Posted: Sun Mar 07, 2004 2:16 pm Post subject: |
|
|
When you say you changed the password using the boot CD, what exactly is it you're doing. Could be that you're only changing the password for the virtual CD-run system.
Go into the CD again, and edit /mnt/gentoo/etc/shadow and remove the password hash so that the (first) line is something like
root::12445:0:::::
This should allow you to boot into root (on your install system) with no password and go from there. |
|
Back to top |
|
|
larand54 l33t
Joined: 20 Feb 2004 Posts: 695 Location: Sweden
|
Posted: Sun Mar 07, 2004 6:02 pm Post subject: |
|
|
I have the same problem. I was struggling with KDE to make it accept me to set the correct keyboard layout using the KDE:s controlpanel.
Suddenly I couldn't su. I logged out and tried to login as root but no.
I restarted with the CD and changed the shadow and shadow- files as you recommended. But the number wasn't 12445 it was 12475. Is that ok?
Also in group, in the wheel entry I had: wheel::10:root,larand. Not wheel:x:10:root,larand. Is that ok? |
|
Back to top |
|
|
larand54 l33t
Joined: 20 Feb 2004 Posts: 695 Location: Sweden
|
Posted: Sun Mar 07, 2004 6:45 pm Post subject: |
|
|
I managed to log in as root again. Phuuuuh!
What happend really? I checked the dates of shadow,passwd groups etc and the dates where for some days ago. I didn't do any emerge I was just fiddling with XF86Config and the application in KDE that enables you to switch between different keyboard layouts. I was mainly in no-su mode but I had to su when I edited XF86Config.
After this I feel realy unsafe with the system. Never happend with any other linux-dist before. And there have been some. |
|
Back to top |
|
|
jaghetertoffe Tux's lil' helper
Joined: 06 Mar 2004 Posts: 92
|
Posted: Sun Mar 07, 2004 8:56 pm Post subject: |
|
|
Deebster, removing the root password completely from the shadow file worked and now everything is fine again =)
Thanks!
I still wonder why I couldn't just copy my encrypted password from user toffe to root in shadow. Is the encryption a function of both password and user name? |
|
Back to top |
|
|
|