2

I'm trying to install an FTP server (vsftpd) on my Ubuntu 16.04 server from Scaleway.

I've did the following:

sudo apt-get update
sudo apt-get install vsftpd
sudo service vsftpd status

I'm receiving the following result:

● vsftpd.service - vsftpd FTP server
   Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-08-31 22:26:53 CEST; 10min ago
  Process: 10161 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2)
  Process: 10157 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS)
 Main PID: 10161 (code=exited, status=2)

Aug 31 22:26:53 scw-24e1a0 systemd[1]: Starting vsftpd FTP server...
Aug 31 22:26:53 scw-24e1a0 systemd[1]: Started vsftpd FTP server.
Aug 31 22:26:53 scw-24e1a0 systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 31 22:26:53 scw-24e1a0 systemd[1]: vsftpd.service: Unit entered failed state.
Aug 31 22:26:53 scw-24e1a0 systemd[1]: vsftpd.service: Failed with result 'exit-code'.

What could be the problem of this?

pa4080
  • 29,831
nielsv
  • 111

2 Answers2

2

If you didn't touched /etc/vsftpd.conf, the reason for this failure status should be that another service is already listen on the default FTP port - 21. I've made an experiment and I've received the same status as yours. You can investigate which is that another service by any of the commands:

sudo lsof -i -n -P | grep ':21'
sudo netstat -peanut | grep ':21'

Try to sudo systemctl stop <that another>.service and sudo systemctl start vsftpd.service, then check the status again: sudo systemctl status vsftpd.service.

Another way to solve this issue is to change the port on which one of these services listen. For example you can do that for vsftpd by adding the following directive to /etc/vsftpd.conf - reference:

listen_port=2121

Then you should instruct the FTP client to connect via the port 2121 instead of the default one. In most cases you just need to add :<port-number> at the end of the target ip-address/FQDN. For example, if you are using Nautilus as FTP client:

enter image description here

Additional notes:

I do not know how secure is vsftp in practice, but if you do not have a special need to use this service you can use sftp that goes over the encrypted SSH connection and uses its key based authentication if it is previously configured. Also, you do not need to open any additional port into your firewall.

Sure, if you have SSH access to the Ubuntu instance, sftp is already available if you haven't disabled it! Here are few references related to that:

pa4080
  • 29,831
0

If your output said state of code=exited, status=2/INVALIDARGUMENT, that mean your /etc/vsftpd.conf is uncorrectly.

Edited your /etc/vsftpd.conf and add a queue :

from listen=YES to listen=NO

and then restart your service.

This works to me.