QUESTION :
I am currently testing SSH on my windows laptop and I followed this site to set up a SSH server on my pc:
In the section “Connect to OpenSSH Server”, what is the field “username” and “servername” referring to in the command:
ssh username@servername
How to I identity the username and servername of my own pc? I have tried commands like whoami or hostname and tried logging from another linux OS but did not work.
Also, is the command above windows client to windows server specific?
ANSWER :
I think this is what you are expecting. username
refers to the username on the remote system that you are trying to connect to. servername
refers to the IP address of the remote system. If you are on the same network with “name resolution i.e. DNS” then you can use the name for the machine rather than its IP address.
Hence,
ssh username@servername
would map to
ssh [user-name-on-remote-sys]@[ip-address-of-remote-sys]
If your SSH server is on Windows, you can find the username
and the servername
by using powershell.
username –
$env:USERNAME
servername –
ipconfig | select-string ('(s)+IPv4.+s(?<IP>(d{1,3}.d{1,3}.d{1,3}.d{1,3}))(s)*') -AllMatches | %{ $_.Matches } | % { $_.Groups["IP"]} | %{ $_.Value }
For example, if the username is “jack” and the servername is “192.168.1.101”, to connect from another machine you need to use the following,
ssh jack@192.168.1.101