Search code examples
ftppureftpd

FTP: 550 Can't change directory to ...: No such file or directory


I just installed a FTP server on my computer with the following script:

#!/bin/bash
groupadd ftpgroup
useradd -g ftpgroup -d /dev/null -s /etc ftpuser
pure-pw useradd robert -u ftpuser -d /ftphome
pure-pw mkdb
cd /etc/pure-ftpd/auth/
ln -s ../conf/PureDB 60pdb
mkdir -p /ftphome
chown -R ftpuser:ftpgroup /ftphome/
/etc/init.d/pure-ftpd restart

Then, I executed it like this:

chmod 755 setup-ftp
./setup-ftp

And I finnaly connected to it as robert with:

~# ftp My_Ip_Address 21

ftp> Name: robert

etc...

ftp> cd /usr

550 Can't change directory to /usr: No such file or directory

So, I don't get why I can't access to any directory when using ftp, I guess I have to set something, but I don't know what.

Thank you


Solution

  • pure-pw useradd robert -u ftpuser -d /ftphome

    From the documentation:

    With -d, joe will be chrooted. If you want to give joe access to the whole filesystem, use -D instead of -d.

    This means that /ftphome will be the root for the user where he cannot break out. And access to the directory /usr inside this root will actually be /ftphome/usr which probably does not exist in your case.