Putty copy file windows to linux

Transfer files to/from session I’m logged in with PuTTY

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?

13 Answers 13

This is probably not a direct answer to what you’re asking, but when I need to transfer files over a SSH session I use WinSCP, which is an excellent file transfer program over SCP or SFTP. Of course this assumes you’re on Windows.

I tried WinScp but I need to run a command on the box to gain privilages. This does’nt seem possible using WinScp ?

@user470184: correct. I usually run Putty and WinSCP side-by-side. In fact you can start with WinSCP and then there’s a context menu to «open this site in Putty» if you so wish.

WinSCP is not connect to server, because server use credentials by private key. WinSCP is not support SSH-1 key. I am looking for programm how support that type of key. do you have any ideas?

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

And you can invert it like so: ‘c:>pscp wrhse@warehouse.cit.cornell.edu:/mydata/november2012 november2012’ to receive files from the remote machine.

pscp is part of the putty package but it wasn’t on my path so I needed to add it to my path before this worked. pscp should be in the same location as the putty exe. in my case c:\Program Files (x86)\PuTTY.

If you didn’t install the entire PuTTY package, you will need to download the pscp program separately from chiark.greenend.org.uk/~sgtatham/putty/latest.html

@SheshraoWankhede is there anyway to combine pscp with the ssh-keygen to bypass the password? thanks in advance

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.

And here is some information for transfering files with psftp: pic.dhe.ibm.com/infocenter/tsmscv13/v1r0m0/…

You can also download psftp.exe from:

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

You can also type get to download files from a remote machine to the local machine.

What directory on the local machine is it running in? I get an error that it cant find the file I want to sent.

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.

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.

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

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" 

Источник

Как копировать и передавать файлы по SSH

В статье мы расскажем, как передать файлы через SSH на разных операционных системах — Windows и Linux.

Для подключения к серверу вам потребуются:

  • IP-адрес или имя сервера,
  • логин пользователя (в том числе root),
  • пароль пользователя,
  • порт.

Чаще всего копирование файлов через SSH делают с помощью двух мини-программ:

  1. scp (Secure Copy) — утилита для Linux. Она позволяет безопасно передать или скачать файл по протоколу SSH. Программа scp входит в комплект OpenSSH и не требует установки.
  2. pscp.exe — это утилита для Windows. Она используется по тому же назначению, что и scp: подключение к серверу по SSH и работа с файлами. Эта мини-программа входит в состав PuTTY: ее можно скачать на официальном сайте. Процедура настройки SSH-клиента описана в нашей статье.

Важно: если загружаемый файл существует на целевом хосте, он перезапишется.

Работа через SSH предполагает использование консольных команд. Наиболее популярные из них вы можете найти в статье.

Как скопировать файл через SSH на Linux

Копирование файлов по SSH на Linux можно сделать с помощью scp. Эта утилита позволяет:

  • передать файл с локального компьютера на удаленный сервер,
  • скачать файл с удаленного сервера на локальный компьютер.

Команда scp имеет следующий синтаксис:

Как отправить файл по SSH с локального компьютера на сервер

  • /home/test.doc — путь к файлу на локальном компьютере;
  • username — имя SSH-пользователя;
  • servername — имя сервера или его IP-адрес;
  • directory — директория на сервере, в которую нужно загрузить файл.

Готово, вы загрузили файл на сервер.

Как скачать файлы с удаленного сервера на компьютер

  • /directory/test.doc — путь к файлу на сервере;
  • username — имя SSH-пользователя;
  • servername — имя сервера или его IP-адрес;
  • home — папка на компьютере, в которую нужно загрузить файл.

Готово, вы скачали файл на компьютер.

Как скопировать файлы по SSH на Windows

Копирование через SSH на ОС Windows выполняется с помощью утилиты pscp.exe из набора PuTTY.

Как загрузить файл с компьютера на сервер

  • /documents/test.doc — путь к файлу на локальном компьютере;
  • username — имя SSH-пользователя;
  • servername — имя сервера или его IP-адрес;
  • directory — директория на сервере, в которую нужно загрузить файл.

Если название файла или путь содержит пробелы, заключите его в кавычки:

Готово, вы загрузили файл на сервер.

