2008年12月29日 星期一

There's something about PuTTY--pscp

(How to use scp between Windows and Linux?)

PuTTY, a powerful and useful telnet, ssh client for Windows. Besides the termial function, PuTTY also provides a couple of tools to use. Here, I'll briefly address the useage of pscp, a PuTTY version scp.

Again, this is served for my own knowledge base.

-----Begin of Environment Description-----

Windows XP as a local client.

Two Linux as remote servers.

One Linux server can use id/password to login.

Another Linux must use public key authentication to login.

-----End of Environment Description-----

Initiate a command mode.

Set the path to the PuTTY directory.

set PATH=C:\path\to\putty\directory;%PATH%

E.g: C:\tmp>set PATH=C:\Green Softwares\putty\putty-v0.60;%PATH%

So that, you can run pscp in command mode no matter which direcotry you currently in.

-----Bengin of Basic PSCP Operation-----

Linux before scp

[root@saint_linux ~]# pwd
/root
[root@saint_linux ~]# ls
anaconda-ks.cfg install.log list.txt
Desktop install.log.syslog scsrun.log
[root@saint_linux ~]#

To send a file to remote server:

Usage: pscp [options] source [source...] [user@]host:target

E.g. Send test.txt to saint_linux

C:\tmp>pscp test.txt root@saint_linux:/root
root@192.168.1.150's password: <== Enter password here
test.txt 0 kB 0.0 kB/s ETA: 00:00:00 100%

C:\tmp>

Check Linux:

[root@saint_linux ~]# ls
anaconda-ks.cfg install.log list.txt test.txt <== text.txt
Desktop install.log.syslog scsrun.log

To copy a file from the remote server:

Usage: pscp [options] [user@]host:source target

E.g. Copy list.txt from saint_linux

C:\tmp>pscp root@saint_linux:/root/list.txt c:\tmp
root@192.168.1.150's password:
list.txt 2 kB 2.2 kB/s ETA: 00:00:00 100%

Check local client:

C:\tmp>dir
磁碟區 C 中的磁碟沒有標籤。
磁碟區序號: 90BB-8087

C:\tmp 的目錄

2008/12/29 下午 06:26 <DIR> .
2008/12/29 下午 06:26 <DIR> ..
2008/12/29 下午 01:55 23,609 list-keys.txt
2008/12/29 下午 06:19 2,214 list.txt <== list.txt copied
2008/12/29 下午 12:04 8,401 pgpkeytool.txt
2008/08/22 下午 05:51 43,069,066 starcraft_II_fansite_kit.zip
2008/12/29 上午 11:20 19 test.txt
2008/12/19 上午 10:48 1,864,560 WindowsXP-KB960714-x86-CHT.exe
6 個檔案 44,967,869 位元組
2 個目錄 2,639,720,448 位元組可用

-----End of Basic PSCP Operation-----

-----Begin of PSCP with Public Key Authentication-----

First, setting up the session properly and then save it.

Set your private key to be loaded

image

Set Auto Login

image

When ready, click Save to save this session

image

To send a file to remote server:

C:\tmp>pscp test.txt PGP3:/root
test.txt 0 kB 0.0 kB/s ETA: 00:00:00 100%

To copy a file from the remote server:

C:\tmp>pscp PGP3:/root/pgpkeytool.txt c:\tmp
pgpkeytool.txt 8 kB 8.2 kB/s ETA: 00:00:00 100%

-----End of PSCP with Public Key Authentication-----

沒有留言: