I got a VPS with a user dedicated to store my files.As i am aware of the current situation with the NSA and many other governments, and my VPS is hosted on a doubtful country i would like to ensure my privacy (not that i have any top-secret file, or anything similar).I am thinking of making the home folder of my user a truecrypt file, which would be mounted after a successful user login.Is it possible?And can the SSH login also prompt for the password to mount the file after login and before shell access? Something like: insert user@host password: and then insert home folder password: before shell access.If wrong it would start the working directory somewhere else, like on fs root.Can it be done?
Mount home partition on user login
linux;ssh;authentication;command line;privacy
So, since you seem Ok with the idea, for any searchers:Ecryptfs and its associated PAM facilities do more or less what you want. The filesystem stores an encrypted key which the PAM module locks and unlocks as appropriate. This key is used to read and write files on a fuse filesystem that is mounted on top of the real filesystem over the user's home directory. Anyone else just sees the encrypted key and a bunch of encrypted files with obfuscated names (ie, even if you name your file super secret stuff, without the user's password somebody else only sees x18vb45 or something like that).There's a bit of memory and processor overhead, and someone who can see arbitrary memory locations can get more when the user is logged in, but that's true for an file encryption.