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 need to give SSH read only access to a certain directory so they can look at my PHP code.

The directory is /var/www/html/websitenamehere/

How can I make a user and let them login via SSH to see that directory and read it only? Is that possible?

I'm use to only logging in as root.

share|improve this question
1  
The fact that you only login as root yourself is worrisome. Your system is almost certainly full of holes if that is the case and you should be concerned about giving anybody access to the box at all until your own habits are cleaned up and locked down. –  Caleb May 3 '11 at 7:58
add comment

1 Answer

up vote 1 down vote accepted

Something like:

useradd readonlyuser

passwd readonlyuser (*if you want password auth, otherwise, setup SSH keys)

chmod -R o+rx /var/www/html/websitenamehere/

usermod -d /var/www/html/websitenamehere/ readonlyuser

Or you could just make a tarball of the filesystem and mail it to the user with something like tar cfvz websitenamehere.tar.gz /var/www/html/websitenamehere/

share|improve this answer
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.