Is there something like one-time sudo

Securitysudo

Is there a way to have a one-time sudo account?

My use-case is the following.

I have an Ubuntu station with no remote ssh allowed to that machine. The machine generally serves as a public-use computer. But sometimes I would like to grant root access to some people (who I know personally) based on e.g. SMS or IM communication. Of course I don't mean giving them full root access, just one restricted to some commands like apt-get or so. In no way do I intend to allow them to write to /etc.

But obviously I don't want to share the root password. And I also don't want those people to have root access forever, nor do I want to delete accounts or change passwords manually.

So I thought about creating a (sufficiently large) amount of root-access accounts and save their passwords to my laptop or phone. In the case I needed to provide root access to someone, I'd just send him the login information for an account that would be deleted when the sudo password-cache timout ends up.

Do you think this is a good approach? And if it is, where and how to setup the deletion script?

Best Answer

I've never seen anything like one time sudo, but you could still get one time sudo by setting up one time passwords. There's an article in Linux Journal, titled: Configuring One-Time Password Authentication with OTPW, that covers the various ways that you can do this. There are 3 packages that they discuss which facilitate this:

I've never used any of these so I can not offer you any guidance or practical experiences in using any of them but the LJ article and the sources I liked look to have everything one would need to get started.

Related Question