设为首页 收藏本站
查看: 831|回复: 0

[经验分享] How To: Configure Secure FTP Server (VSFTPD)

[复制链接]

尚未签到

发表于 2018-10-24 09:21:10 | 显示全部楼层 |阅读模式
  This post is totally dedicated to vsftpd configuration with uploads enabled. vsftpd stands for Very Secure FTP Daemon. It is shipped with almost all the latest Red Hat based OS. vsftpd for rpm based Linux distros can be downloaded from here. Also, one can install vsftpd by issuing ‘yum install vsftpd’ or ‘apt-get install vsftpd’ command. After installing vsftpd, you just need to start the vsftpd service.
[root@bordeaux saini]$ service vsftpd start [Enter]  And you are done. Your computer is now a FTP server. You can browse your ftp server by pointing your favourite browser to ftp://localhost/ or ftp://127.0.0.1/ or ftp:// .

  If you see access denied or some error>  By default the files and directories in /var/ftp/ directory will be shown at ftp://localhost/ . Now, there are two ways to share your files on ftp.
  1. Copy/move files that you want to share to /var/ftp/ directory.
  2. Mount directories you want to share to /var/ftp/SharedDirName. Suppose you want to share /home/saini/Movies/ folder on your ftp, then follow the following steps:
Step 1
  Login as root.
1  
2
[saini@bordeaux saini]$ su [Enter]Enter Password for root.Step 2
  Go to /var/ftp/ and create the directory that you want to share.
1  
2
[root@bordeaux saini]$ cd /var/ftp/ [Enter][root@bordeaux ftp]$ mkdir SharedMovies [Enter]Step 3
  Bind the original directory to SharedMovies.
[root@bordeaux ftp]$ mount --bind /home/saini/Movies/ /var/ftp/SharedMovies/ [Enter]  If you browse your ftp now, you’ll see SharedMovies folder as well. You can remove default pub directory if you don’t like it.
  The current ftp server will be a very basic one and will allow only downloads. Below we will see how to configure it so that others are allowed to upload files/directories to your server.
Step 1
  Create a directory say ‘Upload’.
[root@bordeaux saini]$ mkdir Upload [Enter]  Note that this Upload directory can be anywhere either in your home directory or in /var/ftp/ or even on some other partitions.
Step 2
  Change the ownership of Upload to ftp and change the permissions to 777.
1  
2
[root@bordeaux saini]$ chown ftp:ftp Upload [Enter][root@bordeaux saini]$ chmod 777 Upload [Enter]Step 3
  If you created Upload at any place other than /var/ftp/ , then bind it to a dir in /var/ftp/ .
1  
2
[root@bordeaux saini]$ mkdir /var/ftp/Uploads [Enter][root@bordeaux saini]$ mount --bind /home/saini/Upload/ /var/ftp/Uploads/ [Enter]Step 4
  Configure vsftpd.conf . The default configuration files for vsftpd lives in /etc/vsftpd/ . vsftpd.conf is configuration file for vsftpd.
  Open /etc/vsftpd/vsftpd.conf in any editor and add/uncomment the following lines :
  Lines to be added or uncomments in /etc/vsftpd/vsftpd.conf
1  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
anonymous_enable=YES  
write_enable=YES
  
write_enable=YES
  
anon_upload_enable=YES
  
anon_mkdir_write_enable=YES
  
anon_other_write_enable=YES
  
dirmessage_enable=YES
  
dirlist_enable=YES
  
no_anon_password=YES
  
file_open_mode=0777
  
guest_enable=YES
  Save vsftpd.conf file and restart the vsftpd service with the command ‘service vsftpd restart’. Now anyone can upload files to your ftp server, but only to Upload folder.

  There are certain more configurations which are>1  
2
  
3
  
4
max_per_ip=2 # Max no. of allowed connections per IP Address.max_clients=3  
# Max no. of different IP Addressed which are allowed to connect.anon_max_rate=1097152 # Max bytes/sec a user can upload/download to/from your ftp server.banner_file=/etc/vsftpd/ftp_banner # The file containing the welcome message to be displayed to the clients.
  For more configuration options, refer man pages for vsftpd.conf and vsftpd.
  Note :

  •   Whenever you restart your computer, you have to bind the directories everytime, so that they are shown on the ftp server. To skip binding every time, write everything (all commands for binding) in a mount.sh file and run it whenever you restart your computer.
  •   You can view my vsftpd.conf file here.
  •   Sometime, uploaded files doesn’t have 777 permissions. You can run this shell scriptin background forever.



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-625740-1-1.html 上篇帖子: ubuntu server安装之后的整理工作 下篇帖子: ntp server工作原理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表