Linux挂系统iso载镜像安装vsftpd服务

7 篇文章 0 订阅

1.复制iso镜像到Linux系统 /home/iso/ 中


[root@localhost ~]# cd /home/iso/
[root@localhost iso]# ls
CentOS-8.4.2105-x86_64-dvd1.iso

2.创建挂载目标磁盘,挂载iso镜像,输入df -h查看挂载情况

[root@localhost /]# mkdir /mnt/cdrom
[root@localhost /]# mount /home/iso/CentOS-8.4.2105-x86_64-dvd1.iso  /mnt/cdrom/
mount: /mnt/hgfs: WARNING: device write-protected, mounted read-only.
[root@localhost /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G   18M   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sda3      1008G   24G  985G   3% /
/dev/sda1       295M  177M  119M  60% /boot
tmpfs           3.2G     0  3.2G   0% /run/user/0
tmpfs           3.2G  4.6M  3.2G   1% /run/user/1000
/dev/loop0      9.3G  9.3G     0 100% /mnt/cdrom
[root@localhost /]#

3.在/mnt/cdrom挂载磁盘下,搜索ftp,使用rpm指令安装。

[root@localhost /]# cd /mnt/cdrom/
[root@localhost cdrom]#
[root@localhost cdrom]#
[root@localhost cdrom]# find -name "*ftpd*"
./AppStream/Packages/vsftpd-3.0.3-33.el8.x86_64.rpm
[root@localhost cdrom]#
[root@localhost cdrom]#
[root@localhost cdrom]# rpm -ivh ./AppStream/Packages/vsftpd-3.0.3-33.el8.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.3-33.el8              ################################# [100%]
[root@localhost cdrom]#

4.检查是否安装成功

[root@localhost cdrom]# rpm -qa vsftpd
vsftpd-3.0.3-33.el8.x86_64
[root@localhost cdrom]#

5.检查vsftp服务状态,启动vsftp服务

[root@localhost ~]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@localhost ~]#
[root@localhost ~]# systemctl enable vsftpd
[root@localhost ~]#
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2023-12-22 10:42:20 CST; 2s ago
  Process: 4971 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 4972 (vsftpd)
    Tasks: 1 (limit: 204140)
   Memory: 776.0K
   CGroup: /system.slice/vsftpd.service
           └─4972 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Dec 22 10:42:20 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon...
Dec 22 10:42:20 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.
[root@localhost ~]#
[root@localhost ~]# ps -aux|grep vsftpd
root        4972  0.0  0.0  27056   424 ?        Ss   10:42   0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root       13648  0.0  0.0  12136  1092 pts/0    S+   11:31   0:00 grep --color=auto vsftpd
[root@localhost ~]#

6.创建用户ftptest


[root@localhost ~]# useradd ftptest

[root@localhost ~]#
[root@localhost ~]# passwd ftptest
Changing password for user ftptest.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#

7.设置ftpd_anon_write -> on

[root@localhost ~]# getsebool -a |grep ftpuser
[root@localhost ~]# getsebool -a |grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# setsebool -P ftpd_anon_write on
[root@localhost ~]# getsebool -a |grep ftp
ftpd_anon_write --> on
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off

8.修改ftptest用户所属路径

//给需要共享的文件夹赋可读,可写权限
[root@localhost vsftpd]# chmod -R 777 /data/shartFiles/ 
//先查询ftptest的uuid
[root@localhost vsftpd]# id ftptest
uid=1001(ftptest) gid=1001(ftptest) groups=1001(ftptest)
[root@localhost vsftpd]#
//修改ftpuser的主路径,等同于直接修改 /etc/passwd文件
[root@localhost vsftpd]# usermod -d /data/shartFiles/ -u 1001 ftptest
[root@localhost vsftpd]#

9.修改/etc/vsftpd/user_list名单,添加ftptest,同时修改/etc/vsftpd/vsftpd.conf,添加以下参数至vsftpd.conf文件末尾


[root@localhost vsftpd]# vim /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
ftptest
~

[root@localhost vsftpd]#vim /etc/vsftpd/vsftpd.conf

pam_service_name=vsftpd
userlist_enable=YES

allow_writeable_chroot=YES

pasv_min_port=30000
pasv_max_port=31000

userlist_file=/etc/vsftpd/user_list
userlist_deny=NO



10.千万不要在/etc/vsftpd/ftpusers里面添加ftptest用户,

ftp相关问题跳转

响应:500 OOPS: cannot change directory

响应:530 Permission denied

响应:553 Could not create file

FTP上传文件名称中文乱码问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值