分类:
2014-08-21 10:47:04
原文地址:putty psftp 的用法 作者:finger_lake
先说一说putty 使用RSA 公钥密码机制登陆吧,这个网上介绍比较少。尤其对于psftp的介绍,putty的官方网站仅仅是提了一下
首先打开windows 下的dos 窗口
进入 pstfp 所在路径 或者 set PATH=C:\path\to\putty\directory;%PATH%
第一步是建立连接:
psftp -i private_key.ppk
putty 会提示输入用户名和端口
输入
open finger_lake@150.45.21.70
这时已经建立了连接。
第二部 上传文件
put file
默认传到 home 目录下
get /home/fingelake/file
从remote server 上下载文件
下面是对putty常用选项的一些描述。
To add the directory containing PSFTP to yourPATH
environment variable, type into the console window:
set PATH=C:\path\to\putty\directory;%PATH%
psftp fred@server.example.com
-l
: specify a user nameThe -l
option is an alternative way to specify the user name to log in as, on the command line. Instead of typing psftp user@host
, you can also type psftp host -l user
.
-P
: specify a port numberIf the host
you specify is a saved session, PSFTP uses
any port number specified in that saved session. If not, PSFTP uses the
default SSH port, 22. The -P
option allows you specify the port number to connect to for PSFTP's SSH connection.
open host.name
, or if you need to specify a user name as well you can type open user@host.name
.get
command: fetch a file from the serverTo download a file from the server and store it on your local PC, you use the get
command.
In its simplest form, you just use this with a file name:
get myfile.dat
If you want to store the file locally under a different name, specify the local file name after the remote one:
get myfile.dat newname.dat
This will fetch the file on the server called myfile.dat
, but will save it to your local machine under the name newname.dat
.
put
command: send a file to the serverTo upload a file to the server from your local PC, you use the put
command.
In its simplest form, you just use this with a file name:
put myfile.dat
If you want to store the file remotely under a different name, specify the remote file name after the local one:
put myfile.dat newname.dat
This will send the local file called myfile.dat
, but will store it on the server under the name newname.dat
.
reget
and reput
commands: resuming file transfersIf a file transfer fails half way through, and you end up with half
the file stored on your disk, you can resume the file transfer using
the reget
and reput
commands. These work exactly like the get
and put
commands, but they check for the presence of the half-written
destination file and start transferring from where the last attempt
left off.
The syntax of reget
and reput
is exactly the same as the syntax of get
and put
:
reget myfile.dat
reget myfile.dat newname.dat