3

I run debian and I'm looking to limit a folder to only be accessible by one user. How do I set the permissions up so only that one specific user can enter it, and no other user. The folder I'm talking about is in /home/user1/ and is named protected. How do I allow only user1 to enter this folder, and not other users that have root access? ( Preferably only a password would do, as the user are not really "root" users, they're just standard users with access to all files. )

Thanks!

0

You will need to encrypt your folder using something like TrueCrypt.

See the comment below - encfs is command line based and looks really simple to use. sudo apt-get install encfs and you are ready to go.

  • Just reading Wikipedia and it says TrueCrypt is discontinued - have had a quick scan online and encfs looks like a good and simple alternative. – cherrysoft Sep 22 '14 at 21:54
  • This works very smooth! It's very easy too. The only bad-side is that you have to force unmount the folder. Away from that, not even root can touch your files, as you can't alter the settings without getting the proper mount password. Thanks for the tip! – Sam Sep 22 '14 at 22:11
  • This answer is grossly misleading. Encrypting the file will not protect it against other users with root access. – Gilles Sep 23 '14 at 23:53
  • @Gilles - I appreciate that you are correct in saying passwords can be snooped upon, they could also be weak (regardless of where you encrypt the file), but that was not the question. I think that answers Sams question correctly! – cherrysoft Sep 24 '14 at 17:24
1

You cannot protect a file against other users who have root access.

If you encrypt a file on another machine where you are the only root user and upload it to that shared machine, then the content of the file is safe from the other roots. However, as soon as you decrypt the file on the shared machine, it is no longer confidential. Other roots can snoop on your password and record it, can copy the data as soon as you decrypt it, etc.

If you want to protect the file from other users who do not have root access, then file permissions are sufficient: chmod go= somefile makes the file inaccessible to anyone but its owner. If you make a directory inaccessible to someone, then they can't access files inside that directory either. Encryption is not useful.

Storing an encrypted file on a machine and decrypting it on that same machine is only useful to protect against one specific threat: a leak of the disk contents (either because the disk is stolen, or because a backup is stolen). Encrypting files does not protect against attackers with purely software access.

0

If you want only alter the permissions, you can use the good-old chmod command. Bellow you can see a screen shot of me modifying permissions for bin folder where i keep some scripts and c programs.(It's not /bin, but ~/bin, a folder in my home folder). As you can see, before the permissions were 755 (read write execute for me, and read-execute for others). After that, I have full command for myself and none for others (700).

enter image description here

Some explanations here. Why ls -d -l ? because this will just list the folder with current permissions. If you do ls -l bin, it will list bin's contents.

But, if you need to use password, cherrysoft's answer will do the trick.

Some extra info:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.