歡迎您光臨本站 註冊首頁

在windows上用rcp往linux上拷貝文件心得

←手機掃碼閱讀     火星人 @ 2014-03-29 , reply:0

我們知道*nix上都可以用rcp/scp來在不同機器間拷間文件,很方便快捷.從w2k開始,windows 也有了rcp命令,輸入rcp -help,我們可以得到如下信息:
QUOTE:
 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,我們會發現如下信息:
QUOTE:
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 userofwindows@192.168.100.151 as useroflinux: Permission denied.

哦,原來是pam.d的事兒啊...vi /etc/pam.d/rsh,裡面內容如下:
QUOTE:
#%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

[火星人 ] 在windows上用rcp往linux上拷貝文件心得已經有1505次圍觀

http://coctec.com/docs/linux/show-post-202156.html