0

I know the password of gqqtest as I can login via ssh.

> psftp gqqtest@172.25.9.11
Using username "gqqtest".
gqqtest@172.25.9.11's password:
Remote working directory is /home/gqqtest

Now I use another account to login, and once in Ubuntu, I use su to switch to gqqtest.

gqq@172.25.9.11:~$ su - gqqtest
Password:
su: Authentication failure
gqq@172.25.9.11:~$ sudo su - gqqtest
[sudo] password for gqq:
gqqtest@172.25.9.11:~$ exit
logout

Just to verify, I tried sudo su - gqqtest and succeeded.

Why doesn't su allow me to switch to non-root even with correct password?

I searched here and there, eg. Why does su fail with "authentication error"?, they are all dealing with root or empty password.

$ type -a su; stat $(command -v su)
su is /usr/bin/su
su is /bin/su
  File: /usr/bin/su
  Size: 67816           Blocks: 136        IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 4200703     Links: 1
Access: (0754/-rwxr-xr--)  Uid: (    0/    root)   Gid: ( 1123/   wheel)
Access: 2021-02-02 15:53:54.794314648 +0800
Modify: 2020-07-21 15:49:28.000000000 +0800
Change: 2021-02-02 15:53:02.314466458 +0800
 Birth: -
Gqqnbig
  • 689
  • What are the permissions of su? Add the output of type -a su; stat $(command -v su) to the post please. – muru Feb 02 '21 at 08:43

1 Answers1

0

Your su is missing the setuid bit for some reason. Without it, su doesn't have the access need to authenticate and switch to another user. I assume your system is broken in more ways if that's the case, but this particular problem can be solved using:

sudo chmod u+s /usr/bin/su
muru
  • 197,895
  • 55
  • 485
  • 740