7

I setup VSFTPD on my Ubuntu server 12.04, it worked very good. Until I tried to change the permissions of the user so the user couldn't go in the / directory and only in the directories inside /home/user/public_html.

It could have to do something with the fact that I did this:

sudo chmod 700 -R /

I have a user, ftpUser and he is inside a group, ftpUsers. The permissions of /home/user/public_html are:

drwxrwxr-x 9 ftpUser ftpUsers 4096

My VSFTPD file looks like this:

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
connect_from_port_20=NO
chroot_local_user=YES
pam_service=vsftpd
userlist_file=/etc/vsftpd.userlist
userlist_enable=YES
userlist_deny=NO

And in /etc/vsftpd.userlist there is only one line: ftpUser

How do I solve this so I can login, it think it has to do something with permissions but I don't now what it is!?

  • Is user ftpUser a local or a virtual user? And does he has a home dir? – OrangeTux Aug 10 '12 at 13:00
  • It's a local user, and the home dir is /home/user/public_html, but now I tried to reboot Ubuntu server and I cannot log in with any account... – tversteeg Aug 10 '12 at 13:01
  • And when you set chroot_local_user=NO? Just for checking it that is the problem. I think that it has to do with that. – OrangeTux Aug 10 '12 at 13:04
  • Then I still get the same error! – tversteeg Aug 10 '12 at 13:20
3

You can check this link. It worked for me.

Make sure that the user and group permissions for the account and the home directory match. For example, if you are logging in as:

account:x:521:500::/some/directory:/sbin/nologin

then make sure that the home directory defined for “account” is at least readable and executable by user 521 and group 500.

  • As an addition to that post (which says make sure that your directory permissions are OK-- at least readable by the user/group), you also need to ensure that permissions suffice for the parent directories (at least execute permissions). – Bill Denney Aug 28 '17 at 23:22
2

That error is generated because of Selinux. Please do the following actions:

[root@sun02 vsftpd]# getenforce
    Enforcing

[root@sun02 vsftpd]# getsebool -a | grep ftp
    allow_ftpd_anon_write –> off
    allow_ftpd_full_access –> off
    allow_ftpd_use_cifs –> off
    allow_ftpd_use_nfs –> off
    allow_tftp_anon_write –> off
    ftp_home_dir –> off     # We need to change this to on - see next command.
    ftpd_disable_trans –> off
    ftpd_is_daemon –> on
    httpd_enable_ftp_server –> off
    tftpd_disable_trans –> off

[root@sun02 vsftpd]# setsebool -P ftp_home_dir on

This is all that u want to need.

Good Luck!

source: Copied and pasted from the above link. Credits to @Jaime M. of http://blog.arithm.com/

  • 1
    There is a typo in command, it's "setsebool -P ftp_home_dir on" not "setseboll -P ftp_home_dir on" – Sathish Jan 25 '16 at 7:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.