FTP服务器搭建

使用Linux搭建FTP服务器
Linux版本:rhel-server-6.4-i386
镜像文件:rhel-server-6.4-i386-dvd.iso
步骤一:挂载光盘
字符界面:
mount /dev/sr0 /media
mount 出现如下界面则挂载成功

图形界面:
首先取消挂载然后重新挂载
取消挂载:umount /dev/sr0
然后再执行上述挂载步骤
步骤二:搭建yum服务器
cd /etc/yum.repos.d/
rm -f *
touch test.repo
使用编辑器打开test.repo内容如下:
[test]
name=yum
baseurl=file:///media
enabled=1
gpgcheck=0
保存退出
步骤三:安装ftp软件
yum -y install vsftpd
yum -y install ftp
步骤四:配置FTP服务器
配置前注意事项:
关闭防火墙、关闭selinux
新手可以直接关闭防火墙,命令:
iptables -F
懂防火墙配置的也可以配置防火墙,允许FTP请求通过
关闭selinux:
配置文件位置:/etc/selinux/config
更改项:SELINUX=disabled
注:selinux更改完成后需要重启系统才能生效

FTP配置文件:/etc/vsftpd/vsftpd.conf
配置选项:
anonymous_enable=YES :启用匿名用户
anon_umask=022 :匿名用户上传的权限掩码
anon_upload_enable=YES :允许匿名用户上传

local_enable=YES :是否启用本地用户
chroot_local_user=YES :是否将用户禁锢在主目录
listen=yes :监听端口
download_enable=YES

userlist_enable=YES :是否启用user_list列表文件
userlist_deny=YES :是否禁用user_list中的用户

修改配置文件后一定要重启服务,配置才能生效

步骤五:测试
[root@www ~]# ftp 192.168.209.111
Connected to 192.168.209.111 (192.168.209.111).
220 (vsFTPd 2.2.2)
Name (192.168.209.111:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,209,111,169,74).
150 Here comes the directory listing.
drwxr-xr-x 2 14 0 4096 Jun 26 14:12 pub
226 Directory send OK.
ftp> cd pub
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,209,111,199,242).
150 Here comes the directory listing.
-rw-r–r– 1 0 0 0 Jun 26 11:52 1.txt
226 Directory send OK.
ftp> get 1.txt
local: 1.txt remote: 1.txt
227 Entering Passive Mode (192,168,209,111,180,185).
150 Opening BINARY mode data connection for 1.txt (0 bytes).
226 Transfer complete.
ftp> put 3.txt
local: 3.txt remote: 3.txt
227 Entering Passive Mode (192,168,209,111,161,119).
150 Ok to send data.
226 Transfer complete.
ftp>
搭建成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值