3 Star 22 Fork 10

Samuel Yuan / riscv-openeuler-visionfive

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Test-ftp-service-for-openeuler-on-visionfive.md 3.57 KB
一键复制 编辑 原始数据 按行查看 历史
Samuel Yuan 提交于 2022-10-24 11:39 . update

操作手册:Test ftp service for openeuler on visionfive


1 目标

在visionfive开发板上,安装并测试vsftpd。

2 系统安装

参考前面的教程: 操作手册:Verify firefox for openeuler on visionfive

以上链接的镜像中linux kernel为5.18,没有声音,不支持docker,只有openeuler的文件系统可用。也可参考操作手册:Test docker for openeuler on visionfive将linux kernel 更新为5.19。

3 安装vsftpd

查看openeuler源中是否有安装文件

[root@openEuler-riscv64 etc]# yum list vsftpd
Last metadata expiration check: 2:26:15 ago on Tue 27 Sep 2022 04:45:54 AM UTC.
Available Packages
vsftpd.riscv64                     3.0.3-33.oe2203                      mainline

直接安装vsftpd

yum install -y vsftpd

查看安装位置

[root@openEuler-riscv64 etc]# whereis vsftpd
vsftpd: /usr/sbin/vsftpd /etc/vsftpd

设置FTP服务开机自启动

systemctl enable vsftpd.service

启动FTP服务

systemctl start vsftpd.service

查看FTP服务监听的端口

[root@openEuler-riscv64 etc]# netstat -antup | grep ftp
tcp6       0      0 :::21                   :::*                    LISTEN      3210/vsftpd

4 配置vsftpd

在/etc/vsftpd中vsftpd.conf为主配置文件;ftpusers指定不能访问FTP服务器的用户,包括root;user_list指定的用户是否可以访问ftp服务器,可在vsftpd.conf中配置userlist_enable=YES。

修改vsftpd.conf配置文件

vi /etc/vsftpd/vsftpd.conf

加入如下配置,设置路径等配置

#config
local_root=/var/ftp/test

完成修改后,查看主配置文件的配置

[root@openEuler-riscv64 vsftpd]# cat /etc/vsftpd/vsftpd.conf |grep -v '^#';
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
local_root=/var/ftp/test

5 创建用户

查看用户情况

cat /etc/passwd

可以观察到其中有ftp这个用户,但我们不采用这个用户来测试。为FTP服务创建一个专门的Linux用户来进行测试。

adduser ftptest

修改ftptest用户的密码为ftptest

passwd ftptest

创建测试文件

mkdir /var/ftp/test
touch /var/ftp/test/testfile.txt

更改/var/ftp/test目录的拥有者为ftptest

chown -R ftptest:ftptest /var/ftp/test

设置用户只能ftp不能登入

usermod -s /sbin/nologin ftptest

对应的,需要修改相关配置

vi /etc/pam.d/vsftpd

将auth required pam_shells.so修改为auth required pam_nologin.so

重启vsftpd服务

systemctl restart vsftpd.service

6 测试vsftpd

远程host主机访问开发板vsftpd服务,能看到如下界面:

Image

上传一个图片文件,能看到如下界面:

Image

也可以进入/usr/share/nginx/html更新上传网页文件:

Image

测试成功!

7 参考资料

https://blog.csdn.net/wqh0830/article/details/87795709

https://help.aliyun.com/document_detail/92048.htm?spm=a2c4g.11186623.0.0.fdf045ccsF3UT6#section-t9a-ors-44c

Shell
1
https://gitee.com/samuel_yuan/riscv-openeuler-visionfive.git
git@gitee.com:samuel_yuan/riscv-openeuler-visionfive.git
samuel_yuan
riscv-openeuler-visionfive
riscv-openeuler-visionfive
master

搜索帮助