problems with users in vsftpd

21 Views Asked by At

I'm having trouble connecting to my vsftpd server, and I'm not sure what to do. I installed vsftpd, but when I try to connect using FTP and my IP address, it simply says "Connection Refused." I attempted to disable the firewall, but that didn't resolve the issue.

Do I need to create a user or perform any additional steps to get it working? I'm stuck and would appreciate any guidance on making this work. Thanks in advance!

1

There are 1 best solutions below

0
Azr On

I have problems in the past with this and i solved it, i'm gonna do a guide to help u step by step since the beginning .

1.-Install vsftpd

sudo apt install vsftpd

2.-If u need to change something edit the file vsftpd.conf

sudo nano /etc/vsftpd.conf

3.-You can add or change some lines like the next ones inside the file.

listen_port=9999
local_root=/home/user/vsftpd
user_config_dirs=/etc/vsftpd/user_conf/
anon_umask= 077
local_umask= 077
ftpd_banner= Hey.
idle_session_timeout=600

4.-Now, you need to create the directory of your local root like this:

sudo mkdir -p /home/user/vsftpd/{downloads,uploads}

5.-Then, you should create some users, in my case i will create the downloader, uploader and administrator one.

sudo useradd uploader -p /home/user/vsftpd/uploads
sudo passwd uploader
sudo useradd downloader -p /home/user/vsftpd/downloads
sudo passwd downloader
sudo useradd administrator -p /home/user/vsftpd
sudo passwd administrator

6.-Lets change the permission of the users in the directories, in my case i will give them this ones.

sudo chown -R uploader:uploader /home/user/vsftpd/uploads
sudo chmod -R 755 /home/user/vsftpd/uploads
sudo chmod -R u+w /home/user/vsftpd/uploads
sudo chown -R downloader:downloader /home/user/vsftpd/downloads
sudo chmod -R 755 /home/user/vsftpd/downloads
sudo chmod -R u-w /home/user/vsftpd/downloads
sudo chown -R admin:admin /home/user/vsftpd
sudo chmod -R 755 /home/user/vsftpd

7.-You can create a directory to users configuration.

sudo mkdir /etc/vsftpd/user_conf

and give it some users directives.

sudo nano /etc/vsftpd/user_conf/uploader
sudo nano /etc/vsftpd/user_conf/downloader
sudo nano /etc/vsftpd/user_conf/admin

8.-In my case this files containe :

uploader

write_enable=YES
download_enable=NO
anon_world_readable_only=YES

downloader

write_enable=NO
anon_world_readable_only=YES

admin

write_enable=YES
anon_world_readable_only=NO

9.-If you still have some problems try to disable your firewall with sudo ufw disable try to change some permissions on previously directories like sudo chmod 777 /home/user/... if the directories are unreachable, remember try to connect like ftp ip port separate with spaces, you can also restart vsftpd like sudo systemctl restart vsftpd