LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2018, 03:06 AM   #1
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Rep: Reputation: Disabled
vsftpd chroot


Netgear stora NAS Linux axentraserver.get.mystora.com 2.6.22.18-Netgear #16 Sun Jun 13 19:54:46 EDT 2010 armv5tejl armv5tejl armv5tejl GNU/Linux
I think is Debian, but not sure. There is installed vfftpd on it.
I have user called "niki" which I use to access ftp.
Code:
id niki
uid=502(niki) gid=503(niki) groups=503(niki),100(users),501(admins)

etc/passwd
niki:x:502:503::/home/niki:/bin/bash

ll /home/ |grep niki
drwxr-s---  3 niki            www               85 Mar 21  2018 

ll /home/niki/
drwsrws--- 11 niki www   119 Nov 27 22:38 storage

ll /home/niki/storage/
drwxrwxr-x  9 niki www 4.0K Dec  6 16:27 Video
This is vsftpd.conf
Code:
vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=007
#chroot_list_enable=YES
#chroot_local_user=NO
#user_config_dir=/etc/vsftpd/vsftpd_user_conf
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
charset_filter_enable=YES
charset_client=UTF-8
charset_server=UTF-8
force_local_data_ssl=NO
force_local_logins_ssl=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem
pasv_max_port=50100
pasv_min_port=50000
pasv_enable=YES
port_enable=YES
ssl_enable=YES
How to disable chrooting? With current configuration I can make up and browse everything.

Thanks in advance !
 
Old 12-07-2018, 04:57 AM   #2
vsukt
LQ Newbie
 
Registered: Oct 2018
Location: Mumbai, India
Distribution: Debian, CentOS, Linux Mint
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by netaccs View Post

How to disable chrooting? With current configuration I can make up and browse everything.
Hi, It should work as chroot disabled as per configuration. Try uncommenting #chroot_local_user=NO and restart the service.
 
Old 12-07-2018, 05:09 AM   #3
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
I try that, but still can chroot. Also tried "chroot_list_enable=YES"
in "chroot_list_file=/etc/vsftpd/chroot_list" enter my user and also try with empty file.
Everytime restarting vsftpd using init.d/ and restarting filezila ftp client.
 
Old 12-13-2018, 08:04 AM   #4
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
Any other idea?
 
Old 12-13-2018, 08:36 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
Any other idea?
You need just
Code:
chroot_local_user=YES
Comment out the 2 "chroot_list_*" options
 
Old 12-13-2018, 08:49 AM   #6
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
When trying this:
chroot_local_user=YES
chroot_list_file=/etc/vsftpd/chroot_list (file is empty or contains just one user)

ftp client got error:
Status: Retrieving directory listing of "/storage"...
Command: CWD storage
Response: 550 Failed to change directory.
Error: Failed to retrieve directory listing
 
Old 12-13-2018, 04:50 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
When trying this:
chroot_local_user=YES
chroot_list_file=/etc/vsftpd/chroot_list (file is empty or contains just one user)

ftp client got error:
Status: Retrieving directory listing of "/storage"...
Command: CWD storage
Response: 550 Failed to change directory.
Error: Failed to retrieve directory listing
The directories must have 755 permissions in order to be searchable
 
Old 12-14-2018, 01:36 AM   #8
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
With 775 and 755 I got
Code:
Status:	Retrieving directory listing of "/"...
Command:	CWD /
Error:	Connection closed by server
Error:	Failed to retrieve directory listing
Also trying with my user into vsftpd.chroot.list or empty file.

drwxrwxr-x 3 niki www 85 Mar 21 2018 niki
drwxrwxr-x 11 niki www 119 Nov 27 22:38 storage

Can't find how to enable logging of vsftpd
 
Old 12-14-2018, 02:15 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
With 775 and 755 I got
Code:
Status:	Retrieving directory listing of "/"...
Command:	CWD /
Error:	Connection closed by server
Error:	Failed to retrieve directory listing
Also trying with my user into vsftpd.chroot.list or empty file.

drwxrwxr-x 3 niki www 85 Mar 21 2018 niki
drwxrwxr-x 11 niki www 119 Nov 27 22:38 storage

Can't find how to enable logging of vsftpd
Try this (esp. use: log_ftp_protocol=YES)

Last edited by bathory; 12-14-2018 at 02:21 AM.
 
Old 12-14-2018, 07:03 AM   #10
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
First I make touch /var/log/vsftpd.log, then add this to vsftpd.conf
log_ftp_protocol=YES
xferlog_std_format=YES (also with xferlog_std_format=NO)
but still vsftpd.log is empty.
 
Old 12-14-2018, 07:55 AM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
First I make touch /var/log/vsftpd.log, then add this to vsftpd.conf
log_ftp_protocol=YES
xferlog_std_format=YES (also with xferlog_std_format=NO)
but still vsftpd.log is empty.
In order to log the full ftp session you need to set
Code:
xferlog_std_format=NO
Perhaps you have to also disable tcp_wrappers (set tcp_wrappers=NO, or comment out the option)
 
Old 12-14-2018, 09:01 AM   #12
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
Still same. I put 775 on vsftpd.log file
-rwxrwxr-x 1 root root 0 Dec 14 11:11 vsftpd.log

There is current config, am I wrong something?
Code:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=007
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
log_ftp_protocol=YES
xferlog_std_format=NO
listen=YES
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
#tcp_wrappers=YES
tcp_wrappers=NO
charset_filter_enable=YES
charset_client=UTF-8
charset_server=UTF-8
force_local_data_ssl=NO
force_local_logins_ssl=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem
pasv_max_port=50100
pasv_min_port=50000
pasv_enable=YES
port_enable=YES
ssl_enable=YES
 
Old 12-14-2018, 05:23 PM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
Still same. I put 775 on vsftpd.log file
-rwxrwxr-x 1 root root 0 Dec 14 11:11 vsftpd.log

There is current config, am I wrong something?
Code:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=007
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
log_ftp_protocol=YES
xferlog_std_format=NO
listen=YES
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
#tcp_wrappers=YES
tcp_wrappers=NO
charset_filter_enable=YES
charset_client=UTF-8
charset_server=UTF-8
force_local_data_ssl=NO
force_local_logins_ssl=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem
pasv_max_port=50100
pasv_min_port=50000
pasv_enable=YES
port_enable=YES
ssl_enable=YES
Are you sure vsftpd is running? Can you connect from localhost?
Is vsftpd patched in order to use the charset_* options?

I suggest you to ditch your config file and read this howto (if you're running debian, or find one for your distro).
Start without the SSL/TLS stuff and if it works, go ahead and configure the secure part (step 6).
 
Old 12-15-2018, 01:14 AM   #14
netaccs
Member
 
Registered: Mar 2018
Posts: 42

Original Poster
Rep: Reputation: Disabled
It is working ot nas (Netgear stora) and it is some limited linux edition. No "apt" and other commands.
May be some other trick for chrooting?
 
Old 12-15-2018, 08:37 AM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by netaccs View Post
It is working ot nas (Netgear stora) and it is some limited linux edition. No "apt" and other commands.
May be some other trick for chrooting?
You're supposed to use the link above just to configure vsftpd.
No need to use apt or anything else since vsftpd is already installed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[VSFTPD] 500 OOPS: vsftpd: refusing to run with writable root inside chroot() srijur Linux - Server 1 03-31-2014 04:10 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
vsftpd.conf/chroot/vsftpd.chroot_list issue Jerman Linux - Security 2 06-01-2007 07:24 PM
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
to chroot or not to chroot complus Linux - Security 4 02-29-2004 04:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration