9

I have sudo set to show the usual lecture on its first use by a user. Without thinking, I accidentally triggered its display for a new user as I was setting them up, and now it's been shown, they won't get to see it again.

How does sudo know that a user has invoked it once before? I'd like to reset that so that this user will see the message first time they use it. I don't want to set it so that the lecture appears on every invocation - once is enough - I'd just like sudo to forget that it's already been shown once.

Any ideas how I do that?

dopiaza
  • 193
  • 1
  • 4

1 Answers1

8

On Debian, a user's first use of sudo will create a directory under /var/run/sudo/. The directory is named "username", where "username" is the name of the user which ran sudo.

Removing [or renaming] this directory will cause the lecture to be displayed upon next use of sudo, as well as recreate the directory.

For example, the directory for my user account would be /var/run/sudo/jscott.

jscott
  • 24,484
  • 8
  • 79
  • 100
  • Thank you. On my server, I found the directory at /var/lib/sudo, and removing the user's directory from there did indeed do the trick. – dopiaza Nov 22 '11 at 13:44
  • Thanks for this! On Fedora 17, I found the directory at /var/db/sudo – Cameron Sep 06 '13 at 01:51
  • Sounds like Fedora has it right. `/var/run` is a silly place to put that, since the directory can be cleared at system boot (and since it's on a tmpfs on Fedora, is). – Michael Hampton Sep 06 '13 at 02:38
  • On RHEL/CentOS 6 and 7, the directory is at `/var/db/sudo/`, as it is in Fedora. On CentOS 5, it's located in `/var/run/sudo`. – davidjb Jun 01 '16 at 01:53
  • 2
    On my Arch Linux installation, I found the directory `/var/db/sudo/lectured`, which contains empty files with the names of the users that have been lectured. Deleting one of these files will show the lecture again for that user when he or she tries to use sudo the next time. – Rapti Nov 07 '16 at 23:30