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 10-14-2003, 02:52 AM   #1
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Rep: Reputation: 15
VSFTPD Config and CHROOT REDHAT 8


I have VSFTPD working (I would say fine) and have changed the vsftpd.conf file to read:
.....
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list


The list file just contains one user. What I was hoping was that this would restrict all ftp users to their 'home' directories, apart from the list user (myself). However, I can log in as any user and cd to any directory (tried and worked with cd /).
Also, what is the definition of 'local user' - in my case I logged in from a remote server...?
 
Old 10-14-2003, 01:53 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Welcome to LQ.

I that sense a local user is an account on the machien where the vsftpd server is. That config should be all that is needed. Have you restarted the vsftpd service? If you still have problems then try posting the whole vsftpd.conf file.
 
Old 10-15-2003, 01:34 AM   #3
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Original Poster
Rep: Reputation: 15
I initially used the GUI services restarted and restarted inet - when I still got the same problem, I rebooted the machine. Same problem.

If 'local user' is someone on the same machine, how do I restrict 'remote' users -as we will be using the server to act as an FTP server?

Here's the whole config:
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are very paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
#
# Allow anonymous FTP?
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES

pam_service_name=vsftpd





Thanks for the reply!
 
Old 10-15-2003, 01:02 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
I'm not sure what you mean by remote users? Users who login remotely are considered local users if they have an account on the server.
 
Old 10-15-2003, 01:23 PM   #5
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Original Poster
Rep: Reputation: 15
I used 'remote' mainly because I didn't know what the local in chroot_local meant. If 'local' in this case means any user who has an account on the server, then ignore my comments about remote! (so non local means 'anonymous'?)
 
Old 10-15-2003, 01:32 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Yes non local means anonymous. Are you still having problems with the config?

Try this as your config:
Code:
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
idle_session_timeout=600
chroot_local_user=yes
pam_service_name=vsftpd
listen=YES
tcp_wrappers=YES
Then restart vsftpd:
service vsftpd restart

That should chroot all users by default. If that works hten try adding the chroot list option to allow one user to go anywhere.
 
Old 10-15-2003, 03:00 PM   #7
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Original Poster
Rep: Reputation: 15
I have reset the config file and restarted the xinetd services.
What is odd is if I do:
ftp localhost

It reported an error with the config file - so I removed the tcp_wrappers and listen parameters and tried again. This time I connected ok and was chrooted to my local directory - GREAT!!

BUT, if I use the sftp client to connect (ie)

sftp username@localhost

I can log in ok, but can still cd to anywhere I like - meaning that the control of the CHROOT is in the hands of the user (and potential hacker) - ie if they abide by the rules and just use ftp to connect, then fine but if they use sftp, they can do anything they like.

Is that correct? It seems like a hole to me...the secure ftp ignores the chrooting...

(I think I have been sftp to do my tests all along, and only this evening used ftp by mistake!)
 
Old 10-15-2003, 03:08 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
That explains it.

sftp use sshd (actullay sftp-server a subsystem of sshd). This has nothing to do with vsftpd. I've never tried to chroot an sftpd connection Perhaps there is an options in the sshd_config file. Take a look around:
http://www.openssh.com/
 
Old 10-16-2003, 02:41 AM   #9
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Original Poster
Rep: Reputation: 15
Dave - thanks for your help so far.
But isn't this a major flaw? I can configure my server to act in a certain way and to be 'secure' - but then all of that is disregarded depending upon what client the USER runs?

We wanted to allow third parties to access our 'secure' VSFTD server, but if the security depends on what the user runs, then there is no security.....or have I misread this?
 
Old 10-16-2003, 01:50 PM   #10
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
It has nothing to do with client. You are using 2 different services.

vsftpd is a standard ftp server that works with standard ftp clients - it does not handle sftp. sftp connections are handled by the sshd service. If you disable vsftpd you will still be able to connect with sftp.
 
Old 10-17-2003, 02:25 AM   #11
SteveT
Member
 
Registered: Oct 2003
Location: South East UK
Distribution: Fedora Core 16
Posts: 69

Original Poster
Rep: Reputation: 15
Dave,
I had got that. What I meant was (probably not very well explained) - I spend time setting up VSFTP - I already have SSH running.... now I assume that I'm secure as FTP will go via VSFTP and I only expect to use SSH for telnet clones - again secure. Then just by chance/malicious attack, someone uses SFTP as the client - which then bypasses all my security! I have now seen in the SSHD config that I can stop the SFTP service there.
I suppose it's my fault for not knowing all the services that SSHD provides. I now have the option of ignoring the VSFTPD completely and just run with SSH (as long as I can find how to setup the CHROOTing)....

Thanks again for your input.
 
  


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.conf/chroot/vsftpd.chroot_list issue Jerman Linux - Security 2 06-01-2007 07:24 PM
vsftpd and chroot bstempi Linux - Security 10 11-08-2005 02:56 PM
VSFTPD chroot problem cwolf78 Linux - Software 1 05-08-2005 11:24 AM
vsftpd and chroot gbj Linux - Networking 3 03-08-2005 02:47 AM
URGENT!: vsftpd chroot config wont take changes. Major business depends on this. Help CrewXp Linux - Newbie 5 01-02-2004 07:27 PM

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

All times are GMT -5. The time now is 10:33 AM.

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