安装 ftp
<h2>安装vsftpd</h2>
<pre><code class="language-shell">yum -y install vsftpd</code></pre>
<h2>查看vsftpd启动情况</h2>
<pre><code class="language-shell">chkconfig --list | grep vsftpd</code></pre>
<h2>启动vsftpd</h2>
<pre><code class="language-shell">/etc/init.d/vsftpd restart</code></pre>
<h2>新增加系统用户ftptest</h2>
<pre><code class="language-shell"># 增加新用户ftptest不让在本机登陆
seradd -d /var/www -s /sbin/nologin ftptest
# 更改新增目录的权限,只允许ftptest访问此目录;
chown -R ftptest /var/www
# 为www目录及其子目录设置权限
chmod 777 -R /var/www
# 为用户设置密码
passwd ftptest</code></pre>
<h2>修改vsftpd.conf 禁止匿名帐号登陆及允许自建帐号登陆</h2>
<pre><code class="language-shell">vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
chroot_list_file=/etc/vsftpd/chroot_list # 去掉注释
# 修改/etc/vsftpd/chroot_list,添加ftptest 帐号允许该帐号登陆FTP服务器
vim /etc/vsftpd/chroot_list
# 输入ftptest</code></pre>
<h2>在linux Shell 命令模式下</h2>
<pre><code class="language-shell"># 关闭掉Selinux 对ftp服务的保护;
setsebool ftpd_disable_trans 1
# vi /etc/selinux/config
SELINUX=disabled //将此处设置为Disable</code></pre>
<h2>重启服务</h2>
<pre><code class="language-shell">/etc/init.d/vsftpd restart</code></pre>