centos 7.9 安装 ftp 传输文件

ftp server 端

复制代码
sudo yum install vsftpd ftp

其中 vsftpd 为 ftp server 端,ftp 包含 ftp 这个客户端命令。

复制代码
# sudo rpm -ql vsftpd

/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/lib/systemd/system-generators/vsftpd-generator
/usr/lib/systemd/system/vsftpd.service
/usr/lib/systemd/system/vsftpd.target
/usr/lib/systemd/system/vsftpd@.service
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-3.0.2
/usr/share/doc/vsftpd-3.0.2/AUDIT
/usr/share/doc/vsftpd-3.0.2/BENCHMARKS
/usr/share/doc/vsftpd-3.0.2/BUGS
/usr/share/doc/vsftpd-3.0.2/COPYING
/usr/share/doc/vsftpd-3.0.2/Changelog
/usr/share/doc/vsftpd-3.0.2/EXAMPLE
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-3.0.2/FAQ
/usr/share/doc/vsftpd-3.0.2/INSTALL
/usr/share/doc/vsftpd-3.0.2/LICENSE
/usr/share/doc/vsftpd-3.0.2/README
/usr/share/doc/vsftpd-3.0.2/README.security
/usr/share/doc/vsftpd-3.0.2/REWARD
/usr/share/doc/vsftpd-3.0.2/SECURITY
/usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST
/usr/share/doc/vsftpd-3.0.2/SIZE
/usr/share/doc/vsftpd-3.0.2/SPEED
/usr/share/doc/vsftpd-3.0.2/TODO
/usr/share/doc/vsftpd-3.0.2/TUNING
/usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

ftp server 配置

vi /etc/vsftpd/vsftpd.conf

复制代码
userlist_deny=NO

该文件追加上面一行,启动白名单服务

vi /etc/vsftpd/user_list

复制代码
oracle

该文件追加 oracle 用户,白名单。每一行就是一个登录用户,

vi /etc/vsftpd/ftpusers

复制代码

该文件保持不变,黑名单。里面的用户不能登录ftp

黑名单的优先级比白名单高,同时加入黑名单和白名单的用户会登不上。

复制代码
systemctl restart vsftpd 

systemctl status vsftpd 


netstat -lntp | grep 21

ftp client 上传文件

在 client 端执行 ftp 命令登录 server 端

复制代码
$ ftp 192.168.56.105
Connected to 192.168.56.105 (192.168.56.105).
220 (vsFTPd 3.0.2)
Name (192.168.56.105:oracle): oracle
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/home/oracle"
ftp> 
ftp> binary
200 Switching to Binary mode.

一定要在 binary 模式下操作

复制代码
ftp> put /oradata/tbs_01.dbf  /oradata/tbs_01.dbf

或者

复制代码
ftp> prompt
Interactive mode off.

ftp> mput /oradata/tbs*.dbf  

ftp client 下载文件

复制代码
ftp> get /oradata/tbs_01.dbf  /tmp/tbs_01.dbf 

或者

复制代码
ftp> prompt
Interactive mode off.

ftp> mget /oradata/tbs*.dbf  
相关推荐
2401_8582861116 分钟前
OS15.【Linux】gdb调试器的简单使用
linux·运维·服务器·开发语言·gdb
行止63 小时前
OpenStack云平台管理
linux·openstack
岁岁岁平安4 小时前
CentOS-7-x86_64解决:使用NAT模式无法ping通www.baidu.com或无法ping 8.8.8.8问题。
linux·运维·centos·centos-7
运维小贺4 小时前
各服务器厂商调整BIOS睿频教程
linux·运维·服务器·性能优化
特种加菲猫4 小时前
指尖上的魔法:优雅高效的Linux命令手册
linux·笔记
★Orange★4 小时前
Linux Kernel kfifo 实现和巧妙设计
linux·运维·算法
bemyrunningdog5 小时前
Mock数据
linux·运维·ubuntu
是阿建吖!5 小时前
【Linux | 网络】网络编程套接字
linux·网络
退役小学生呀5 小时前
十、K8s集群资源合理化分配
linux·云原生·容器·kubernetes·k8s
Winner13006 小时前
Debian、Buildroot 和 Ubuntu 都是基于 Linux 的系统区别
linux·ubuntu·debian