9

I did some authentication mounting where I added code like timestamp_timeout on sudoer.

This setting will effect every mounting, where you must enter the user password. After entering the password correctly, an indicator is shown, with an option to "Drop all elevated privileges".

How do I drop elevated privileges using the terminal (CLI)?

3
  • Favorited because I'm curious now. Searching didn't turn up anything. May 3, 2011 at 4:42
  • I don't think it is possible. If you don't want to keep the elevated privileges at all, change the polkit settings from auth_admin_keep to auth_admin.
    – arrange
    May 3, 2011 at 9:33
  • Related StackExchange question regarding sudo su: superuser.com/questions/583784/… Jun 19, 2014 at 16:44

2 Answers 2

5

I'm not quite sure I understood your question right. Could you clarify whether you have access to the console that granted the right to mount?

sudo privileges can be revoked with -k and -K switches.

Quoting man sudo:

-K The -K (sure kill) option is like -k except that it removes the user's timestamp entirely and may not be used in conjunction with a command or other option. This option does not require a password.

-k When used by itself, the -k (kill) option to sudo invalidates the user's timestamp by setting the time on it to the Epoch. The next time sudo is run a password will be required. This option does not require a password and was added to allow a user to revoke sudo permissions from a .logout file.

This won't work with gksudo.

1
exec su -l dmendeleev

Where dmendeleev is the username that you what to drop to.

This will replace the current process with a new shell and set the process uid, gid, euid, and egid to non-root.

2
  • this sounds like you are going a layer deeper, leaving the root shell open, rather than dropping root rights to go back to an unprivileged shell Nov 3, 2019 at 21:55
  • This is pretty useful nowadays in a Docker container: you can drop privileges "for good". May 24, 2020 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .