Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ubuntu 12.04 app server hosting a few websites. We need to give access to the developer to only be able upload files to one of the websites. I have installed Jailkit but can't seem to find how to give him sFTP access to the website directory.

Here is our web directory structure:

/var/www/ /var/www/ /var/www/ all owned by www-data:www-data

Can someone give me some step by steps to giving a user access to only one or two of these directories via sFTP and no ssh access?

share|improve this question
Why don't you just set up FTP for that? sFTP isnt that flexible with access permissions... – Thomas W. Nov 1 '12 at 13:26
honestly I didn't think about it except that I don't have ftp on the server for security reasons. – John Hamman Nov 1 '12 at 16:14
up vote 1 down vote accepted

In general, that is not a practical directory structure for reasons you are encountering. If you only have one website, then the /var/www dirctory might be just fine. However, in my experience, 20+ years, the best approach is to create a separate home partition so that the home partition can be mounted nosuid, noexec, nodev, et al. Each website has its own system user account. That account is given a shell, rssh, which allows sftp but no ssh. This is practical when hosting, when hiring developers, or even from a security point of view.

Having written that much, one solution becomes clear: move the sites to user account directories and update the web server configuration. This can be done safely by creating a copy of the website on a subdomain. For example, for the domain,, create a CNAME called Make sure the site on is working. Then, update the web server config file to point to the new location once you know it is flawless.

At that point, you can provide access via sFTP to whomever you please without this concern.

But... to get to the point and answer the question: a less obvious but effective solution is to use ACL. With ACL, you can get much better fine-grain controls on file system permissions. Using ACL can provide the desired restrictions.

The first thing to do is to install the acl software:

sudo apt-get install acl

The next thing to do is to mount or remount the filesystem with the ACL option.

sudo -e /etc/fstab

You might see a line like this, so add the acl option.

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx / ext4 defaults,acl 0 1

Save and quit. Remount with acl enabled.

sudo mount -o remount,acl /

After this, you will have access to ACL. There is guide for ACL on Some examples of ACL usage on

Managing arbitrary user permissions under PureFTPd

Whats the simplest way to edit and add files to "/var/www"?

share|improve this answer
Do you have any articles that show how I can do exactly what you suggested (the partition part) on a ec2 server [if that matters]. Currently the /var/www/ is on it's own ebs mount. Can I just remount that with nosuid, noexec, nodev? And are you saying that I should have a separate mount for each site or one for all sites? – John Hamman Jan 16 '13 at 12:34

Your Answer


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.