Different actions on different passwords?

Bill Oliver vendor at billoblog.com
Mon Dec 30 23:25:51 UTC 2013

I guess this is more of a general linux question than a fedora one, but since I use fedora...

A friend of mine (a Windows afficionado, but not experienced with linux), and I were talking about recent examples where folk were required by the court to provide the password for their laptop.  That lead to a beer-induced thought problem:

In linux, is it possible to dictate two different actions upon login with different passwords?  For instance, given an encrypted file dat.txt, could one have a login such that:

login: billo
Password: Password1
Action: bring up shell

login: billo
Password: Password2
Action: delete dat.txt, then bring up shell

Assume some arbitrary level of encryption.  I guess with just file encryption  (e.g. dat.gpg) it's not a loging problem.  So assume there's encryption of the home directory or of the /home partition.

I couldn't think of any.  There are a thousand ways to delete a file on login, of course, but I couldn't think of a way to accept two different passwords.  The closest I could come up with was to have two different accounts with the same userid but different usernames in /etc/password, with a different initial startup for each. But that would provide two different usernames...


More information about the users mailing list