Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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've configured my vsftpd, I wanted to jail user to their directory, but I was getting this

vsftpd: refusing to run with writable root inside chroot()

so I put this command, but I was getting, and it worked

sudo chmod a-w /home/to/my/dir

but now I'm getting

COMMAND:>   [11/21/2012 12:01:13 AM] STOR SQLyogTunnel.php
        [11/21/2012 12:01:14 AM] 553 Could not create file.
ERROR:>     [11/21/2012 12:01:14 AM] Access denied.

on uploading file, kindly help me to resolve this.

Thank u

share|improve this question

migrated from stackoverflow.com Nov 20 '12 at 20:29

This question came from our site for professional and enthusiast programmers.

    
I also tried [allow_writeable_chroot=YES] in vsftpd.conf to jail user but it wasn't working so I've to put that chown a-w command – Majin Vegeta Nov 20 '12 at 19:03

You have a few possibilities:

  1. Remove write permission on home directory for the user and make subdirectory that is writeable
  2. Set local_root=/home in the configuration, that would chroot to /home
  3. Choose a different ftp daemon such as pure-ftpd.

In a later version vsftpd includes a allow_writeable_chroot directive, however the version shipped with ubuntu does not include that.

You could backport the vsftpd from debian unstable though (assuming you're on ubuntu 12.04 or 12.10):

sudo apt-get install build-essential devscripts
sudo apt-get build-dep vsftpd

mkdir ~/build
cd ~/build

wget http://ftp.de.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-1.dsc \
     http://ftp.de.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2.orig.tar.xz \
     http://ftp.de.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-1.debian.tar.xz

dpkg-source -x vsftpd_3.0.2-1.dsc
cd vsftpd-3.0.2

# After the following an editor will popup where you can add a
# short changelog entry such as "ported from debian unstable" 
# and than save and exit

# For Ubuntu 12.04
dch -R -D precise

# For Ubuntu 12.10
dch -R -D quantal

dpkg-buildpackage -us -uc -rfakeroot

After that you'll end up with a vsftpd_3.0.2-1build1_*.deb in ~/build just install it using the following command:

sudo dpkg -i ~/build/vsftpd_3.0.2-1build1_*.deb

After that the allow_writeable_chroot directive should work.

share|improve this answer
    
thanks, I've tried it but this command get error sudo dpkg -i vsftpd_3.0.2-1build1_*.deb – Majin Vegeta Nov 21 '12 at 8:00
    
cannot access archive: No such file or directory Errors were encountered while processing: /home/ubuntu/build/vsftpd_3.0.2-1build1_.deb ubuntu@ip-10-38-106-212:~/build/vsftpd-3.0.2$ sudo dpkg -i vsftpd_3.0.2-1build1_.deb dpkg: error processing vsftpd_3.0.2-1build1_.deb (--install): cannot access archive: No such file or directory Errors were encountered while processing: vsftpd_3.0.2-1build1_.deb – Majin Vegeta Nov 21 '12 at 8:01
    
I've connected to ftp but can't upload file – Majin Vegeta Nov 21 '12 at 10:25
    
well didn't you get any error while dpkg-buildpackage? do ls ~/build to see what files resulted from the build... – andrekeller Nov 21 '12 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .