引用自:
http://www.linuxsir.org/main/?q=node/152#5
4、vsFTPd的服务器的启动和关闭;
vsFTPd服务器启动和关闭是极容易的;我们可以直接把服务器运行调到后台运行;这是几乎所有服务器管理的运行方式;
4.1、vsFTPd服务器启动和关闭的通用方法;
运行vsftpd命令,要用到root权限,如果您当前操作用户并非是root,可以用su切换到root权限;关于root权限的切换,您有两种方式,一种是su,另一种是sudo;请参考: 《Linux 系统中的超级权限的控制》
vsFTPd服务器的运行;
[root@localhost ~]# /usr/sbin/vsftpd &
[root@localhost ~]# /usr/local/sbin/vsftpd &
vsFTPd服务器是否运行起来;
我们可以通过pgrep vsftpd 来查看vsftpd是否运行起来;
[root@localhost ~]# pgrep vsftpd
4248
上面显示vsFTPd服务器运行起来了,您可以通过ftp命令、lftp工具或gftp或其它的FTP客户端来测试连接;
vsFTPd 服务器关闭:
我们用pkill vsftpd 来杀死vsftpd进程,这样就把vsFTPd关闭,用psgrep vsftpd 来查看进程,如果没有进程,证明vsFTPd已经关掉;当然也要用到root权限。
[root@localhost ~]# pkill vsftpd
[root@localhost ~]# pgrep vsftpd
5、vsFTPd的服务器和防火墙及SELINUX的关系;(重要)
我在论坛上看到有些弟兄说vsFTPd服务器启动正常,但却不能访问或用户不能上传文件,我感觉应该是防火墙或SELINUX的事;可能FTPD服 务器被防火墙或SELINUX的安全机制防住了。所以您必须要让防火墙通过ftp,当然也要让SELINUX通过ftp服务器才行;
在Fedora/Redhat/CentOS中,您要设置一下防火墙,可以把防火墙关掉,或者在自定义中让ftp “通过”防火墙;
[root@localhost ~]# system-config-securitylevel-tui
或者运行一下如下的命令,清除防火墙规则(通用);
[root@localhost beinan]# iptables -F
关于SELINUX服务器的解说 ,可能老手或新手对SELINUX都有点麻烦,建议您SELINUX;或者让vsFTPd服务器跳过SELINUX启动;也就是说要用到 4.1、vsFTPd服务器启动和关闭的通用方法; ;这在Fedora/Redhat/CentOS中这样启动vsFTPd服务器是有效的;
当然您可也可以关掉SELINUX,在/etc/selinux/config 配置文件如下;
/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=Disabled #这样就把SELINUX服务器关掉了,请重新启动系统;
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted