Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a Linux server at home, and I did just have my own username (javawag) with a www folder inside it for my website. However, I've since added a subdomain for my friend, who now has his own home folder, username, and Apache virtual site (~max/www). My problem now is that my home folder, other than containing my www folder, contains some sensitive data in other folders, which I don't want him to be able to see. How can I change the permissions of home folders so that only that user and root can view/edit, and all other users don't even have read access? The catch here is that the www folder is the server root for Apache, so the user www-data needs read access to the files still!

Thanks,

  • Javawag
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

You could just change the permissions of your other (sensitive) subdirs with chmod 700 ~/sensitivedir.

share|improve this answer
    
that's actually a really clever idea! my backup is an OS X "bundle" in my home directory, but that means it's just a subdirectory that OS X treats as a file... Linux, treating it as a directory, will allow for those permissions. Couple of quick questions with this though - is there a way to set it such that the default for new directories inside my home directory is permission 700? and also, if a user has read permission to a symlink to the directory, can they still read it even if the permissions for the directory itself don't allow it? (may take several reads to understand that :P) –  Javawag Apr 24 '11 at 17:11
    
You can set your umask in your login scripts to 057 (octal). But that affects everything, not just directories. Symlinks don't effect permissions, so no. –  Keith Apr 24 '11 at 17:19
    
You could also do this: chmod -R go-rwx ~/sensitivedir –  Xenoactive Apr 27 '11 at 23:13
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.