-1

On linux, is there something like a key or token which is only accessible to the logged-in user on the current machine to uniquely identify him? So that a file, which has been encrypted with this key or token could only be decrypted on this machine by this user?

I'm specifically looking for a built-in way. A simple workaround would be to generate a key and store it in a directory, which only the current user can access (as suggested in this answer). But I would be interested in avoiding the filehandling part of this solution.

Stephan
  • 650
  • 7
  • 16
  • I don't think such an identifier exists, so generating a key is probably the only solution. Please [edit] your question and add more background information what you want to achieve and how you plan to do the encryption/decryption. There might be existing programs for encrypting/decrypting a file which would do the file handling for you. – Bodo Dec 20 '21 at 19:31
  • 1
    `avoiding the filehandling` the problem is, that you need some persistent data (keep it the same between session/restarts), so I'm not sure you can avoid storing the secrets in the files. Btw - ssh keys are stored the same way in the `~/.ssh` folder (requiring a user password to decrypt). – gusto2 Dec 21 '21 at 14:18

1 Answers1

-1

The environment variable UID is unique to an user and the environment variable is readonly but it is accessible to everyone

It is easier and safer to create your own key but Since you want to avoid the file handling part you can use keyrings(Gnome keyring,Kwalllet-KDE etc...) to store the generated key

NOTE: Keyrings are personal password manager like thing for logged-in user.