Linux – Setup vsftpd server so that I can access the web root

centos5ftplinux

Probably getting fed up with the amount I have posted today lol.

I am trying to find a tutorial which will show me how to correctly install and setup vsftpd on centos 5.5… This is probably one of the most simplist of tasks, however I am still a newbie and just trying to setup a server on our local network which will act as an intranet.

I have everything else installed and working… Anonymous ftp works and I can get to the /var/www/html/ directory, however I just can't seem to get user accounts to work.

*** CuteFTP 8.3 - build Aug 25 2008 ***

STATUS:>    [06/08/2010 15:04:49] Getting listing ""...
STATUS:>    [06/08/2010 15:04:49] Connecting to FTP server... 192.168.1.136:21 (ip = 192.168.1.136)...
STATUS:>    [06/08/2010 15:04:49] Socket connected. Waiting for welcome message...
        [06/08/2010 15:04:49] 220 (vsFTPd 2.0.5)
STATUS:>    [06/08/2010 15:04:49] Connected. Authenticating...
COMMAND:>   [06/08/2010 15:04:49] USER j0nR
        [06/08/2010 15:04:49] 331 Please specify the password.
COMMAND:>   [06/08/2010 15:04:49] PASS *****
        [06/08/2010 15:04:52] 530 Login incorrect.
ERROR:>     [06/08/2010 15:04:52] Not logged in.
STATUS:>    [06/08/2010 15:04:54] Connection closed.

I am about ready to smack my head on the table!

I am not sure I have even setup the ftp users correctly, any further information you require please do let me know but you will have to talk to me like the newbie that I am.

Thanks in advance, and happy friday 🙂


EDIT

listen=YES
anonymous_enable=NO
#anon_root=/var/www/html/
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
local_enable=YES
virtual_use_local_privs=YES
write_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/html/$USER
chroot_local_user=YES
hide_ids=YES
tcp_wrappers=YES
userlist_enable=YES
userlist_deny=NO

That is my vsftpd.conf file.

Best Answer

It would probably be more useful to paste your vsftpd config, but check the following:

  • The username is allowed to login to FTP. If the username is in /etc/vsftpd/user_list then you need to ensure that, in /etc/vsftpd/vsftpd.conf, userlist_enable=YES and userlist_deny=NO. If the username is not present then you need to make sure that, if userlist_enable=YES then userlist_deny=NO or is not present.

  • Check the shell and home directory in the passwd file. Type vipw and check that the shell is not /bin/false (change it to /sbin/nologin if it is) - I'm not sure why this is an issue but I've seen it cause problems before. Next, set the home directory to wherever you want the user to login to. Not essential, but more secure.

  • Ensure that the user has access to the directory. Do su j0nR - and then try to cd into their home directory. If it works, it's probably a password issue. Type passwd j0nR and set it to what you think it should be.

Good luck.