23

I'm on SLES 10.1, and trying to configure vsftpd to allow root logins. Does anyone know how to do this?

So far, I have this:

local_enable=YES
chroot_local_user=NO
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.users

And I've added root to /etc/vsftpd.users. When I try to log in, here's what I get:

$ ftp susebox
Connected to susebox.example.com.
220-FTP Server (user '[email protected]')
220
User (susebox.example.com:(none)): root
331-Password:
331
Password:
Connection closed by remote host.

C:\>

BTW, if you don't know the answer, please don't bother lecturing me about how I shouldn't allow root logins. I know what I'm doing, and I accept full responsibility for any ruptures in the space-time continuum that may result.

3
  • Not only are you creating huge dents in the continuum, you're raping the very fabric of it's integrity! The only use I can think up for this is a honeypot, but AFAIK nobody even tries to login with root by ftp. All other uses....bit.ly/yzoSbB That being said, it's answered below.
    – Roman
    Jan 10, 2012 at 15:57
  • 1
    I have this exact problem but it's in a completely isolated test network. Not all systems are on the Internet, you know.
    – lcbrevard
    Jan 31, 2013 at 21:09
  • 1
    I don't see why this fuss is about. I'm setting this up for testing and the server will be wiped out in a couple of days. Using root is the quickest way to get over with my task, why should I makes things overly complicated, because somebody told me this at school?
    – sr9yar
    Nov 21, 2020 at 9:22

7 Answers 7

17

DISCLAIMER: Enabling root login for FTP is a Very Bad Idea for many, many reasons.

Edit your vsftpd.conf file, and add the following line:

userlist_deny=YES

Edit user_list and ftpusers and comment out "root".

2
  • 2
    Just FYI for those using vsftpd, the user_list file is located under /etc/vsftpd/user_list
    – GoTTimw
    Sep 2, 2014 at 12:31
  • 1
    Fedora 20: I had to change it in both places: user_list and also ftpusers.
    – ATorras
    Nov 11, 2014 at 16:22
14

For those (like me) using VSFTPD on Ubuntu server in mid-2013, it appears that root is allowed to login via secure SFTP by default, no special changes necessary.

However, if you really need plain old FTP access, all I had to do was:

sudo nano /etc/ftpusers

And comment out the line with root on it by placing a # at the start. Save the file, and reloading the server is not even necessary.

BEWARE: This potentially allows the root password to be transmitted over the network, completely unencrypted, in PLAIN TEXT. It's a very bad idea unless you're working on a local virtual machine.

4

vi /etc/pam.d/vsftpd -> if you use vsftpd

find

auth blablabla sense=deny file=/etc/ftpusers 

Make it to be sense= allow or you can uncomment script above it, or modify the file:ftpusers or add another ftpusers files

1

for Debian 8 Jessie, you just need to edit /etc/ftpusers and comment out or delete root. nothing else needed, just restart vsftpd

0

Vsftpd can use pam for authentication, so I suggest you check /etc/pam.d/vsftpd. You will probably find it is pam that has been configured to prevent root from logging in.

0

In newer versions, you may need to change pam_service_name=vsftpd to pam_service_name=ftp near the end of your /etc/vsftpd.conf file. Otherwise, you may get a login authentication error for root (or any user) even though permissions are otherwise correct.

0

As 2020, after a fresh install of vsftpd, the only step required is changing /etc/ftpusers from:

root
daemon
bin
sys
adm
...

To

#root
daemon
bin
sys
adm
...

The ftpuserlist file explicitly lists users that are disallowed FTP access.

Also,

  1. If you're using software controlled firewall(Like UFW or IPTables), make sure to open the FTP ports and also configure VSFTPD passive mode:

    pasv_enable=Yes
    pasv_max_port=10100
    pasv_min_port=1009
    pasv_address=xxx.xxx.xxx.xxx

    You should select a port range that fits your network/needs, then, afterwards allow this port range on your firewall, otherwise you'll keep getting a constant '227 Entering Passive Mode' followed by a disconnection.

  2. If you're using Amazon EC2, Google Cloud, Azure or any other solution, make sure to also allow those ports on the Security Groups/Firewall Rules on the console.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .