Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Apr 19, 2013 3:30 pm 
Offline
Senior Newbie

Joined: Tue Jan 08, 2013 1:52 pm
Posts: 13
Is there anything in the documentation or elsewhere that demonstrates how to do the following?

1. Add a new user
2. Grant them SSH and SFTP access to *only* their home directory and their websites.


I host a number of client websites (e.g. /srv/www/myclient.com/public_html) on my Linode server. I now want to be able add users to my server who will have the ability to SSH ans SFTP into their websites. Being an infrequent Linux admin, I'd simply like to know how best to make this happen ... and if there are any best practices I should follow in order to make sure things are as secure as possible with this scenario.


Thanks much - wg


Top
   
PostPosted: Fri Apr 19, 2013 8:29 pm 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
By default they will have write access only to their home directories, but read access to most of everything else. If you want to prevent read access to the rest of the system, you need to look into using chroot.


Top
   
PostPosted: Sat Apr 20, 2013 1:11 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
This guide covers setting up SFTP jails. Note that you would need to set the appropriate home directory for the user with something like usermod -d /srv/www/myclient.com username first. The user's home directory, as well as the directories above it, must be owned by root and not writable by any other user or group.

Allowing SSH access would be considerably more involved. It requires that copies of all binaries and device nodes that the user may need be present under the user's home directory.


Top
   
PostPosted: Sat Apr 20, 2013 8:00 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
For the SSH case, I've used jailkit before, with good success.

There's also debootstrap. :-)

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
PostPosted: Wed Apr 24, 2013 3:51 pm 
Offline
Senior Newbie

Joined: Tue Jan 08, 2013 1:52 pm
Posts: 13
Vance wrote:
This guide covers setting up SFTP jails. Note that you would need to set the appropriate home directory for the user with something like usermod -d /srv/www/myclient.com username first. The user's home directory, as well as the directories above it, must be owned by root and not writable by any other user or group.

Allowing SSH access would be considerably more involved. It requires that copies of all binaries and device nodes that the user may need be present under the user's home directory.



Thanks for the link ... worked perfectly.


As I'm running on a LMEP stack, with all of my sites running under www-data:www-data, will I have any problems with these SFTP users uploading files that need to be served by Nginx given that the owner will be myser:myuser?

They will be uploading, for the time being, php, html, css, javascript files.


Thanks again.


Top
   
PostPosted: Wed Apr 24, 2013 4:33 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
By default the files created will have read permissions for owner, group and others, so no - nginx should be serve files just fine. There may however be a problem with PHP when writing files, this happens quite a lot onhosting environments, Reading PHP will be fine, but if you need to upload stuff or things like that you'll have to set the folder where it is stored to a more open chmod. Unless of course PHP also runs on www-data.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group