站长杂谈

关于在Linux服务器上安装配置VSTPD详解

时间:2017-06-19 17:08 点击:

  关于在Linux服务器上安装配置VSTPD详解

  VSTPD(Very Secure File Transport Protocol Daemon)是用于Unix/Linux系统安全,快速的FTP服务器。在本文中,让我们看看如何在CentOS 7上设置基本的FTP服务器。但是,这个过程在RHEL CentOS,Scientific Linux 7版本上也可能很好。VSTPD对于我们新世界主机香港服务器或美国服务器的用户来说一个很好的文件共享工具,用户可以在多个不同的服务器之间共享文件。所以今天小编就介绍如何在Linux服务器上安装配置VSTPD。在教程中小编的主机名和IP分别是server.unixmen.local和192.168.1.101/24,你可以根据自己的情况来做相应的更改。

  (1)安装vsftpd

  所有命令都应该使用"root"用户运行。在终端中运行以下命令来安装vsftpd包: yum install vsftpd ftp -y

  (2) 配置vsftpd

  编辑vsftpd配置文件/etc/vsftpd/vsftpd.conf,

  vi /etc/vsftpd/vsftpd.conf

  找到以下几行,并进行如下更改:

  ## Disable anonymous login ##

  anonymous_enable=NO

  ## Uncomment ##

  ascii_upload_enable=YES

  ascii_download_enable=YES

  ## Uncomment - Enter your Welcome message - This is optional ## ftpd_banner=Welcome to UNIXMEN FTP service.

  ## Add at the end of this file ##

  use_localtime=YES

  启动vsftpd服务:

  systemctl enable vsftpd

  systemctl start vsftpd

  (3)允许ftp服务和端口21通过防火墙。

  firewall-cmd --permanent --add-port = 21 / tcp

  firewall-cmd --permanent --add-service = ftp

  重新启动防火墙:

  firewall-cmd -reload

  然后,更新FTP服务的SELinux布尔值:

  setsebool -P ftp_home_dir on

  (4)创建FTP用户

  默认情况下,为了安全起见,root用户不能登录到ftp服务器。所以,让我们用密码"centos"创建一个名为"sk"的普通测试用户。

  useradd sk

  passwd sk

  (5)连接到FTP服务器 现在,尝试使用用户"sk"连接到FTP服务器本身:

  ftp 192.168.1.101

  输入ftp用户名和密码。 样品输出:

  Connected to 192.168.1.101 (192.168.1.101).

  220 Welcome to UNIXMEN FTP service.

  Name (192.168.1.101:root): sk

  331 Please specify the password.

  Password: 230 Login successful.

  Remote system type is UNIX.

  Using binary mode to transfer files.

  ftp>

  恭喜!您将能够登录到FTP服务器。

  (6)客户端配置 让我们尝试从Ubuntu客户端系统登录到FTP服务器。

  ftp 192.168.1.101

  样品输出:

  Connected to 192.168.1.101.

  220 Welcome to UNIXMEN FTP service.

  Name (192.168.1.101:sk): sk

  331 Please specify the password.

  Password: 230 Login successful.

  Remote system type is UNIX.

  Using binary mode to transfer files.

  ftp>

  出现上述信息,表示FTP服务器正在运行。

  (7)通过FileZilla访问FTP服务器

  在命令行模式下工作可能对新手来说有点困难。所以让我们安装一个名为Filezilla的图形化FTP客户端,使事情变得更容易:

  首先,逐个输入以下命令,禁用当前的防火墙系统firewalld,并启用旧的防火墙iptables。以下命令应该在FTP服务器上运行,而不是ftp客户端。

  yum install iptables-services

  systemctl mask firewalld

  systemctl enable iptables

  systemctl enable ip6tables

  systemctl stop firewalld

  systemctl start iptables

  systemctl start ip6tables

  通过防火墙或路由器允许默认的ftp端口"21"。在服务器端,执行以下操作。 编辑文件/ etc / sysconfig / iptables,

  vi /etc/sysconfig/iptables

  添加以下行:

  [...]

  -A INPUT -m state --state NEW -mtcp -p tcp --dport 21 -j ACCEPT

  [...]保存并退出文件。现在重启iptables:

  systemctl restart iptables

  systemctl restart ip6tables现在,回到你的客户端系统,并安装filezilla包。

  基于Debian的客户端系统:

  sudo apt-get install filezilla

  对于基于RHEL的系统,可以使用以下命令安装filezilla:

  yum install filezilla

  从您的客户端系统"破折号"或"菜单"打开Filezilla客户端。输入FTP服务器主机名或IP地址,用户名,密码和端口号。点击"快速连接"登录。

  至此,关于vsftpd就介绍到这里,如果您还有什么不明确或不懂的地方,欢迎来新世界主机咨询了解,详情请咨询Skype:vpssj.net@hotmail.com TEL:400 1109 210。我们必将竭诚为您服务。