-1

I configured sudo. But when i login to a user with sudo, it will prompt me for my password. However if I su to other user it will not ask me for a password. How do i tackle this?

Please see the below log

$ id
uid=228(sudotst) gid=204(L1Group) //Logged in as sudotst user
$
$
$ bash
bash-4.3$
bash-4.3$ sudo su - kshah    //i switch to user kshah and it prompts me for 
                               password which is expected
Password:
$
$ id
uid=216(kshah) gid=203(admin) groups=1(staff)
$
$
$ sudo su - alakde                //Now when I switch to other user why it does not ask me for a password.
$
$ id
uid=210(alakde) gid=1(staff) groups=204(L1Group)
$
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89

1 Answers1

1

sudo caches the password, by default for 5 minutes on Debian, 15 minutes on Ubuntu (these are just examples). If you use sudo, you asked for the password. If you use it again within the configured cache time you are not asked for the password, because it still remembers it. If you wait until the configured time expires between the sudo uses you will be asked for the password again.

Another possibility in your case: You first su to a user that is in the group admin. It is possible that users of the admin group are allowed to use sudo without a password. Hence no password when you switch to the third user. To know that for sure we need to see your /etc/sudoers file.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89