0

My local computer with Windows 10 OS is the machine I'm lunching VS Code on, to connect to my Virtual Machine running Ubuntu 20.04 LTS.

On my local computer with Windows 10 OS I'm logged in as spinn, which becomes the default login for SSH connection lunched from VS Code, which is not the login I need for this SSH connection.

It looks like that: ![enter image description here

Following this video: [https://youtu.be/GEA4t1Z1OP4][2] I've created config file in .ssh folder on my local Windows 10 machine.

It looks like this:

Host 172.105.88.119:????          # I've changed my port number into ????, because I didn't want to share it here.
  HostName 172.105.88.119:????    # I've changed my port number into ????, because I didn't want to share it here.
  User shrek

Despite specifying user name in this config file, VS Code still populates user for SSH connection as spinn, which is the user name I'm logged in on my local Windows 10 computer.

There was never any dialog box to choose the user name I want to SSH as.

There is no spinn user on remote Ubuntu Virtual Machine I'm logging into. And I don't want to create spinn user there.

I need to use shrek user to log into this remote Ubuntu Virtual Machine.

Where can I specify this user name in VS Code?

EDIT

After applying @LSerni comment advice and @Nikita Kipriyanov answer, my Windows 10 .ssh/config file looks like this:

Host 172.105.88.119
Hostname 172.105.88.119
Port ????
User shrek

And it works fine.

1
  • 1
    Try specifying just the host, without the port: Host 172.105.88.119. Also, I am not sure whether HostName is case sensitive and spelled 'Hostname'.
    – LSerni
    Commented May 30, 2022 at 12:59

1 Answer 1

1

Your .ssh/config syntax is wrong.

The Host clause shoud not have any port and it should match the name you are specifying exactly.

The HostName also doesn't use any port. There is additional dedicated Port option to specify it:

Host 172.105.88.119
    Port ????
    User shrek

Notice, I didn't specified any HostName because it is inferred from the connection.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .