openSUSE环境下搭建ftp服务器

openSUSE环境下搭建ftp服务器

安装vsftpd服务

su zypper in vsftpd

启动服务并允许开机启动

systemctl enable vsftpd systemctl start vsftpd

创建ftp服务器文件夹

mkdir /srv/ftp 其他位置也可以,如果文件夹已经存在可以选则其他位置

创建ftp用户组

groupadd ftp-users

创建ftp用户

useradd -g ftp-users -d /srv/ftp/ ftper passwd ftper

修改ftp服务器路径权限

chmod 750 /srv/ftp chown ftper:ftp-users /srv/ftp

修改配置文件控制用户登陆

配置文件路径为/etc/vsftpd.conf 其他系统路径不一样

[...]
# Uncomment and  Set YES to enable write.
write_enable=YES
[...]
# Uncomment and Set banner name for your website
ftpd_banner=Welcome to Unixmen FTP service.
[...]
# Uncomment
ls_recurse_enable=YES
[...]
# Uncomment and set YES to allow local users to log in.
local_enable=YES
[...]
# To disable anonymous access, set NO.
anonymous_enable=NO
[...]
# Uncomment to enable ascii download and upload.
ascii_upload_enable=YES
ascii_download_enable=YES
[...]
## Add at the end of this  file ##
use_localtime=YES

重启服务使配置文件生效

systemctl restart vsftpd

登陆尝试

ftp localhost 输入用户名密码

修改防火墙配置使ftp允许远程登陆

yast2 -> Security and Users -> Firewall Allowed Services -> vsftpd services -> add

重启vsftpd服务,使配置文件生效

ls时报如下问题,暂未解决,但可以执行上传和下载

ftp> ls
229 Entering Extended Passive Mode (|||30099|).
150 Here comes the directory listing.
Table of Contents