Use SecureCRT's sftp to transfer file references between Windows and Linux:
http://ice-k.iteye.com/blog/1068275
Http://www.cnblogs.com/chen1987lei/archive/2010/11/26/1888391.html
Background: There is a host that installs the Windows7, installs the VirtualBox in it, and then installs the Ubuntu virtual machine. Install SECURECRT on Windows7 to SSH to the Ubuntu virtual machine. Generally download software on windows and then upload it to Ubuntu virtual machine via vsftp. But this is very troublesome, now consider using the SFTP protocol to transfer directly. Scenario: Use SECURECRT software ssh to connect to an Ubuntu virtual machine. Then open the SFTP session above the SECURECRT, as shown in: After the SFTP command enters the sftp command window, the SFTP command can be used to perform the file transfer operation. Here is a brief description of what the SFTP command means.
sftp> helpavailable commands:ascii Set transfer mode to Asciibinary Se T transfer mode to BINARYCD path change remote directory to ' path ' LCD path Ch Ange local directory to ' path ' detail Remote-path Display system Information about remote File or Folderldetail Local-path Display System Information about local File or folderchgrp group path Change group of file ' path ' to ' group ' chmod mode path Cha Nge Permissions of file ' path ' to ' mode ' chown owner path Change owner of the file ' path ' to ' owner ' exit Quit sftphelp Display This help textinclude filename Include com Mands from ' filename ' Alternate: < Filenameget [-r][-a |-b] remote-path Download file -R Downloads Directory recursively force ASCII (-a) or binary (-B) Modeln [-S] Ex Istingpath linkpath hardlink/symlink remote filels [options] [path] Display remote directory listinglls [opt Ions] [path] Display local directory listingmkdir path Create remote Directorylmkdir path Create local DIRECTORYMV oldpath newpath move remote FILELMV oldpath newpath move Local FileOpen [[email protected]]host[:p ORT] Connect to remote hostput [-r][-a |-b] local-path Upload file -R uploads Directory recursively force ASCII (-a) or Bina Ry (-B) modepwd Display remote working directorylpwd Print local work ing directoryquit Quit sftprename oldname newname Rename remote Filelrename oldname newn Ame Rename LocalFilermdir path Remove remote directorylrmdir path remove local directoryrm path Delete remote FILELRM path Delete local filesu username Subst Itutes The current user This is only supported with Vshell for Windows 3.5 or Later.type [Transfer-mode] Display or set file transfer Modeview Remote-path Download and open fileversion Display protocol version
The translation is:
sftp--Help available command: CD path change remote directory to "path" LCD path change local directory to "path" CHGRP Group path Change the file "path" group to "group" chmod mode path changes the file "path" permission to "mode" chown owner path will file "Pat H "Master Change to" owner "exit exit SFTP Help show this helper text get remote path Download File ln existingpath linkpath symbolic link remote file ls [options] [path] Display remote directory list LLS [options] [path] Show local directory list mkdir Path creation remote Directory lmkdir path Create local directory MV OldPath newpath Mobile remote File Open [user @] host [: Port] Connect to a remote host put local path upload file pwd display remote working directory LPWD print This To work directory quit exit sftp rmdir path Remove remote directory lrmdir path remove local directory RM path Delete remote file LRM Path Delete local file symlink existingpath linkpath Symbolic Link Remote file version Show Protocol version
The main thing we're using is a six-command.
CD path change remote directory to "path" LCD path change local directory to "path" ls [options] [path] display remote directory list LLS [options] [path] show local directory list put local path upload file get remote Path
Here is a detailed description of the remote directory and the local directory .
Remote directory: LS Check the directory above the Ubuntu virtual machine
Local directory: LLS look at the directory above the Windows physical machine.
Instance:
Let's say I need to implement E:\sftp\test1.txt and Ubuntu under/home/enadmin/test2.txt in Windows, and you can do it:
Put operation: Windows->linux
View Directory Permissions
[Email protected]:/home# lltotal 20drwxr-xr-x 5 root root 4096 Apr 15:21./drwxr-xr-x Root root
4096 Jan 3 14:14.. /drwxr-xr-x 9 enadmin enadmin 4096 Apr 15:22 enadmin/drwxr-xr-x 2 root root 4096 Apr 15:21 sftp/--can See SFTP permissions is root drwxr-xr-x 2 root 4096 Apr 14:57 test/[email protected]:/home# chown-r Enadmin.enadmin sftp/[email protected]:/home# lltotal 20drwxr-xr-x 5 root root 4096 APR 18 15:21. Drwxr-xr-x root root 4096 Jan 3 14:14.. /drwxr-xr-x 9 enadmin enadmin 4096 Apr 15:22 enadmin/drwxr-xr-x 2 enadmin enadmin 4096 APR 15:21 sftp/--modified Later permissions become enadmin drwxr-xr-x 2 root root 4096 APR 14:57 test/
Copy files
Sftp> put test*--initially wanted to put files from the Windows system to the Ubuntu system, found that failed, prompting to deny access uploading test1.txt to/home/test1.txtput:failed to Upload E:/sftp/test1.txt. Access denied. Uploading test2.txt to/home/test2.txtput:failed to upload e:/sftp/test2.txt. Access denied. Uploading test3.txt to/home/test3.txtput:failed to upload e:/sftp/test3.txt. Access denied. sftp> pwd--View current directory is the/home directory, permissions are root/homesftp> cd/home/enadmin/--i switch to enadmin directory sftp> lsgraphs.pm MSM TP Ntpsent smokeping.tar.gz smokepingrtt.tar.gzsmokepingrtt2.tar.gz Target Wqywqy-zenhei-0.8.38-1.debsftp> llstest1.txt test2.txt test3.txtsftp> put test*-try again Put the files under Windows into the/homg/enadmin directory, this success uploading test1.txt to/home/enadmin/test1.txt 100% 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.txt 100% 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.txt 100% 5 bytes 5 bytes/s 00:00:00 e:/sftp/te St3.txt:5 bytes transferred in 0 seconds (5 bytes/s) sftp> cd/home/sftp/--After modifying the SFTP directory permissions, switch to the SFTP directory again sftp> LSSFTP&G T Llstest1.txt test2.txt test3.txtsftp> put test*-this time put succeeds. So with permission related uploading test1.txt to/home/sftp/test1.txt 100% 4 bytes 4 bytes/s 00:00:00 e:/sftp/test1.txt:4 bytes TR Ansferred in 0 seconds (4 bytes/s) uploading test2.txt to/home/sftp/test2.txt 100% 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/sftp/test3.txt 100% 5 bytes 5 bytes/s 00:00:00 e:/sftp/test3.txt:5 bytes transferred in 0 seconds (5 bytes/s)
Note: There is a need to pay attention to the issue of permissions. Join me is using enadmin account initial connection Ubuntu, then I put the file can only put folder permissions is Enadmin directory, cannot put folder permissions is root directory. If you want to put the folder permissions in the root directory, then initially use the root account to connect to Ubunut, and then create an SFTP session, so you can.
Get Operation: Linux->windows
Get operation does not have permission set
sftp> pwd/home/enadminsftp> lpwde:/documentssftp> LCD e:/sftp--Switch directory sftp> llsrc.local test1.txt test2.txttest3.txtsftp> lsgraphs.pm msmtp ntpsent smokeping.tar.gz smokepingrtt.tar.gzsmokepingrtt2.tar.gz Target test1.txttest2.txt test3.txt Wqywqy-zenhei-0.8.38-1.debsftp> get graphs.pm--download file to windowsdownloading graphs.pm from/home/enadmin/graphs.pm 100% 13KB 13kb/s 00:00:00 /home/enadmin/graphs.pm:13503 bytes transferred in 0 seconds (kb/s) sftp > Lls--View windows directory graphs.pm rc.local test1.txttest2.txt
Transferred from: http://www.cnblogs.com/xwdreamer/p/3673397.html