S
S
s_a_n_i_c2021-04-27 19:08:06
Debian
s_a_n_i_c, 2021-04-27 19:08:06

How to assign directory to vsftpd user in debian 9?

Hello good people!
Please help me solve the problem with ftp access.

I have a vps like game hosting, no web interface.
The /home folder contains game server folders. The folder names correspond to the port numbers.
For example, there is a folder "1234", its owner is "ftp1234".

When connecting user "ftp1234" via ftp:

500 OOPS: cannot change directory:/home/ftp1234/ftp

But it is necessary that only the directory /home/1234 be opened for

this user. This user is specified in /etc/vsftpd.userlist.

In cat /etc/passwd
ftp1234:x:1005:1007:,,,:/home/1234:/bin/bash

In ls -l /home
total 32
drwxrwxrwx  6 root    root    4096 Feb 10 11:28 1111
drwxrwxrwx  6 ftp1234 ftp1234 4096 Apr 27 16:09 1234
drwxrwxrwx  8 root    root    4096 Jan 27 19:17 7777


In nano /etc/vsftpd.conf
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=30000
pasv_max_port=31000
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO


How can I make "ftp1234" ftp only go to /home/1234 and be able to edit my files there?
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alegzz, 2021-04-27
@alegzz

instead of local_root you need to use passwd_chroot_enable=YES

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question