nixCraft Linux Forum

nixCraft

Linux 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

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-19-2006, 03:26 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 910
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-19-2006, 03:44 AM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
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 12-19-2006, 04:10 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 481
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
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 12-19-2006, 04:16 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 910
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #5 (permalink)  
Old 12-19-2006, 02:01 PM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
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 12-20-2006, 12:04 AM
Junior Member
 
Join Date: Dec 2006
Posts: 3
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 12-20-2006, 02:00 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 481
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
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

Bookmarks


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 On

Similar Threads

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


All times are GMT +5.5. The time now is 05:06 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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