用rcp命令从Windows向Linux上复制文件
我们知道Linux上都可以用rcp/scp来在不同机器间拷间文件,很方便快捷.从Windows 2000开始,Windows 也有了rcp命令,输入rcp -help,我们可以得到如下信息:
Option e is not valid
Copies files to and from computer running the RCP service.
RCP [-a | -b] [-h] [-r] [host][.user:]source [host][.user:] path\
-a Specifies ASCII transfer mode. This mode con
the EOL characters to a carriage return for
and a carriage
return/line feed for personal computers. Thi
the default transfer mode.
-b Specifies binary image transfer mode.
-h Transfers hidden files.
-r Copies the contents of all subdirectories;
destination must be a directory.
host Specifies the local or remote host. If host
specified as an IP address OR if host name c
dots, you must specify the user.
.user: Specifies a user name to use, rather than th
current user name.
source Specifes the files to copy.
path\destination Specifies the path relative to the logon dir
on the remote host. Use the escape character
(\ , ", or ') in remote paths to use wildcar
characters on the remote host.
我们可不可以用它从windwos上往Linux上拷贝文件呢?答案是肯定的.不过需要一些小小的配置.下面简单讲一下需要配置的地方,及解决问题的方法.
在Linux间互相rcp的配置很简单,在/etc/xinetd.d/rsh,rlogin等文件中把disable=yes,改成no,重启xinetd即可,如果想在传输中不需要输入密码,配置~user/.rhost文件或者/etc/hosts.equiv文件就可以了,但我们在从Windows往Linux上拷贝文件时却出现这样的错误:192.168.x.y: Permission denied.怎么回事儿呢?怎么办?
不要着急,在Linux主机上,tail -f /var/log/messages,我们会发现如下信息:
Jan 14 21:43:10 Sim32_01 pam_rhosts_auth[28313]: denied to userofwinsows@Windowsserver as userofLinux: access not allowed
Jan 14 21:43:10 Sim32_01 in.rshd[28313]: rsh denied to [email protected] as userofLinux: Permission denied.
哦,原来是pam.d的事儿啊...vi /etc/pam.d/rsh,里面内容如下:
#%PAM-1.0
# For root login to succeed here with pam_securetty, "rsh" must be
# listed in /etc/securetty.
auth required /lib/security/pam_nologin.so
auth required /lib/security/pam_securetty.so
auth required /lib/security/pam_env.so
auth required /lib/security/pam_rhosts_auth.so
account required /lib/security/pam_stack.so service=system-auth
session required /lib/security/pam_stack.so service=system-auth
把auth required /lib/security/pam_rhosts_auth.so
这一行注释掉,再试,OK,搞定!
附:从Windows上rcp文件到Linux机器的命令示例:rcp -b filename Linuxserver.test:/tmp