日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

secureCRT 实现windows和linux文件互传

發(fā)布時間:2025/5/22 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 secureCRT 实现windows和linux文件互传 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

背景:

有一臺主機,安裝了windows10,然后服務器安裝了ubuntu。在windows10上安裝SecureCRT來ssh連接ubuntu虛擬機。一般在windows上面下載軟件要上傳到服務器上使用,現(xiàn)在考慮使用sftp協(xié)議來直接傳輸。

方案:

使用SecureCRT軟件ssh連接到ubuntu服務器打開第一個會話。然后在SecureCRT上面文件選項中在次打開SFTP會話,如下圖所示:  

SFTP命令

進入到sftp命令窗口以后,就可以通過sftp命令來進行文件互傳的操作。下面主要介紹一下sftp命令的含義。 sftp> help Available commands: ascii Set transfer mode to ASCII binary Set transfer mode to binary cd path Change remote directory to 'path' lcd path Change local directory to 'path' detail remote-path Display system information about remotefile or folder ldetail local-path Display system information about localfile or folder chgrp group path Change group of file 'path' to 'group' chmod mode path Change permissions of file 'path' to 'mode' chown owner path Change owner of file 'path' to 'owner' exit Quit sftp help Display this help text include filename Include commands from 'filename'Alternate: < filename get [-r][-a | -b] remote-path Download file-r downloads directory recursivelyforce ascii (-a) or binary (-b) mode ln [-s] existingpath linkpath Hardlink / symlink remote file ls [options] [path] Display remote directory listing lls [options] [path] Display local directory listing mkdir path Create remote directory lmkdir path Create local directory mv oldpath newpath Move remote file lmv oldpath newpath Move local file open [user@]host[:port] Connect to remote host put [-r][-a | -b] local-path Upload file-r uploads directory recursivelyforce ascii (-a) or binary (-b) mode pwd Display remote working directory lpwd Print local working directory quit Quit sftp rename oldname newname Rename remote file lrename oldname newname Rename local file rmdir path Remove remote directory lrmdir path Remove local directory rm path Delete remote file lrm path Delete local file su username Substitutes the current userThis is only supported with VShell for Windows 3.5 or later. type [transfer-mode] Display or set file transfer mode view remote-path Download and open file version Display protocol version

翻譯一下就是:

sftp-- help 可用命令: cd 路徑 更改遠程目錄到“路徑” lcd 路徑 更改本地目錄到“路徑” chgrp group path 將文件“path”的組更改為“group” chmod mode path 將文件“path”的權限更改為“mode” chown owner path 將文件“path”的屬主更改為“owner” exit 退出 sftp help 顯示這個幫助文本 get 遠程路徑 下載文件 ln existingpath linkpath 符號鏈接遠程文件 ls [選項] [路徑] 顯示遠程目錄列表 lls [選項] [路徑] 顯示本地目錄列表 mkdir 路徑 創(chuàng)建遠程目錄 lmkdir 路徑 創(chuàng)建本地目錄 mv oldpath newpath 移動遠程文件 open [用戶@]主機[:端口] 連接到遠程主機 put 本地路徑 上傳文件 pwd 顯示遠程工作目錄 lpwd 打印本地工作目錄 quit 退出 sftp rmdir 路徑 移除遠程目錄 lrmdir 路徑 移除本地目錄 rm 路徑 刪除遠程文件 lrm 路徑 刪除本地文件 symlink existingpath linkpath 符號鏈接遠程文件 version 顯示協(xié)議版本

我們主要用到的就是一下六個命令

cd 路徑 更改遠程目錄到“路徑” lcd 路徑 更改本地目錄到“路徑” ls [選項] [路徑] 顯示遠程目錄列表 lls [選項] [路徑] 顯示本地目錄列表 put 本地路徑 上傳文件 get 遠程路徑 下載文件

這里在詳細說明一下遠程目錄和本地目錄。

遠程目錄:ls查看到的是ubuntu虛擬機上面的目錄

本地目錄:lls查看到的是windows實體機上面的目錄。

實例:

假設我需要實現(xiàn)windows下的F:\share\test1.txt和ubuntu下/root/test2.txt的互換,可以進行一下操作:

put操作:windows->linux

查看目錄權限

root@BJCGNMON01:/home# ll total 20 drwxr-xr-x 5 root root 4096 Apr 18 15:21 ./ drwxr-xr-x 24 root root 4096 Jan 3 14:14 ../ drwxr-xr-x 9 enadmin enadmin 4096 Apr 18 15:22 enadmin/ drwxr-xr-x 2 root root 4096 Apr 18 15:21 sftp/--可以看到sftp的權限是root的 drwxr-xr-x 2 root root 4096 Apr 18 14:57 test/

拷貝文件

sftp> lls test1.txt test2.txt test3.txt sftp> put test* -再次嘗試將windows下的文件put到/homg/enadmin目錄下,這次成功 Uploading test1.txt to /home/enadmin/test1.txt100% 4 bytes 4 bytes/s 00:00:00 e:/sftp/test1.txt: 4 bytes transferred in 0 seconds (4 bytes/s) Uploading test2.txt to /home/enadmin/test2.txt100% 4 bytes 4 bytes/s 00:00:00 e:/sftp/test2.txt: 4 bytes transferred in 0 seconds (4 bytes/s) Uploading test3.txt to /home/enadmin/test3.txt100% 5 bytes 5 bytes/s 00:00:00 e:/sftp/test3.txt: 5 bytes transferred in 0 seconds (5 bytes/s)sftp> cd /home/sftp/--在修改sftp目錄權限以后,再次切換到sftp目錄下 sftp> ls sftp> lls test1.txt test2.txt test3.txt sftp> put test1.txt --這回put成功。所以跟權限相關 Uploading test1.txt to /home/sftp/test1.txt100% 4 bytes 4 bytes/s 00:00:00

注意點:這里需要注意權限的問題。加入我是使用enadmin賬戶初始連接ubuntu的,那么我put的文件只能放到文件夾權限是enadmin的目錄下,不能放到文件夾權限是root的目錄下。如果想放到文件夾權限是root的目錄下,那么初始就使用root賬戶連接ubunut,然后再創(chuàng)建sftp會話,這樣就可以了。例子中我是直接切換到root用戶。

get操作:linux->windows

get操作沒有權限設定

sftp> pwd /home/enadmin sftp> lpwd e:/Documents sftp> lcd e:/sftp --切換目錄 sftp> lls rc.local test1.txt test2.txt test3.txt sftp> ls Graphs.pm msmtp ntp sent smokeping.tar.gz smokepingrtt.tar.gz smokepingrtt2.tar.gz Target test1.txt test2.txt test3.txt wqy wqy-zenhei-0.8.38-1.deb sftp> get Graphs.pm --下載文件到windows Downloading Graphs.pm from /home/enadmin/Graphs.pm100% 13KB 13KB/s 00:00:00 /home/enadmin/Graphs.pm: 13503 bytes transferred in 0 seconds (13 KB/s) sftp> lls --查看windows目錄 Graphs.pm rc.local test1.txt test2.txt test3.txt sftp>

轉(zhuǎn)載于:https://www.cnblogs.com/tanzq/p/9487645.html

總結

以上是生活随笔為你收集整理的secureCRT 实现windows和linux文件互传的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。