How do I find my username and servername for windows SSH server
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 [email protected]
Related videos on Youtube
MkSn1999
Updated on September 18, 2022Comments
-
MkSn1999 over 1 year
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?
-
Ramhound almost 3 yearsIs the machine connected to an AD directory? What is the output of
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name
, you are welcome to sanitize, if you wish. Be sure you provide the machine name and the username from the output. Is the client running the OpenSSH Server daemon? Please edit your question instead of submitting a comment. -
Nasir Riley almost 3 yearsAdd the output of the commands that you tried to your question.
-
-
Pro Chess almost 3 yearsLet us know if you are able to successfully ssh into your own server.
-
MkSn1999 almost 3 yearsI'm getting connection time out, not sure the reason though.
-
Pro Chess almost 3 yearsPlease edit your question to include the connection time out error message.