Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I only know of two ways to do this,, encryption and chomd and have some questions about those, as well as if there are any other ways.

I want any given user have their data protected from any other user unless an administrator password is given. I would also like anyone, without authentication, to be able to view a Public folder.

Is it possible to encrypt a home folder while still allowing the public folder to be accessed?

If not, is it possible to chomd the home folder so it's contents cannot be read (files) but navigation to the Public folder is still possible?

share|improve this question
    
There is no reason why a public folder needs to be in your home directory. Make another directory somewhere else, like /data, and share it however you like. –  Paul Tomblin Oct 10 '11 at 16:35
add comment

1 Answer

up vote 1 down vote accepted

If you encrypt your home folder, nobody is able to access your public files without decrypting it first. If you want to allow others to read your public files, but disallow access to other files, you need to revoke any permissions for the others and set the permissions mask to avoid newly created files relaxed permissions.

  1. Edit ~/.profile and change #umask 022 to umask 027 (I believe the default is #umask 002 for Oneiric and up, use umask 007 in that case). This will suggest to programs that the read, write and execute permission bits are never set for other users.
  2. Re-login to apply these changes. This is needed to ensure that the next step will succeed for all files.
  3. Remove all of the permission bits for other:

    chmod -R o-rwx ~
    
  4. You've successfully removed read, write and execute permissions for the world. Now, add the execute bit again to the home folder so others can descend into it:

    chmod o+x ~
    
  5. Allow others to read and descend into your Public folder as well:

    chmod o+rx ~/Public
    
  6. Profit!
share|improve this answer
    
Is it possible to set this to happen whenever a new user is created, rather than using user specific directories? –  Lewis Goddard Oct 10 '11 at 17:54
    
You can edit the default umask in /etc/profile. AFAIK you can create the Public folder with default permissions set to 755 in /etc/skel/, but I cannot confirm it yet. –  Lekensteyn Oct 10 '11 at 18:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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