I like to work in public on my laptop, but I also like to use sudo without a password. Based on what I know now, I would use the
NOPASSWD option in my
sudoers file, but of course anyone could use sudo as they wish.
One important thought that comes to my mind is that locking programs exist. However, I would prefer using a flash drive (and using it just for sudo) because (1) it is faster, (2) easier than entering my password, and (3) I am not concerned with people accessing my content nor doing nefarious things: the laptop would be in public around other people, and the only intellectual property on my laptop is a very basic Angular project.
Additionally, myself and others may wish to prevent misuse of sudo on a computer not running an X or Wayland environment. My current work requires a modern web browser, but if I ever have the chance to not use X and just use a multiplexer, I do that -- my laptop is a bit old and slow.
What I would like to do is put a keyfile on a flash drive, and simply plug in the flash drive when I am at the laptop, and take it out when I step away from it.
So here are my three questions derived from this problem:
- Is this possible with sudo as is?
- If not, would I be able to write a program that lets me do this?
- If so, what language might be the best to write this program?
(4. [Perhaps an extraneous question] Could this package be separate or would it need to be a fork of sudo?)
If it is relevant, my setup is Arch Linux with bspwm, no desktop environment. Most of my work is web development in urxvt / vim and checking it with Chrome.