Как скачать файл через SSH на локальный компьютер

  • username — имя SSH-пользователя;
  • servername — имя сервера или его IP-адрес;
  • directory/test.doc — путь к файлу на сервере;
  • /documents — директория на локальном компьютере, в которую нужно загрузить файл.

Если название файла или путь содержит пробелы, заключите его в кавычки:

Готово, вы скачали файл на компьютер.

Источник

Transfering files with Putty

This blog introduces how to use `Putty` to transfer files from Windows OS to Linux OS and reverse.

During my daily working, I do the development on Windows OS; besides, we have a Debian server for running different jobs automatically, file storage, etc. Sometimes, we also need to transfer files from Windows OS to Linux OS, or reverse; in this case, we use Putty to realize the transfering. Today, I will talk about how to use Putty for transfer files with the following points:

  • What is Putty ?
  • Requirements
  • Transfering files from Windows to Linux
  • Transfering files from Linux to Windows

What is Putty ?

PuTTY is a free and open-source terminal emulator, serial console and network file transfer application. It supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket connection. It can also connect to a serial port. The name “PuTTY” has no official meaning.

Requirements

  • Windows OS
  • Linux OS
  • Putty installed: download Putty here
  • Putty PSCP installed: download Putty PSCP here

Transfering files from Windows to Linux

To transfer files from Windows OS to Linux OS, we will apply PSCP . Before we start, let’s have a general understanding of it. PSCP means “PuTTy Secure Copy Protocol (PSCP)”, is a tool for transferring files securely between computers using an SSH connection. To use this utility, we should be comfortable working in the Windows Command Prompt.

Now, let’s start to transfer files to Linux:

Wins to Linux 1

  • Open Windows Command Prompt.
  • Type pscp source_path user_name@host:target_path at the prompt

Linux to Wins 1

  • Same as above, after the bash script above, we also need to type the password for accessing the Linux server.

Linux to Wins 2

Conclusion

In this blog, I introduced how to use Putty to transfer files from Windows OS to Linux OS and reverse. Hope it’s useful for you.

Reference

  • “PuTTY”, wikipedia. [Online]. Available: https://en.wikipedia.org/wiki/PuTTY
  • “Transfer Files Using PuTTY”, it.cornell.edu. [Online]. Available: https://it.cornell.edu/managed-servers/transfer-files-using-putty
  • Comfreak, “traffic information superhighway”, pixabay.com. [Online]. Available: https://pixabay.com/photos/traffic-information-superhighway-3524185/

This work is licensed under a Attribution-NonCommercial 4.0 International license.

Источник

How to upload a file from Windows machine to Linux machine using command lines via PuTTy?

I’m running Windows on my laptop at the moment and I want to upload files from my laptop to my uni’s general purpose server, which runs both Linux and MacOSX. So, I already opened up a connection to that server using PuTTy. But I failed to trying to upload a file from my laptop to that server using the commands guided in this website: http://news.metaparadigma.de/linux-upload-and-download-via-ssh-terminal-226/. Seems like it only works for Linux to Linux machine. It didn’t recognize the Windows path that I entered (i.e. C:\a.txt). How can I do this?

4 Answers 4

Try using SCP on Windows to transfer files, you can download SCP from Putty’s website. Then try running:

pscp.exe filename.extension username@domainname.com:directory/subdirectory 

Don’t worry about it, I don’t freak out about accepting answers right away, also look into using it on Linux too as its a handy tool for moving files around via SSH.

Pscp.exe is painfully slow.

Uploading files using WinSCP is like 10 times faster.

So, to do that from command line, first you got to add the winscp.com file to your %PATH%. It’s not a top-level domain, but an executable .com file, which is located in your WinSCP installation directory.

Then just issue a simple command and your file will be uploaded much faster putty ever could:

WinSCP.com /command "open sftp://username:password@example.com:22" "put your_large_file.zip /var/www/somedirectory/" "exit" 

And make sure your check the synchronize folders feature, which is basically what rsync does, so you won’t ever want to use pscp.exe again.

WinSCP.com /command "help synchronize" 

Источник

Читайте также:  10 преимуществ linux перед windows
Оцените статью
Adblock
detector