LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   su doesn't accept my password (https://www.linuxquestions.org/questions/linux-general-1/su-doesnt-accept-my-password-242019/)

CGameProgrammer 10-13-2004 02:22 AM

su doesn't accept my password
 
For some reason when I run 'su' and type the root password, it says it's incorrect, but it isn't. This didn't happen all of a sudden; I've never been able to get su to work. What could be causing this? I'm getting tired of constantly having to log out and log back in as the root.

I just tried running "passwd" as my user account, and when it prompted me for my current password, it said it was incorrect too! This is strange. Both passwords have both lowercase and uppercase letters, and some numbers and punctuation marks, if it matters.

MartinN 10-13-2004 03:21 AM

Do you set a different keyboard mapping when you log in? Try typing the password in a terminal window or somewhere else where you can see it.

Martin

CGameProgrammer 10-13-2004 05:14 AM

No, it's just the regular U.S. English layout. It would be nice if I could see what password it thought I was entering... that stuff isn't logged anywhere, by any chance, is it?

MartinN 10-13-2004 05:27 AM

I really don't think that is logged anywhere. It's bad security practice. If you just mis-type the password with one character it would be fairly easy to guess the password (especially if this happens twice with different characters mis-typed). The real password is not stored in unencrypted form anywhere either. The only thing stored is the encrypted password string and when you log in your password is encrypted and compared to the stored encrypted password.

Every failed attempt at su-ing is stored like this (in /var/log/messages)
Code:

Oct 13 12:19:27 charlene su(pam_unix)[20923]: authentication failure; logname= uid=500 euid=0 tty= ruser=martin rhost=  user=root
But still, try to type in the password in a way that you can see it. Try typing the password from the login window too. To see the password, just enter the password in the username field. This way you should be able to see if there is something fishy with your keyboard mappings.

Martin

CGameProgrammer 10-13-2004 05:38 AM

I typed the password regularly; it's definitely registering correctly. And the login window works fine, it's just terminal stuff like su and passwd that do not. Well, that's not quite true -- as root, I can run "passwd" which doesn't ask me for my existing one, just asks me to enter the new one. That works fine. But as a regular user, trying to change my password fails the password check, and trying to su to root also fails.

I just now experimentally set the root password to 'abc', logged in as the user account, and still su fails! It can't possibly think I'm typing anything other than 'abc' and the root password definitely was changed to that, so perhaps the account somehow doesn't have permission to use su? Or something? Of course that doesn't explain why changing its own password doesn't work either.

MartinN 10-13-2004 06:36 AM

:scratch: :scratch: :scratch:

:D *ding*

Is the sticky bit set for su?
Code:

[root@charlene log]# ls -lF /bin/su
-rwsr-xr-x    1 root    root        19132 Aug 29  2002 /bin/su*

The 's' in the permissions is for the sticky bit. This means that the command is run with the privileges from the user owning the command, not the privileges of the user executing the command. Change the settings of the sticky bit with chmod.

Martin

case1984 10-13-2004 06:41 AM

try a different shell
 
I have no idea why this wouldn't work, but I'm sure it must be a pain.
I have a suggestion:
In order to rule out the shell itself as the cause of the problem, try using a different one. Most distros come with a number of shells installed. Oh, and make sure you are typing "su_-" (underscore is a space). I used to get all sorts of strange errors when I would leave out the -. You could also try typing "su - root". If that's not it, we are going to have to start looking at etc/pam.d to make sure your password files are correct and shadow passwords are set up correctly.

Michael

CGameProgrammer 10-13-2004 12:07 PM

Quote:

Originally posted by MartinN
Is the sticky bit set for su?
Code:

[root@charlene log]# ls -lF /bin/su
-rwsr-xr-x    1 root    root        19132 Aug 29  2002 /bin/su*

The 's' in the permissions is for the sticky bit. This means that the command is run with the privileges from the user owning the command, not the privileges of the user executing the command. Change the settings of the sticky bit with chmod.
That fixed it! Thanks a lot. Everything works fine now.


All times are GMT -5. The time now is 02:04 AM.