linux上安装配置vsftpd

时间:2024-12-18 12:36:44

启动:

/usr/sbin/vsftpd &

端口占用:

lsof -i:21

位置:

whereis vsftpd

默认配置下,匿名用户登录 vsftpd 服务后的根目录是 /var/ftp/;
系统用户登录 vsftpd 服务后的根目录是系统用户的家目录。
若要修改登录 vsftpd 服务后的根目录,只要修改 /etc/vsftpd/vsftpd.conf 文件即可。
假设要把 vsftpd 服务的登录根目录调整为 /vae/www/html,可加入如下三行:
 local_root=/var/www/html
chroot_local_user=YES
anon_root=/var/www/html
注解:local_root 针对系统用户;anon_root 针对匿名用户。
 
编辑 vsftpd.conf 文件后,保存退出,参照如下指令重新启动服务: service vsftpd restart
之后 ftp 客户端登陆 vsftpd 服务后,其根目录是 /var/www/html。 
Apache:
/usr/local/apache2/htdocs

Creating an FTP Account within Linux.

For this example, I am using Vsftpd, as it is the default FTP client distributed with RedHat, however these instructions should apply to most FTP server applications.

Create a FTP user group. eg: ftpaccounts
/usr/sbin/groupadd ftpaccounts

Add a new user to this group, and set the default path of that user to /home/user/.
/usr/sbin/adduser -g ftpaccounts -d /home/user/ testuser

Set a password for the newley created user.
passwd testuser

Set ownership of /home/user to the testuser and ftpaccounts.
chown testuser:ftpaccounts /home/user

Give Read/Write access to testuser and all members in ftpaccounts
chmod 775 /home/user

Edit /etc/vsftpd/vsftpd.conf file and make sure 'local_enable=YES' is uncommented.

Restart the vsftpd service.
/etc/init.d/vsftpd restart