Putty перенос настроек на другой компьютер
Or I have to take manually every record from Registry?
Настраиваем публичный ключ на сервере Linux.
Файл открытого ключа «public.key» нужно скопировать на тот сервер Linux, к которому планируется подключение. Для этого воспользуемся утилитой pscp.exe. Команда копирования файла будет выглядеть примерно так:
Далее скопированный ключ нужно поместить в домашний каталог пользователя в файл ~/.ssh/authorized_keys .
Для этого заходим на сервер по SSH (как обычно) и выполняем следующую команду:
где myuser, имя пользователя, которому будет разрешено авторизоваться по данному ключу.
Также не забудьте убедитесь, что на сервере разрешена авторизация по ключу. Для этого в файле /etc/ssh/sshd_config должны быть раскоментированы следующие строки:
Alternative ways:
15 Answers 15
Подключаемся по SSH с помощью ключа
Запускаем PuTTY и в левой части экрана переходим в раздел Connections -> SSH -> Auth.
Находим строку «Private key file for authentication», после чего нужно нажать кнопку «Browse» и указать наш файл с приватным ключом «private.ppk».
Затем на основной вкладке указываем имя/ip адрес нашего Linux сервера и запускаем подключение. После чего система как обычно попросит указать логин, а затем кодовую фразы ключа (если она указывалась). Если ключевая фраза не указана, то консоль сервера откроется без пароля.
Чтобы при каждом подключении не лезть в настройки Auth и указывать файл ключа, настройки можно сохранить, для этого на главной вкладе есть кнопки Save (сохранить настройки PuTTY) и Load (загрузить настройки). Все сохраненный настройки Putty хранятся в реестре, поэтому их в принципе можно перенести с одного компьютера на другой простым экспортом/импортом куска реестра (подробнее описано в статье Перенос настроек PuTTY)
Кроме того, чтобы каждый раз вручную не вводить имя пользователя, логин пользователя также можно сохранить в PuTTY (пункт Connection\Data\Auto-login username).
PuTTY — популярный SSH клиент для WIndows. В процессе работы вы сохраняете настройки о подключениях, привязанных к ним туннелях, кодировке, используемой не серверах и другую. Поэтому часто возникают вопросы:
- где putty хранит настройки
- сохранить настройки putty
- как перенести настройки putty
Генерируем пару RSA ключей
Для этого запускаем утилиту PuTTYgen, проверяем, что в качестве типа ключа выбран «SSH-2 RSA» и нажимаем кнопку «Generate«.
После этого начинается генерация пары ключей, и для того, чтобы сгенерировать случайную последовательность нужно произвольно повозить мышкой в районе прогресс-бара.
В поле «Key comment» можно задать описание ключа (оно будет отображается во время аутентификации по ключу).
В поле «Key passphrase» и «Confirm passphrase» указывает пароль для активации ключа (он будет запрашиваться при подключении). Если ключевую фразу не задать, то подключение будет осуществляться без пароля: это очень удобно, но не очень безопасно, т.к. для доступа к серверу злоумышленнику достаточно стянуть у вас файл с закрытым ключом (именно поэтому рекомендуется хранить приватный ключ в секрете: на внешнем носителе USB, зашифрованном томе и т.д.).
Затем нажимаем кнопки «Save public key» и «Save private key» и сохраняем соответственно открытый и закрытый ключи в файл с именами, например: «public.key«и «private.ppk«.
Putty — как сохранить и перенести настройки на другой компьютер: 7 комментариев
слеши потеряны в путях ветки, например, тут: «Можно открыть редактор реестра и экспортировать ключ HKEY_CURRENT_USERSoftwareSimontatham»…
Спасибо за комментарий!
Поправил — теперь символы отображаются верно.
Спасибо, коротко и по делу — все работает как надо. Всё время забываю как сохранить, но не на всех настройках все так лаконично и в тему
Буду признателен, если подскажете как сохранить настройку размера шрифта в Putty.
А как перенести настройки putty из Windows в Linux?
Вадим, не знаю такого способа.
Putty появился как ssh-клиент для Windows, для ОС на базе Linux ssh — это стандарт для удаленной работы и для чего там нужен Putty?
не могу вспомнить. как самому создать reg файл.
имеется список сессий по ip или по имени.
нужно по списку создать reg файл который добавляет в сохраненные сеансы.
Помогите кто помнит
Замечательная программа Putty (кстати, читается как «пати»), предназначенная для соединения с сервером по SSH и управления им через консоль, установлена практически у каждого компьютерщика. В ней есть возможность сохранения настроек, чтобы не приходилось каждый раз вбивать их заново. Однако, сходу непонятно, где программа их хранит и как перенести конфигурацию Putty с одного компьютера на другой?
Да, было бы удобно иметь возможность запросто переносить настройки Putty с машины на машину. И эта возможность, оказывается, есть. Дело в том, что Putty хранит свои настройки не в конфигурационном файле, как многие другие программы, а в реестре Windows. То есть, чтобы сохранять настройки Putty нужно хоть немного уметь работать с реестром. Таким образом, для сохранения и переноса настроек необходимо выполнить ряд шагов:
PowerShell:
Note: do not replace SimonTatham with your username.
Note: It will create a reg file on the Desktop of the current user.
Note: It will not export related SSH keys.
This worked for me moving this from Windows 7 to Windows 10, but I had to run regedit as myself and use the Import feature there. Otherwise, just trying to import the .reg file itself on the new computer imported the settings to the Administrative user instead.
As far as I know you don't need elevated command prompt when you export from branch HKEY_CURRENT_USER\. . Elevated rights are required only for HKEY_LOCAL_MACHINE , HKEY_CLASSES_ROOT , etc.
When I tried the other solutions I got this error:
Phooey to that, I say!
I put together the below powershell scripts for exporting and importing PuTTY settings. The exported file is a windows .reg file and will import cleanly if you have permission, otherwise use import.ps1 to load it.
Warning: messing with the registry like this is a Bad Idea™, and I don't really know what I'm doing. Use the below scripts at your own risk, and be prepared to have your IT department re-image your machine and ask you uncomfortable questions about what you were doing.
On the source machine:
On the target machine:
Apologies for the non-idiomatic code, I'm not very familiar with Powershell. Improvements are welcome!
That was a great help! I had different registry locations just had to edit the path in both and that was it :)
PuTTY is a program that can edit your registry. If they "patch" your permissions so user-runnable programs can't edit the registry you won't have any PuTTY settings to export.
Launch Run, then type in the Open drop down window: regedit
Navigate to, just like in Window's Explorer:
HKEY_CURRENT_USER\Software\SimonTatham
After export, copy that .reg file to the computer that you want to use those setting. Simply double click it to take effect.
If You want to import settings on PuTTY Portable You can use the putty.reg file.
Just put it to this path [path_to_Your_portable_apps]PuTTYPortable\Data\settings\putty.reg . Program will import it
For those of you who need to import Putty from offline registry file e.g. when you are recovering from crashed system or simply moving to a new machine and grabbing data off that old drive there is one more solution worth mentioning:
This great and free console application will export the entire registry or only a specific registry key. In my case i simply copied the registry file from an old drive to the same directory as the exporter tool and then i used following command and syntax in CMD window run as administrator:
RegFileExport.exe NTUSER.DAT putty.reg "HKEY_CURRENT_USER\Software\SimonTatham"
After importing the .reg file and starting Putty everything was there. Simple and efficient.
This answer is narrow enough of a use case to be included in a separate question for offline recovery. Thanks.
I would add a note that the NTUSER.DAT is located in Users/[Username] as a protected system file, and not in Windows/SYSTEM32/Config.
It would be nice if the putty team would take this as an option into the main distribution.
This was so much easier importing the registry export than what is stated above. + Simply:
- right click on the file and
- select "Merge"
Worked like a champ on Win 7 Pro.
m0nhawk's answer didn't work for me on Windows 10 - it required elevated command prompt and refused to emit a file.
This worked and didn't require elevation:
Example:
How to transfer putty configuration and session configuration from one user account to another e.g. when created a new account and want to use the putty sessions/configurations from the old account
Process:
- Export registry key from old account into a file
- Import registry key from file into new account
Export reg key: (from OLD account)
- Login into the OLD account e.g. tomold
- Open normal 'command prompt' (NOT admin !)
- Type 'regedit'
- Navigate to registry section where the configuration is being stored e.g. [HKEY_CURRENT_USER\SOFTWARE\SimonTatham] and click on it
- Select 'Export' from the file menu or right mouse click (radio ctrl 'selected branch')
- Save into file and name it e.g. 'puttyconfig.reg'
- Logout again
Import reg key: (into NEW account)
Login into NEW account e.g. tom
Open normal 'command prompt' (NOT admin !)
Select 'Import' from the menu
Select the registry file to import e.g. 'puttyconfig.reg'
Note:
Do not use an 'admin command prompt' as settings are located under '[HKEY_CURRENT_USER. ] 'and regedit would run as admin and show that section for the admin-user rather then for the user to transfer from and/or to.
An improvement to the solution of bumerang to import data to PuTTY portable .
Simply moving exported putty.reg (with m0nhawk solution) to PuTTYPortable\Data\settings\ didn't work. PuTTY Portable backup the file and create a new empty one.
To workaround this issue, merge both putty.reg copying manually the config you want to migrate from your exported putty.reg to the newly created PuTTYPortable\Data\settings\putty.reg below following lines.
The answer posted by @m0nhawk doesn't seem to work as I test on a Windows 7 machine. Instead, using the following scripts would export/import the settings of putty:
If you, like me, installed new Windows and only after you remember about putty sessions, you can still import them, if you have old Windows hard drive or at least your old "home" directory backed up ( C:\Users\ ).
In this directory there should be NTUSER.DAT file. It is hidden by default, so you should enable hidden files in your Windows explorer or use another file browser. This file contains the HKEY_CURRENT_USER branch of your old Windows registry.
To use it, you need to open regedit on your new Windows, and select HKEY_USERS key.
Then select File -> Load Hive. and find your old "home" directory of your old Windows installation. In this directory there should be NTUSER.DAT file. It is hidden by default, so, if you didn't enable to show hidden files in your Windows explorer properties, then you can just manually enter file name into File name input box of "Load Hive" dialog and press Enter . Then in the next dialog window enter some key name to load old registry into it. e.g. tmp .
Your old registry's HKEY_CURRENT_USER branch now should be accessible under HKEY_USERS\tmp branch of your current registry.
Now export HKEY_USERS\tmp\Software\SimonTatham branch into putty.reg file, open this file in your favorite text editor and find-and-replace all HKEY_USERS\tmp string with HKEY_CURRENT_USER . Now save the .reg file.
You can import now this file into your current Windows registry by double-clicking it. See m0nhawk's answer how to do this.
In the end, select HKEY_USERS\tmp branch in the registry editor and then select File -> Unload Hive. and confirm this operation.
30.08.2012
itpro
Linux
Комментариев пока нет
Небольшая инструкция по организации SSH доступа к удаленному Linux серверу. Напомним, что стандартный метод аутентификации пользователя на сервере Unix (Linux, FreeBSD) при доступе по SSH – пара логин и пароль. Но вводить их не всегда удобно, особенно если таких серверов много. Существует альтернатива такому типу доступа – организация SSH доступа по паре RSA ключей (открытому и закрытому) и кодовой фразе (которая, в общем-то, необязательна).
В этой статье мы рассмотрим использование подобного типа доступа, который можно реализовать с помощью одной из популярнейшей программы работы по SSH — PuTTY.
Для работы нам понадобятся следующие утилиты семейства PuTTY:
-
puttygen.exe — пакет для создания пары ключей
Где putty хранит настройки
Putty хранит настройки обо всех настроенных в программе подключениях в реестре системы. Настройки хранятся в ветви реестра HKEY_CURRENT_USER\Software\Simontatham
Если вы хотите сохранить настройки 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.
@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.
You can also download psftp.exe from:
When you run it you type:
(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.
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.
(I'm the author of WinSCP)
If it is only one file, you can use following procedure (in putty):
- vifilename.extension (opens new file name in active folder on server),
- copy + mouse right click while over putty (copy and paste),
- edit and save. =>vi editor commands
Edit file permission with next command: chmod u+x filename.extension
This works amazingly well for text files that will fit in the clipboard. For binary files see xxd but you will also need a Windows program to convert binary to hex. e.g. HEXDUMP
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:
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):
You sir, are a genius! I have been search for a way to transfer files over an active SSH session for a while now, and this is the first one that I can easily make work. Do you know if this technique could be modified to work using the terminal on a macOS or Linux based client (i.e. terminals other than PuTTY)?
If you have to do private key validation; at Command Prompt(cmd), run
What's the point of set PATH=C:\PuttySetupLocation ? Why don't you do C:\PuttySetupLocation\pscp directly? - Even if you want to modify PATH , you should add the new path, not reset it completely.
Running set PATH=C:\PuttySetupLocation does not reset the path, only adds PSCP to path as a new entry. Also, you are right about using C:\PuttySetupLocation\pscp .It may be also valid.
What password? Maybe you read my comment immediately after I've posted it with typo of "password", instead of "path". I've fixed it a second after posting (long before your comment).
A direct transfer like FTP is not possible, because all commands during your session are send to the server.
@user470184 If you managed to go two years without finding out how, some instructions as to how this may be done can be found at the bottom of: >this page
Transferring files with Putty (pscp/plink.exe)
Open command prompt by typing cmd
To transfer folders from your Windows computer to another Windows computer use (notice the -r flag, which indicates that the files will be transferred recursively, no need to zip them up): pscp -r -i C:/Users/username/.ssh/id_rsa.ppk "C:/Program Files (x86)/Terminal PC" ipython_user@10.15.48.54:/"C:/Program Files (x86)/"
To transfer files from your Windows computer to another Windows computer use: pscp -i C:/Users/username/.ssh/id_rsa.ppk "C:/Program Files (x86)/Terminal PC" ipython_user@10.15.48.54:/"C:/Program Files (x86)/"
Sometimes, you may only have plink installed. plink can potentially be used to transfer files, but its best restricted to simple text files. It may have unknown behavior with binary files (https://superuser.com/questions/1289455/create-text-file-on-remote-machine-using-plink-putty-with-contents-of-windows-lo): plink -i C:/Users/username/.ssh/id_rsa.ppk user@host hostfile"
To transfer files from a linux server to a Windows computer to a Linux computer use pscp -r -i C:/Users/username/.ssh/id_rsa.ppk "C:/Program Files (x86)/Terminal PC" username@10.15.48.16:/home/username
cmd.exe , require elevated prompt:
Powershell:
Double-click on the *.reg file and accept the import.
cmd.exe , require elevated command prompt:
Как перенести настройки putty
Поскольку putty хранит настройки в реестре, то чтобы перенести настройки и информацию о подключениях на другой компьютер, нужно предварительно выполнить экспорт настроек, сохранив настройки putty в файл.
Затем вам нужно будет перенести файл настроек Putty на другой компьютер и импортировать записи настроек в реестр.
Вы можете легко восстановить ваши настройки на любом компьютере, импортировав записи из файла. Для импорта настроек вам достаточно нажать на файле правой кнопкой мыши и выбрать «Слияние»
Как сохранить настройки Putty
Можно открыть редактор реестра и экспортировать ключ HKEY_CURRENT_USER\Software\Simontatham.
Чтобы выполнить автоматический экспорт настроек, выполните следующую команду:
Она создаст на рабочем столе файл putty-registry.reg, содержащий все настройки и информацию о подключениях, сохраненную в putty.
Пошаговые действия для переноса настроек Putty
Таким образом, настройки будут занесены в реестр интересующего нас компьютера. При запуске Putty вы увидите те настройки, которые когда-то сохраняли и вам не придется вбивать их заново вручную.
What is the command to transfer files from my local machine to the machine I'm logged into on PuTTY?
Читайте также: