root password is not working for su in terminal

28,910

Solution 1

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

usermod -U root

to unlock the account.

Solution 2

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.

Solution 3

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.

Share:
28,910

Related videos on Youtube

vkGunasekaran
Author by

vkGunasekaran

Trying to become a lazy developer and i believe in "Fixing the cause, not the symptom", loves bit of old fashioned stuffs... and i grouped my learnings here: web development scripts

Updated on September 18, 2022

Comments

  • vkGunasekaran
    vkGunasekaran over 1 year

    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?

    • Admin
      Admin about 13 years
      @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...
  • UselesssCat
    UselesssCat over 7 years
    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
  • SL5net
    SL5net almost 4 years
    i have the same problem. linux mint just installed. how you fix that ? how you could do chmod u+s /bin/su without this rights?
  • SL5net
    SL5net almost 4 years
    how you could do thsis without admin rights?
  • ceving
    ceving almost 4 years
    @SL5net You can't. Locking a account would not make much sense otherwise.
  • SL5net
    SL5net almost 4 years
  • SL5net
    SL5net almost 4 years
    in the next attempt i used ubuntu. and didn't have this problem. the virtualbox extensions were even started automatically from the virtual cd.
  • Salem F
    Salem F over 2 years
    I was facing issue with sudo not with su, sudo were not accepting my password, but when I login as root with su root entering my password accepted it and I issued the command usermod -U root and sudo works now, BTW I had script I run often used sudo but I add it to NOPASSWD list in visudo