Windows Terminal SSH

Windows Terminal SSH
  • 2 minutes to read

Windows 10 has a built-in SSH client that you can use in Windows Terminal.

In this tutorial, you’ll learn how to set up a profile in Windows Terminal that uses SSH.

[external_link_head]

Create a profile

You can start an SSH session in your command prompt by executing ssh [email protected] and you will be prompted to enter your password. You can create a Windows Terminal profile that does this on startup by adding the commandline setting to a profile in your settings.json file inside the list of profile objects.

[external_link offset=1]

{ "name": "[email protected] ssh profile", "commandline": "ssh [email protected]" } 

For more information, see:

  • Windows Terminal Profile – General settings

Specify starting directory

To specify the starting directory for a ssh session invoked by Windows Terminal, you can use this command:

{ "commandline": "ssh -t [email protected] \"cd /data/bob && exec bash -l\"" } 

The -t flag forces pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, e.g. when implementing menu services. You will need to use escaped double quotes as bourne shell derivatives don’t do any additional parsing for a string in single quotes.

[external_link offset=2]

For more information, see:

  • GH Issue: How to specify the starting directory for a ssh session?
  • StackOverflow: How can I ssh directly to a particular directory?

Resources

  • How to Enable and Use Windows 10’s New Built-in SSH Commands

[external_footer]

Scores: 4.8 (17 votes)