Linux(Red Hat) ftp 问题解决大全

   RHEL安装好后,虽然通过SSH软件可以直接远程登录或ftp文件,但总体感觉不大方便,不够灵活。本文详述了如何开通ftp服务的步骤以及可能碰到的问题,仅供参考。


一、安装ftp服务

 环境:Red Hat 4.1

 安装:

1、root用户登录, 挂载安装光盘:#mount  /dev/cdrom  /mnt/cdrom,


2、进入/mnt/cdrom/Server 下,找到xinetd,vsftpd服务进行安装: 输入前几个字母,按 

     tab键,可联想出后面的命令,如有重复,连按两下tab键,可将所有重复的都列出。

       #rpm -ivh vsftpd-*.rpm  

       #rpm -ivh xinetd*.rpm 


3、root用户登录,编辑修改gssftp文件,开启ftp服务:

      #vi  /etc/xinetd.d/gssftp    

# default: off
# description: The kerberized FTP server accepts FTP connections \
# that can be authenticated with Kerberos 5.
service ftp
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/ftpd
server_args = -l           (原先的-1 -a改为-1)
log_on_failure += USERID
disable = no                 (原先的yes改为no)
}

修改好后,保存退出。


4、执行命令:#sestatus -b | grep ftp

[root@localhost xinetd.d]# sestatus -b | grep ftp

allow_ftpd_anon_write off

allow_ftpd_full_access off

allow_ftpd_use_cifs off

allow_ftpd_use_nfs off

ftp_home_dir    on          (由off修改为on,否则无法成功传输)

ftpd_disable_trans  on (同上)

ftpd_is_daemon onhttpd_enable_ftp_server off

tftpd_disable_trans off

修改命令:#setsebool -P ftpd_disable_trans on 或者 setsebool -P ftp_home_dir on

5、重启vsftpd服务和xinetd服务,注意两个服务启动有先后顺序!先启动vsftpd服务,后启动xinetd服务。宕服务的时候先宕vsftpd服务,再宕xinetd服务,否则前者可能无法停止。

[root@localhost ~]# service vsftpd restart
关闭 vsftpd:                                                      [确定]

为 vsftpd 启动 vsftpd:                                     [确定]
[root@localhost ~]# service xinetd restart
关闭 xinetd:      [确定]
为 xinetd 启动 xinetd:      [确定]

 
 


6、windows平台远程测试(也可通过另一linux平台连过来测试):

开始-运行-cmd,进入dos窗口,输入:ftp xxx.xxx.xxx.xxx   (xxx.xxx.xxx.xxx 为linux实际主机ip)

C:\Documents and Settings\Administrator>ftp xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx.
220 (vsFTPd 2.0.5)
User (xxx.xxx.xxx.xxx:(none)):

接受用户名密码输入,配置成功。


二、问题汇总:

1、500 OOPS: cannot change directory:/root

解决:1)无效的用户权限错误删除/etc/vsftpd/ftpuser 里面的root和user_list 里的root,使root用户可以直接

                 ftp。


                 2)参考上述第四项配置进行检查。          


              3)万能大发:最好关掉linux 的防火墙:chkconfig iptables off


2、ftp:connect:没有到主机的路由

解决:iptables防火墙没有设置 开放21端口规则,同理于23端口等其他端口。具体设置步骤,请搜索iptables防火墙设置方法。


3用户root不能直接telnet linux 服务器

解决:

a: vi /etc/pam.d/login
#%PAM-1.0
#auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so \\将此行注释
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session include system-auth
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session optional pam_keyinit.so force revoke

b: vi /etc/pam.d/remote
#%PAM-1.0
#auth required pam_securetty.so \\将此行注释
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session include system-auth
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session optional pam_keyinit.so force revoke
保存退出。


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值