root password is not working for su in terminal

4

I'm using rhel 5, when i'm working in terminal first i typed su command and by mistake i entered copy command and some other characters, after realising i've made a mistake then i came out and continued with copy command in terminal.

after some time when i tried to login by using su and with password it says "incorrect password".

So i logged out and entered root login for gui and it works well, but i'm not able to use the same password for su.

can some one get around this issue?

vkGunasekaran

Posted 2011-05-06T08:08:18.863

Reputation: 153

Which files where you copying? Does su has the setuid bit? Are you executing the right su (/bin/su) instead of some other location (~/bin/su, for example)? – None – 2011-05-06T09:33:33.907

@Carlos Campderrós first i tried to login using su, after typing 'su' instead of password i typed copy command ,then realised i mad a mistake and came out of it after that i continued my work. but after some time i again tried to login using su, it says 'incorrect password'. but meanwhile i didn't changed any passwords... – None – 2011-05-06T11:00:07.527

Answers

3

Probably you have locked the root user by too many wrong authentications. Try

usermod -U root

to unlock the account.

ceving

Posted 2011-05-06T08:08:18.863

Reputation: 1 737

3

I had the same problem and none of the above replies helped. In my case, I could login as root, sudo worked, but not su.

It turned out that /bin/su had somehow lost the suid permission.

I corrected that with chmod u+s /bin/su, and then su worked again.

David V.

Posted 2011-05-06T08:08:18.863

Reputation: 811

More than a complete hour trying to find this. I remember that i used chmod in the root folder changing the permission of all folders recursively :P, is a real miracle thats my debian stills working. thanks – UselesssCat – 2017-01-16T17:27:49.267

1

Make sure the user trying to su is in the wheel group.

$ id uid=1000(usr) gid=1000(usr) groups=1000(usr),10(wheel),18(audio),19(cdrom),35(games),442(plugdev),1003(pulse-access)

if you don't see wheel, your su will fail.

Or you can edit the su file in the /etc/pam.d directory and modify it to not require wheel group to be able to escalate your privileges.

gymnodemi

Posted 2011-05-06T08:08:18.863

Reputation: 11