Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing PuTTY sessions #10943

Open
Draghmar opened this issue Aug 13, 2021 · 21 comments
Open

Importing PuTTY sessions #10943

Draghmar opened this issue Aug 13, 2021 · 21 comments
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@Draghmar
Copy link

Draghmar commented Aug 13, 2021

Description of the new feature/enhancement

I wonder if there's a chance for (or a way if it is there and I can't simply find it ;)) making import and later sync for PuTTY sessions. I do know that PuTTY can't be used inside Terminal but it would be great if we could simply import and manage sessions instead of making all the entries.

Proposed technical implementation details (optional)

There are tools that wraps putty (like SuperPuTTY for example) and they have a way to import sessions by opening window for that.
What I'd like to get is to have new option when adding new profile. That could be a button that would open window with a list of PuTTY sessions where I could choose which one I'd like to import as a Terminal profiles.
As a bonus feature it would be great to have checkbox for syncing all the profiles so if I'll get a new one in putty it will show up in Terminal as well.
Cherry on top would be to have auto sync for all the imported profiles to stay up to date with Putty but at least manual sync would be enough.

Is that even possible to achieve?

@Draghmar Draghmar added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Aug 13, 2021
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 13, 2021
@synner88
Copy link

Putty sessions are stored at HKCU\SOFTWARE\SimonTatham\PuTTY\Sessions.
From there you can extract protocol, username, hostname, portnumber but many of the values are protocol-specific (e.g. PublicKeyFile).
Most importantly, you need to map protocol to a specific command/tool for Terminal to call (with a specific argument list).

@WSLUser
Copy link
Contributor

WSLUser commented Aug 13, 2021

You could try creating a profile that calls putty.exe and if putty allows commandline parameters for choosing a particular saved session config, you could add that at the end. Otherwise, I'd suggest creating a profile using ssh.exe from Win32-OpenSSH and define the username@hostname there.

@KalleOlaviNiemitalo
Copy link

A Windows Terminal profile that calls putty.exe would be inconvenient to use because PuTTY opens its own window instead of using the console.

@zadjii-msft zadjii-msft added the Product-Terminal The new Windows Terminal. label Aug 13, 2021
@Draghmar
Copy link
Author

Draghmar commented Aug 13, 2021

