CentOS下开通Ftp和Telnet服务

在安装好CentOS以后,需要设置Ftp和Telnet服务文件,才能启动Ftp和Telnet服务,可以通过远程控制进行开启。

1.1、进入终端命令模式,用root用户登录;

1.2、开启ftp服务。

  cd /etc/xinetd.d ,编辑ftp服务的配置文件gssftp:

  vi gssftp ,将 修改两项内容:

  (1)server_args = -l –a 去掉-a 改为server_args = -l

  (2)disable=yes改为disable=no

  (3)保存退出。

1.3、开启telnet服务

     cd /etc/xinetd.d ,察看telnet服务的配置文件krb5-telnet的设置: $ {! b7 r0 A8 d. z

   开启telnet服务设置

   vi krb5-telnet ,

  (1)将disable=yes,改为disable=no,保存退出。

1.4、激活服务:

  telnet /ftp 是挂在 xinetd 底下的,所以自然只要重新激活 xinetd 就能够将 xinetd 里头的设定重新读进来,所以刚刚设定的telnet /ftp自然也就可以被激活。

  激活目录和命令:

  cd /etc/rc.d/init.d/

  service xinetd restart

  有时会提示命令不存在,需要加上命令的路径

  [root@localhost init.d]# service xinetd resart

  bash: service: command not found

  [root@localhost init.d]# /sbin/service xinetd restart

    若提示xinetd: 未被识别的服务,则说明/etc/rc.d/init.d下无xinetd包

  [root@localhost init.d]# yum -y install xinetd*   //下载xinetd包

    [root@localhost init.d]# service xinetd resart    //重新启动FTP、Telnet服务

    这样既可ftp登陆到服务器

gssftp 上传出现权限拒绝问题(553 文件: Permission denied)

主机 centos5.1

ftp:gssftp

远程主机一样环境

gssftp里修改为如下:

service ftp
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/kerberos/sbin/ftpd
        server_args     = -l
        log_on_failure  += USERID
        disable         = no
}

测试如下:

1直接根目录传

ftp> pwd
257 "/" is current directory.
ftp> put /1t
local: /1t remote: /1t
227 Entering Passive Mode (172,16,4,179,134,188)
553 /1t: Permission denied.

2传到另一主机/tmp下

226 Transfer complete.
ftp> pwd
257 "/tmp" is current directory.
ftp> put /oracle.tar
local: /oracle.tar remote: /oracle.tar
227 Entering Passive Mode (172,16,4,179,198,221)
553 /oracle.tar: Permission denied.

3在/tmp/下传到另一主机的/tmp/下

ftp> put /tmp/1t
local: /tmp/1t remote: /tmp/1t
227 Entering Passive Mode (172,16,4,179,149,202)
150 Opening BINARY mode data connection for /tmp/1t.
226 Transfer complete.
5 bytes sent in 0.0003 seconds (16 Kbytes/s)

开始以为(root用户登录)ftp上传以ftp用户读取文件再传送

如下测试:

[root@yao1 /]# ll
total 162
-rw-r--r--   1 ftp    ftp          5 May 13 14:27 1t
drwxr-xr-x   2 root   root      4096 May 12 09:53 bin


ftp> put /1t        
local: /1t remote: /1t
227 Entering Passive Mode (172,16,4,179,152,62)
553 /1t: Permission denied.
ftp> pwd
257 "/" is current directory.
ftp> cd /tmp
250 CWD command successful.
ftp> pwd
257 "/tmp" is current directory.
ftp> put /1t    
local: /1t remote: /1t
227 Entering Passive Mode (172,16,4,179,183,198)
553 /1t: Permission denied.

结果是:linux gssftp上传不能传/目录上的文件

晚上又测试了:

结果如下

Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put /1t /tmp/1t
local: /1t remote: /tmp/1t
227 Entering Passive Mode (172,16,4,179,48,36)
150 Opening BINARY mode data connection for /tmp/1t.
226 Transfer complete.
6 bytes sent in 0.00028 seconds (21 Kbytes/s)
说明只要上传后的路径有绝对路径和文件名一定行的。如上面的我设上传路径和文件名为/tmp/1t就ok了。

所以gssftp只要put 之后源地址 目标地址正确,不要缺省的认为你ftp后用cd 进入目录,然后和windows一样put  在源文件之后一定放在刚才你cd进来的目录,linux 这个上传需要设置目标地址的绝对路径,不是你cd进入一个目录就行。

 

猜你喜欢

转载自topmanopensource.iteye.com/blog/1278573