Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm giving my friend a host on my dedicated server. I created a new user for him:

Debian server.

adduser friend

Adding user `friend' ...
Adding new group `friend' (1000) ...
Adding new user `friend' (1000) with group `friend' ...
Creating home directory `/home/friend' ...
Copying files from `/etc/skel' ...

Problem: He can go to my "/var/www/" directory which contains config files with passwords. And he can simply download my site, which I don't want him to do.

What I need: Set permission, so he can only go to his own directory. And not lurk in my folders.

I want him to only be able to go to /var/www/html/site.com

Anyone has any idea on how this can be done?

Thanks, I really appreciate the help I can get.

share|improve this question
add comment

2 Answers

By default, debian uses the www-data user and www-data group for webservers. If you use chgrp to change the group of your site's files and folders to www-data and then chmod to give group read access and revoke "other" access, apache will be able to access your website's files, but your friend will not have access when he logs in (unless you've added him to the www-data group).

If you have PHP or some other scripting language enabled in the server you're going to have to replace it with suphp or suexec so that your friend can't run scripts as the www-data user. Without that he can write a script or CGI that can read your configuration files for him.

share|improve this answer
    
Wouldnt it be better to just remove the new user from those groups ? That way you are not messing about with any services on the box –  Jon Reeves Apr 20 '11 at 16:58
    
DerfK@ Thanks for the fast reply and spelling correction. I've tried a lot of tutorials and most of them are outdated. Do you have any updated tutorials? Thanks! –  Muazam Apr 20 '11 at 18:26
add comment

You could chroot him in that folder.

See here...

share|improve this answer
    
Alex@ I tried to follow it, but I don't have the "ssh-dummy-shell" or any of the file. Thanks though. –  Muazam Apr 20 '11 at 18:22
    
@Muazam, does this work for you? debian-administration.org/articles/590 –  Alex Apr 21 '11 at 13:20
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.