vsftpd as ftp server

本文介绍如何安装及配置VSFTPD服务,通过禁用匿名登录、启用本地用户登录等方式,设置特定用户组拥有只读权限访问指定目录下载文件,并确保文件的安全性和完整性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

You can edit the vsftpd configuration file,/etc/vsftpd.conf, to change the default settings.

0)sudo apt-get install vsftpd

In this example, anonymous FTP is not desired, but a group of trusted

users need to have read only access to a directory for downloading
files. Here are the steps:

1) Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file like this:

# Allow anonymous FTP? anonymous_enable=NO


2) Enable individual logins by making sure you have the local_enable line uncommented in the vsftpd.conf file like this:

# Uncomment this to allow local users to log in. local_enable=YES


3) Start VSFTP.

[root@bigboy tmp]# service vsftpd start


4) Create a user group and shared directory. In this case, use /home/ftp-users and a user group name of ftp-users for the remote users

[root@bigboy tmp]# groupadd ftp-users [root@bigboy tmp]# mkdir /home/ftp-docs


5) Make the directory accessible to the ftp-users group.

[root@bigboy tmp]# chmod 750 /home/ftp-docs [root@bigboy tmp]# chown root:ftp-users /home/ftp-docs


6) Add users, and make their default directory /home/ftp-docs

[root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user1 [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user2 [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user3 [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user4 [root@bigboy tmp]# passwd user1 [root@bigboy tmp]# passwd user2 [root@bigboy tmp]# passwd user3 [root@bigboy tmp]# passwd user4


7) Copy files to be downloaded by your users into the /home/ftp-docs directory


8) Change the permissions of the files in the /home/ftp-docs directory for read only access by the group

[root@bigboy tmp]# chown root:ftp-users /home/ftp-docs/* [root@bigboy tmp]# chmod 740 /home/ftp-docs/*

Users should now be able to log in via FTP to the server using their new usernames and passwords. If you absolutely don't want any FTP users to be able to write to any directory, then you should set the write_enable line in your vsftpd.conf file to no:
write_enable = NO


9)Remember, you must restart VSFTPD for the configuration file changes to take effect.

sudo /etc/init.d/vsftpd restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值