0

Objective:

I am trying to create a simple sftp access to the /var/www/ directory.

My Problem:

When I login via ftp, although I get access to the /var/www/ -I have access to the root directory also. I changed the chroot option as mentioned below to YES but still the problem persists. I cant seem to restrict access just to the /var/www folder.

Any help is appreciated.

Environment

  • CentOS7

Config

Below is my /etc/vsftpd/vsftpd.conf file

I created the user like so;

sudo useradd -m ftpuser -d /var/www/ sudo passwd ftpuser 

With the config file below, I have tried both with

chroot_local_user=YES 

and

chroot_local_user=NO 

VSFTPD Conf file

local_enable=YES write_enable=YES local_umask=022 allow_ftpd_full_access dirmessage_enable=YES xferlog_enable=YES xferlog_std_format=YES connect_from_port_20=YES userlist_enable=YES chroot_local_user=YES listen=NO listen_ipv6=YES pam_service_name=vsftpd tcp_wrappers=YES ssl_enable=YES rsa_cert_file=/etc/path_to_my_cert.pem rsa_private_key_file=/etc/path_to_my_keyv.pem 
2
  • Did you restart VSFTP after making your changes? Commented Nov 19, 2019 at 0:58
  • yes, I used sudo systemctl restart vsftpd Commented Nov 19, 2019 at 0:59

1 Answer 1

0

If you can show all directories then try by following:-

allow_writable_chroot=YES 

then restart ftp service

3
  • Is this not a bad idea based on this thread: serverfault.com/questions/743949/… Commented Nov 19, 2019 at 14:26
  • ensure that you would allow particular directory access to particular user (not a root user) Commented Nov 20, 2019 at 5:49
  • so chmod 755 on the /var/www/USER/ Commented Nov 20, 2019 at 5:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.