Transfer files to/from session I'm logged in w

2019-01-31 02:23发布

I'm logged into a remote host using PuTTY.

What is the command to transfer files from my local machine to the machine I'm logged into on PuTTY?

10条回答
劳资没心,怎么记你
2楼-- · 2019-01-31 03:01

Look here:

http://www.cit.cornell.edu/services/managed_servers/howto/file_transfer/fileputty.cfm#puttytrans

A direct transfer like FTP is not possible, because all commands during your session are send to the server.

查看更多
SAY GOODBYE
3楼-- · 2019-01-31 03:02

Since you asked about to/from, here's a trick that works for the 'from' part. Open the 'Change settings...' screen, Terminal, and under 'Printer to send ANSI printer output to:' select 'Generic / Text Only'

Now on the remote system, run this on one line:

tput mc5; cat whatever.txt; tput mc4

Putty will inform you that the file was saved. What this is doing is putting the terminal into printer mode (tput mc5), printing the file to the screen (cat), and then turning off printer mode (tput mc4). If you don't put all the commands on one line, the screen will appear frozen because Putty is saving all terminal output to a file in the background.

If you're on a more limited system that doesn't have the tput command (e.g. a qnap), you can try printf "\x1b[5i" instead of tput mc5, and printf "\x1b[4i" instead of tput mc4.

The command in the middle is just anything that prints to the screen. So use tail -n 10000 blah.log to download the last 10k lines of the log file, or use a base64 encoder to map a binary file to something you can print (and then decode on your local system):

printf "\x1b[5i"; openssl enc -base64 -in something.zip; printf "\x1b[4i"
查看更多
聊天终结者
4楼-- · 2019-01-31 03:08

You can also download psftp.exe from:

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

When you run it you type:

open "server name"

Then:

put "file name"

(Type help to get a full list of commands.)

You can also type get <file name> to download files from a remote machine to the local machine.

查看更多
We Are One
5楼-- · 2019-01-31 03:08

There's no way to initiate a file transfer back to/from local Windows from a SSH session opened in PuTTY window.

Though PuTTY supports connection-sharing.

While you still need to run a compatible file transfer client (the pscp or psftp), no new login is required, it automatically (if enabled) makes use of an existing PuTTY session.

To enable the sharing see:
Sharing an SSH connection between PuTTY tools.


Alternative way is to use WinSCP, a GUI SFTP/SCP client. While you browse the remote site, you can anytime open SSH terminal to the same site using Open in PuTTY button.

See Opening Session in PuTTY.

With an additional setup, you can even make PuTTY automatically navigate to the same directory you are browsing with WinSCP.

See Opening PuTTY in the Same Directory.

(I'm the author of WinSCP)

查看更多
女痞
6楼-- · 2019-01-31 03:11

PuTTY usually comes with a client called psftp which you can leverage for this purpose. I don't believe you can do it through the standard PuTTY client (although I may be proven wrong on that).

PuTTY only gives you access to manipulate the remote machine. It doesn't provide a direct link between the two file systems any more than sitting down at the remote machine does.

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-01-31 03:12

  • Click on start menu.
  • Click run
  • In the open box, type cmd then click ok
  • At the command prompt, enter:

    c:>pscp source_file_name userid@server_name:/path/destination_file_name.

For example:

c:>pscp november2012 wrhse@warehouse.cit.cornell.edu:/mydata/november2012.

  • When promted, enter your password for server.

Enjoy

查看更多
登录 后发表回答