putty和psftp命令行參數
https://the.earth.li/~sgtatham/putty/latest/w32/putty.zip
https://the.earth.li/~sgtatham/putty/latest/w64/putty.zip
https://the.earth.li/~sgtatham/putty/latest/puttydoc.zip
https://the.earth.li/~sgtatham/putty/latest/putty-0.72.tar.gz
https://the.earth.li/~sgtatham/putty/latest/putty-src.zip
https://git.tartarus.org/?p=simon/putty.git
putty.exe [-ssh | -telnet | -rlogin | -raw] [user@]host Example: putty -ssh -l vagrant -pw vagrant -P 2222 127.0.0.1 -V print version information and exit -pgpfp print PGP key fingerprints and exit -v show verbose messages -load sessname Load settings from saved session -ssh -telnet -rlogin -raw force use of a particular protocol -P port connect to specified port -l user connect with specified username -batch disable all interactive prompts The following options only apply to SSH connections: -pw passw login with specified password -D [listen-IP:]listen-port Dynamic SOCKS-based port forwarding -L [listen-IP:]listen-port:host:port Forward local port to remote address -R [listen-IP:]listen-port:host:port Forward remote port to local address -X -x enable / disable X11 forwarding -A -a enable / disable agent forwarding -t -T enable / disable pty allocation -1 -2 force use of particular protocol version -4 -6 force use of IPv4 or IPv6 -C enable compression -i key private key file for authentication -m file read remote command(s) from file -s remote command is an SSH subsystem (SSH-2 only) -N don't start a shell/command (SSH-2 only)
例如如下bat腳本的內容:
comd.txt
echo ./backup_tomcat.sh > comd.txt echo exit >> comd.txt
putty -ssh -l %user% -pw %pwd% -P %port% %ip% -m comd.txt >> aa.log
>psftp -h PuTTY Secure File Transfer (SFTP) client Release 0.63 Usage: psftp [options] [user@]host Options: -V print version information and exit -pgpfp print PGP key fingerprints and exit -b file use specified batchfile -bc output batchfile commands -be don't stop batchfile processing if errors -v show verbose messages -load sessname Load settings from saved session -l user connect with specified username -P port connect to specified port -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
WinSCP是一個Windows環境下使用SSH的開源圖形化SFTP客戶端。同時支持SCP協議。它的主要功能就是在本地與遠程計算機間安全的復制文件。
直接在cmd下輸入winscp進入winscp操作介面,查看幫助直接在下面輸入help就可以看到所以可用到的命令。
連接到遠程機器:
open root@192.168.2.19
輸入密碼就成功登錄了
輸入help:
winscp> help
call 執行任意遠程Shell命令
cd 改變遠程工作目錄
chmod 改變遠程文件權限
close 關閉會話
exit 關閉所有會話並結束程序
get 從遠程目錄下載文件到本地目錄
help 顯示幫助
keepuptodate 在一個遠程目錄連續反映本地目錄的改變
lcd 改變本地工作目錄
lls 列出本地目錄的內容
ln 新建遠程符號鏈接
lpwd 顯示本地工作目錄
ls 列出遠程目錄的內容
mkdir 新建遠程目錄
mv 移動或者重命名遠程文件
open 連接到服務器
option 設置或顯示腳本選項的值
put 從本地目錄上傳文件到遠程目錄
pwd 顯示遠程工作目錄
rm 刪除遠程文件
rmdir 刪除遠程目錄
session 列出連接的會話或者選擇活動會話
synchronize 用一個本地目錄同步遠程目錄
如果要查看某個命令的具體使用方法用:
help command
例,現在不記得synchroize的具體命令方法了,現在我可以使用:
help synchronize
winscp> help synchronize
synchronize local|remote|both [ <local directory> [ <remote directory> ] ]
當第一個參數是'local'時,用遠程與本地同步。
當第一個參數是'remote'時用本地目錄同步遠程目錄。
當第一個參數是'both'用一個同步另一個。
當目錄沒有指定時,同步當前工作目錄。
如果'synchdelete'設置為'on',舊文件會被刪除。
注意:對這個命令,覆蓋確認永遠是關閉的。
影響的選項:
transfer, synchdelete, exclude, include
范例:
synchronize remote
synchronize both E:\resource /html/resource
synchronize remote E:\resource /html/resource
=============== End