puttyとpscpの使い方

/ Windows / Comment[0]
Windows使ってる時にどうしてもLinuxマシンを操りたいときやLinuxマシンとファイルを送受信したいときってありますよね。
そんな時に便利なツールがputtyとpscpです。
これらは500KB未満の単体のexeファイルでインストール不要です。
手軽でいいですね。

公式: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

cmdから簡単に起動させたいのでパスの通った場所に置きます。
C:\Users\gamer>PATH
PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft
Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\sys
tem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fil
es (x86)\Windows Live\Shared

無難に「%WINDIR%\system32\」でいいでしょう。
パスが通っている場所に設置したらcmdから起動させます。


putty


下記のコマンドで接続先などの設定GUIが表示されます。
> putty

次のように指定することも可能です。別にウインドウが立ち上がり接続を開始します。
> putty user@10.0.1.1 22

自分の場合は、上記オプションを打ち込むのが面倒なのでデスクトップに次のバッチファイルを作って置いてます。
start putty cpt@10.0.1.1 22

オプション入力の手間が省けますしputty起動直後にcmdも消えてくれるので便利です。


pscp


pscpは完全にCUIアプリケーションです。
C:\Users\gamer> pscp
PuTTY Secure Copy client
Release 0.63
Usage: pscp [options] [user@]host:source target
pscp [options] source [source...] [user@]host:target
pscp [options] -ls [user@]host:filespec
Options:
-V print version information and exit
-pgpfp print PGP key fingerprints and exit
-p preserve file attributes
-q quiet, don't show statistics
-r copy directories recursively
-v show verbose messages
-load sessname Load settings from saved session
-P port connect to specified port
-l user connect with specified username
-pw passw login with specified password
-1 -2 force use of particular SSH protocol version
-4 -6 force use of IPv4 or IPv6
-C enable compression
-i key private key file for authentication
-noagent disable use of Pageant
-agent enable use of Pageant
-batch disable all interactive prompts
-unsafe allow server-side wildcards (DANGEROUS)
-sftp force use of SFTP protocol
-scp force use of SCP protocol

  • リモートファイルの一覧を表示する

  • オプション
     -scp SCPモード
     -P ポートを指定
     -ls lsコマンドを送信
    C:\Users\gamer> pscp -scp -P 22 -ls cpt@10.0.1.1:/var
    cpt@10.0.1.1's password:
    蜷郁ィ・52
    drwxr-xr-x 13 root root 4096 7譛・ 1 22:40 .
    drwxr-xr-x 26 root root 4096 6譛・27 06:58 ..
    drwxr-xr-x 2 root root 4096 7譛・ 2 06:40 backups
    drwxr-xr-x 11 root root 4096 3譛・14 06:46 cache
    drwxrwsrwt 2 root whoopsie 4096 3譛・13 21:29 crash
    drwxr-xr-x 41 root root 4096 4譛・24 06:53 lib
    drwxrwsr-x 2 root staff 4096 1譛・10 23:34 local
    lrwxrwxrwx 1 root root 9 3譛・13 21:09 lock -> /run/lock
    drwxr-xr-x 15 root root 4096 7譛・ 3 06:34 log
    drwxrwsr-x 2 root mail 4096 3譛・13 21:09 mail
    drwxr-xr-x 2 root root 4096 3譛・13 21:09 opt
    lrwxrwxrwx 1 root root 4 7譛・ 1 22:40 run -> /run
    drwxr-xr-x 7 root root 4096 3譛・13 21:26 spool
    drwxrwxrwt 2 root root 4096 6譛・29 17:16 tmp
    drwxrwx--- 9 www-data adm 4096 7譛・ 2 20:44 www
    Fatal: Received unexpected end-of-file from server


  • SCPでリモートファイルをダウンロードする
  • C:\Users\gamer\Desktop> pscp -scp -P 22 cpt@10.0.1.1:/storage/whitealbum_ost.tg whitealbum_ost.tg
    cpt@10.0.1.1's password:
    whitealbum_ost.tg | 0 kB | 0.6 kB/s | ETA: 00:00:00 | 100%
    Fatal: Received unexpected end-of-file from server
    エラーが出ましたけどファイルは異常ありませんでした。

  • SCPでローカルファイルを送る
  • C:\Users\gamer\Desktop> pscp -scp -P 22 bara.txt cpt@10.0.1.1:/storage
    cpt@10.0.1.1's password:
    bara.txt | 0 kB | 0.2 kB/s | ETA: 00:00:00 | 100%
関連記事

コメント

:
:
:
:
:
管理人のみ表示を許可