nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Secure vsftpd FTP permissions on anonymous user uploads

This is a discussion on Secure vsftpd FTP permissions on anonymous user uploads within the Getting started tutorials forums, part of the Linux Getting Started category; You can configure vsftpd server to set permissions on anonymous uploads. anonymous uploads can be very dangerous if not used ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19-12-2006, 03:26 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default Secure vsftpd FTP permissions on anonymous user uploads

You can configure vsftpd server to set permissions on anonymous uploads. anonymous uploads can be very dangerous if not used correctly.

Open your vsftpd config file:
Code:
vi /etc/vsftpd/vsftpd.conf
Now add/modify following anonymous uplod specific option
Code:
local_enable=YES 
write_enable=YES 
nopriv_user=ftp
anonymous_enable=YES 
anon_upload_enable=YES
chown_uploads=YES 
chown_username=inftpadm  
ftp_username=inftpadm
local_umask=002 
anon_umask=007 
file_open_mode=0666
Where,
  • ftp_username=inftpadm : This is the name of the user we use for handling anonymous FTP. The home directory of this user is the root of the anonymous FTP area.
  • chown_username=inftpadm : This is the name of the user who is given ownership of anonymously uploaded files. This option is only relevant if another option, chown_uploads, is set to YES.
  • chown_uploads=YES : This is a security and administrative feature. It enabes, all anonymously uploaded files will have the ownership changed to the user specified in the setting chown_username i.e inftpadm.
Above configuration make sure that all anonymously uploaded files owned by inftpadm user with read/write permission for the inftpadm user only.

Following are general config option
Code:
tcp_wrappers=YES
xferlog_enable=YES 
listen=YES 
pam_service_name=vsftpd 
userlist_enable=YES 
dirmessage_enable=YES 
xferlog_std_format=YES 
connect_from_port_20=YES 
ls_recurse_enable=YES 
chroot_local_user=YES
Save and restart server.
Code:
# /etc/init.d/vsftpd restart
Test configuration login as anonymous user and later running ls -l command.

Further readings
=> VSFTP chroot or jail users - limit users to only their home directory howto: http://www.cyberciti.biz/tips/vsftp-...directory.html
=> VSFTPD docs : http://vsftpd.beasts.org/vsftpd_conf.html
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #2 (permalink)  
Old 19-12-2006, 03:44 AM
B!n@ry's Avatar
Senior Member
User
 
Join Date: Dec 2006
Location: B!n@ry-z0ne
OS: Ojuba 3
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

a good start nixCraft, only that unfortunetly the vsftpd has lots of exploits vs to pure-ftpd.

And by the way I do not encourge using the anonymous upload issue, but using the users-base upload much better and more secure + easy to trace. Also I use the jail and use the local_root option to specify a fixed upload area.

Sticky bit and SGID are very useful here if you are using it for a group
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #3 (permalink)  
Old 19-12-2006, 04:10 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default

B!n@ry,

Quote:
a good start nixCraft, only that unfortunetly the vsftpd has lots of exploits vs to pure-ftpd.
I don't think so, it is totally true. Look at ftp.openbsd.org , ftp.redhat.com and there are 100s of public ftp server out there. All runs using VSFTPD. I never saw any one of them hacked or owned by crackers. Do you have any documentation supporting your claim. I am interested to learn more about this issue.

Quote:
And by the way I do not encourge using the anonymous upload issue, but using the users-base upload much better and more secure + easy to trace. Also I use the jail and use the local_root option to specify a fixed upload area.
I must agree with you about jail. But sometime you need to allow anonymous upload. Examples open source software which allows uploading patch.

To set chroot just add an option in vsftpd.conf file
Code:
chroot_local_user=YES
__________________
May the force with you!
Reply With Quote
  #4 (permalink)  
Old 19-12-2006, 04:16 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

B!n@ry/Monk good points about jailing user, just updated post. Keep the information coming
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #5 (permalink)  
Old 19-12-2006, 02:01 PM
B!n@ry's Avatar
Senior Member
User
 
Join Date: Dec 2006
Location: B!n@ry-z0ne
OS: Ojuba 3
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

To use the local_root option to share the /var/ftp/pub/share directory add the following:
Code:
local_root=/var/ftp/pub/share
For me I also add the sticky bit and the SGUID to the directory share

Code:
chroot_local_user=YES
This option shall jail each user defined on the system to his home directory

Yes monk, not every time you disable the anonymous your right with that... But about the pure-ftpd issue this is what I got from asking alot of admin's for me ? I never use somthing rather than vsftpd. Anyway I shall see about the exploit issue and come back to this.
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #6 (permalink)  
Old 20-12-2006, 12:04 AM
Junior Member
User
 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
SoFy
Default

good job niXcrafT .

but I prefer pure-ftpd , Pure-ftpd support IPV6 , PAM , local domains..etc
Reply With Quote
  #7 (permalink)  
Old 20-12-2006, 02:00 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
Default

Quote:
Originally Posted by SoFy
good job niXcrafT .

but I prefer pure-ftpd , Pure-ftpd support IPV6 , PAM , local domains..etc
Most of these features supported by vsftpd too :P

May be you are comfarable with pure-ftpd
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Adding Users in Bulk + Passwords and permissions ricksd2sd Shell scripting 0 23-04-2008 12:20 PM
Jailing vsftpd user to home directory grifs71 CentOS / RHEL / Fedora 2 26-12-2007 12:56 AM
secure smtp and secure POP shaun_s Mail Servers 0 11-12-2007 06:56 PM
Ubuntu Linux folder permissions myfoot Ubuntu / Debian 1 01-12-2007 08:03 PM
What is the best way to secure mount point? chiku Linux software 1 03-06-2005 11:40 PM


All times are GMT +5.5. The time now is 04:17 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38