Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Having real issues with ftp access to my cloud VPS ubuntu solution.

I have tried both vsftpd and pure-ftpd. I found that both were limited. I have now tried to focus on vsftpd as it is well received.

I tried following the instructions here:

http://ubuntuforums.org/showthread.php?t=518293

The only thing I haven't done in this guide so far is add the TLS/SSL/FTPS rules, as I am having issues adding the port 990 to the firewall settings of the server. This has been flagged with my provider and hopefully will be resolved in time.

Initially I was using users that had shell access. This was allowing the user to login and access the server and the correct folders, but could not write new files or overwrite existing files on the server. They could create folders and delete files. When I logged in with shell accounts using command line ftp, I could write (mput) files to the server no problem, but I expect this is because of the way command line ftp works as opposed to an ftp service.

I thought my problem might be that my users might not be able to access as they had shell access. I then created a new user with no shell access. I cannot login with these users. I am getting a 530 Incorrect Login, even though I have changed and tested the password. I cannot login with command line ftp either.

I have included below my vsftpd.conf file. I tried a custom one but ended up reverting to the original, just to start again. I have added the check_shell=NO directive to see if this has helped. I had started down the path of adding virtual users to the system, but I don't see how this is going to change anything.

I have quite literally spend the whole weekend trying to resolve this, to no avail.

Here are the /etc/shadow contents (-hashed pwds). The two new users are spdftp and scftp:

root:xxxx:15607:0:99999:7:::
daemon:*:15104:0:99999:7:::
bin:*:15104:0:99999:7:::
sys:*:15104:0:99999:7:::
sync:*:15104:0:99999:7:::
games:*:15104:0:99999:7:::
man:*:15104:0:99999:7:::
lp:*:15104:0:99999:7:::
mail:*:15104:0:99999:7:::
news:*:15104:0:99999:7:::
uucp:*:15104:0:99999:7:::
proxy:*:15104:0:99999:7:::
www-data:*:15104:0:99999:7:::
backup:*:15104:0:99999:7:::
list:*:15104:0:99999:7:::
irc:*:15104:0:99999:7:::
gnats:*:15104:0:99999:7:::
nobody:*:15104:0:99999:7:::
libuuid:!:15104:0:99999:7:::
syslog:*:15104:0:99999:7:::
sshd:*:15104:0:99999:7:::
mysql:!:15104:0:99999:7:::
postfix:*:15424:0:99999:7:::
clamav:!:15425:0:99999:7:::
amavis:*:15425:0:99999:7:::
vmail:!:15425:0:99999:7:::
dovecot:*:15425:0:99999:7:::
vsftpd:!:15724:0:99999:7:::
ftpuser:!:15752:0:99999:7:::
ftp:*:15752:0:99999:7:::
spdftp:xxxx:15754:0:99999:7:::
scftp:xxxx:15754:0:99999:7:::

Here is the output of the /etc/passwd file for those users:

spdftp:x:5005:1002::/var/www/path/to/home:/bin/sh
scftp:x:5006:1002::/var/www/path/to/home:/bin/sh

For the record, I used the command:

useradd scftp -d /path/to/home/dir -g ftpusers

to create the users. I didn't add a shell argument, though the system set it to /bin/sh.

I chown -Rf /var/www spdftp and chown -Rf /var/www/path/to/home scftp (I want the user spdftp as a kind of master ftp account and scftp to only have access to a specific site folder). I also chgrp -Rf /var/www ftpusers

The /etc/vsftpd.conf file is as follows:

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES


# Ignore shell login request
check_shell=NO

#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=ftp

I'm not sure about the last line. I thought it should be pam_service_name=vsftpd but neither has worked anyway.

I also created the vsftpd.chroot_list. Here is the contents of that file:

spdftp
scftp

There is a /etc/vsftpd.passwd file but it has no entries for these two usernames. I don't know how to create or add them to this if this is the problem.

Any help would be greatly appreciated. I have very little hair and what's left I'm tearing out!

UPDATE

I changed each users' shell to first, /bin/false and second, /bin/bash. This at least allowed me to login, without getting the 530 Incorrect login error. I get a network timed out error though after this and the following in the log (x.x.x.x is my fixed IP address):

Mon Feb 18 11:49:15 2013 [pid 2] CONNECT: Client "x.x.x.x"
Mon Feb 18 11:49:15 2013 [pid 1] [scftp] OK LOGIN: Client "x.x.x.x"
Mon Feb 18 11:50:48 2013 [pid 2] CONNECT: Client "x.x.x.x"
Mon Feb 18 11:50:49 2013 [pid 1] [spdftp] OK LOGIN: Client "x.x.x.x"

There doesn't seem to be any failure reason given in the /var/log/vsftpd.log. Not sure if there's another log I can check.

UPDATE 2

I found that I had left a couple of lines in the vsftpd.conf file:

#guest_enable=YES
#guest_username=ftp

#user_config_dir=/etc/vsftpd/vusers

As I had started down the path of creating virtual users. I thought I had commented this out, but I hadn't.

Now I can connect, my final issue is that I am back where I started in that my users cannot upload files to the server. The following error is in my vsftpd.log:

Mon Feb 18 12:13:54 2013 [pid 3] [spdftp] FAIL CHMOD: Client "x.x.x.x", "/path/to/home/folder/2013/humans.txt 777"

So, full circle to the same issue. Anyone anything?

share|improve this question

1 Answer 1

For what it's worth, I resolved this issue by doing a full purge of the vsftpd service and installation and then re-install. Somewhere along the lines my settings in vsftpd must have gotten crossed wires or conflicts. I had uninstalled before, but did not know about:

aptitude purge vsftpd
aptitude autoclean

Once I did that and then did an

aptitude install vsftpd

The only setting I needed to change in the vsftpd.conf was write_enable=YES. (I also added a couple of settings to ensure users could not navigate out of their homefolder).

share|improve this answer

Your Answer

 
discard

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.