My suggestion was more on how to make it easier to import into Terminal. I know how can I do this manually (it's even in FAQ :P) but it would be so much more convenient if there was built-in tool for that (especially for lazy people like me ;)). And one of the reasons for that is the fact that you can't use putty.exe inside Terminal because it will open new window, as @KalleOlaviNiemitalo also pointed out.

@zadjii-msft
Copy link
Member

This is a fun idea for a dynamic profile generator. Thanks!

@zadjii-msft zadjii-msft added Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-Settings Issues related to settings and customizability, for console or terminal labels Aug 16, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Aug 16, 2021
@zadjii-msft zadjii-msft added this to the Icebox ❄ milestone Aug 16, 2021
@DHowett
Copy link
Member

DHowett commented Aug 16, 2021

Notes for someone who may be interested in working on it: putty ships a command-line SSH client of its own, plink, which is aware of putty profiles. That may be even easier than trying to gin up a ssh.exe command line.

@KalleOlaviNiemitalo
Copy link

When I last tried running plink.exe in Windows Terminal, I could not get the VT sequences to work. I don't remember whether the problem was in input or in output. Anyway, plink is not intended for interactive use.

@zadjii-msft
Copy link
Member

Anyway, plink is not intended for interactive use.

After 30 seconds of experimentation - yea that's the impression I get. Arrow keys definitely didn't work, and Ctrl+C did instantly kill plink, instead of get sent to the client. Output seemed generally okay, but that's probably because we're opting them in to VT processing by default for output. (I idly wonder if this would work if we also opted them in to vt input by default)

That being said, the sessions are all listed in Computer\HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions, so enumerating them is easy enough. It's just the input thing that seems wonky.

@DHowett
Copy link
Member

DHowett commented Aug 16, 2021

Ah, that's a fair point. Thanks!

@pathomas
Copy link

I realize we're all used to PuTTY, but ssh has been part of windows for a while now. You can definitely get the same effect with Ctrl+C working if you use ssh instead of plink.

The command line I use is
C:\Windows\System32\OpenSSH\ssh.exe pathomas@waffles

@zadjii-msft
Copy link
Member

I mean, yes, we're all aware that you can use ssh.exe instead. The whole point of this thread is to make it easier for someone to migrate the settings that they have already in putty directly to Windows Terminal profiles 😝

Using ssh.exe as the client commandline definitely would work, but then we'd need to manually reconstruct the rest of the ssh commandline from the putty registry settings, where plink doesn't have that issue. I'm sure there's a happy medium between those two.

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 27, 2021
@Kipjr
Copy link

Kipjr commented May 15, 2022

@zadjii-msft , xould you take a look at this and perhaps give some feedback?

As this is not yet fixed I've got a small workaround for this:
https://github.com/Kipjr/powershell/blob/main/Putty2WinTerminal.ps1
It parses the Putty configuration and adds it to Settings.json

@zadjii-msft
Copy link
Member

(I'm tagging this for discussion because I never saw the above comment till today, and I want to circle back on it once I'm off paternity leave)

@zadjii-msft zadjii-msft added the Needs-Discussion Something that requires a team discussion before we can proceed label Oct 3, 2022
@zadjii-msft zadjii-msft removed the Needs-Discussion Something that requires a team discussion before we can proceed label Dec 5, 2022
@zadjii-msft
Copy link
Member

That's a slick script, and looks like it does most of what people would want. We're trying to draw the right balance here between what dynamic profile generators to include in-box, and which to exclude. If we add too many, then people's settings get polluted with quite a few dynamic profiles, and our experience for configuring those today is... less than great.

The code in #13763 might help with this, for letting floks nest profiles in the dropdown easily, but that's not a good enough solution.

I think (at the moment), I'd rather this stay an external tool. Something folks can easily run and synthesize profiles for themselves, but not forced on everyone by default. We've got near-ish term plans for dynamic profiles as extensions, and this would make a GREAT test case for that. In fact, I'm putting it into the planning timetable as our prototypical example of such an extension.

@zadjii-msft zadjii-msft modified the milestones: Icebox ❄, Up Next Dec 5, 2022
@nikunj436
Copy link

Do we able to get this feature in windows terminal as tab? like supperputty? In supperputty I workaround used permanet doskey to saved my username and password and limit windows terminal to one so every new session can open that same supperputty, but I would like 1 place for everything to terminal. it would more clean view if this can happen in terminal.

doskey I used like be
p=putty -l username -pw pass_example $*
s=superputty -l username -pw pass_example $*

p ip or s ip

it will open all and login,

openssh one issue it take -l argument but do not take -pw argument, secondly have to add all algorithm setting as i login to some devices are old that support old one, putty this support bydefault.

@SailorMax
Copy link

While it is not integrated in WT, you can try this solution: https://github.com/SailorMax/psh

@blgram
Copy link

blgram commented Oct 17, 2023

While it is not integrated in WT, you can try this solution: https://github.com/SailorMax/psh

Is it possible to use it for Serial Connections?

@SailorMax
Copy link

Is it possible to use it for Serial Connections?

Currently only ssh. I never used Serial Connections.
Can you check plink.exe? I'll try to use it for Serial Connections if it has acceptable functionality.

@blgram
Copy link

blgram commented Oct 18, 2023

Is it possible to use it for Serial Connections?

Currently only ssh. I never used Serial Connections. Can you check plink.exe? I'll try to use it for Serial Connections if it has acceptable functionality.

I am not able to Console Cisco Switch. It seems Putty is standalone GUI, thus it might be not possible to make serial connection through WT. I am looking a way to make Serial Connection through/within Windows Terminal.

@SailorMax
Copy link

Putty is standalone GUI, thus it might be not possible to make serial connection through WT

To work in WT you can use plink.exe from putty's package (plink -serial COM1 -sercfg 115200,n,8,1,N).
Today I also added support this type of putty's sessions in psh (psh session_name or psh COM1:115200,n,8,1,N) [it work via plink!]

@blgram
Copy link

blgram commented Oct 22, 2023

Putty is standalone GUI, thus it might be not possible to make serial connection through WT

To work in WT you can use plink.exe from putty's package (plink -serial COM1 -sercfg 115200,n,8,1,N). Today I also added support this type of putty's sessions in psh (psh session_name or psh COM1:115200,n,8,1,N) [it work via plink!]

Interesting. Plink is working, however I couldn't make psh, and that's fine. My goal is to be able to manage/do my job all in WT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests