linux 里的ftp安装与配置

一、检查FTP 是否存在

方法1、

[root@print-server /]# service vsftpd start

如果没有安装的话会提示:vsftpd: 未被识别的服务

 

方法2、(如果是用rpm包安装的)

[root@print-server /]#rpm -q vsftpd

已安装提示: ftp的版本信息

未安装提示:package vsftpd is notinstalled

 

二、安装FTP

这里是用的yum命令安装(比较省力~~),下面是执行过程

[root@print-server /]#yum -y install vsftpd


Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
http://data.nicehosting.co.kr/os/CentOS/6.0/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 403 : http://data.nicehosting.co.kr/os/CentOS/6.0/os/x86_64/repodata/repomd.xml
Trying other mirror.
base                                                     | 3.7 kB     00:00
http://data.nicehosting.co.kr/os/CentOS/6.0/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 403 : http://data.nicehosting.co.kr/os/CentOS/6.0/extras/x86_64/repodata/repomd.xml
Trying other mirror.
extras                                                   |  951 B     00:00
http://data.nicehosting.co.kr/os/CentOS/6.0/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 403 : http://data.nicehosting.co.kr/os/CentOS/6.0/updates/x86_64/repodata/repomd.xml
Trying other mirror.
updates                                                  | 3.5 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-6.el6_0.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch           Version                    Repository       Size
================================================================================
Installing:
 vsftpd         x86_64         2.2.2-6.el6_0.1            updates         150 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 150 k
Installed size: 331 k
Downloading Packages:
vsftpd-2.2.2-6.el6_0.1.x86_64.rpm                        | 150 kB     00:04
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd-2.2.2-6.el6_0.1.x86_64                            1/1

Installed:
  vsftpd.x86_64 0:2.2.2-6.el6_0.1

Complete!

到这里FTP已经安装完了

 

三、配置FTP

到现在为止我们已经成功的安装了FTP,但是还需要一些简单的配置才可以正常的运行。

1、将/etc/vsftpd/user_list文件和/etc/vsftpd/ftpusers文件中的root这一行注释掉

2、执行以下命令

[root@print-server /]# setsebool -Pftpd_disable_trans=1  

3、修改/etc/vsftpd/vsftpd.conf,在最后一行处添加local_root=/

4、重启ftp (在修改完ftp的配置文件后一定重启ftp服务)

[root@print-server /]# service vsftpd restart

 

重启完之后就可以正常使用了。

 

 

四、附录

FTP相关配置文件详解:http://blog.csdn.net/liuensong/article/details/6728518

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Linux上安装和配置FTP服务器,你可以按照以下步骤进行操作: 1. 安装FTP服务器软件: a. 对于vsftpd服务器,请运行以下命令进行安装: ```shell sudo apt-get update sudo apt-get install vsftpd ``` b. 对于ProFTPD服务器,请运行以下命令进行安装: ```shell sudo apt-get update sudo apt-get install proftpd ``` 2. 配置FTP服务器: a. 对于vsftpd服务器,在终端中使用文本编辑器打开 `/etc/vsftpd.conf` 文件: ```shell sudo nano /etc/vsftpd.conf ``` b. 对于ProFTPD服务器,在终端中使用文本编辑器打开 `/etc/proftpd/proftpd.conf` 文件: ```shell sudo nano /etc/proftpd/proftpd.conf ``` 3. 根据需要进行配置: - 你可以设置是否允许匿名访问,通过编辑配置文件中的 `anonymous_enable` 选项来控制。 - 如果你想允许本地用户登录,确保 `local_enable` 选项设置为 `YES`。 - 设置 `write_enable` 选项为 `YES` 可以允许用户上传文件。 - 若要限制用户的访问权限,可以使用 `chroot_local_user` 选项。 - 其他配置选项可以根据需要进行调整。 4. 保存并关闭文件,然后重新启动FTP服务器。 - 对于vsftpd服务器,请运行以下命令: ```shell sudo systemctl restart vsftpd ``` - 对于ProFTPD服务器,请运行以下命令: ```shell sudo systemctl restart proftpd ``` 5. 防火墙配置: a. 如果你使用的是Ubuntu的ufw防火墙,你可以运行以下命令开启FTP的数据传输端口: ```shell sudo ufw allow 20/tcp sudo ufw allow 21/tcp ``` b. 如果你使用的是CentOS的firewalld防火墙,你可以运行以下命令开启FTP的数据传输端口: ```shell sudo firewall-cmd --permanent --add-port=20/tcp sudo firewall-cmd --permanent --add-port=21/tcp sudo firewall-cmd --reload ``` 现在你已经安装和配置了FTP服务器。你可以使用FTP客户端连接到服务器,并进行文件传输和管理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值