Macos Find Computer Ip For Remote Ssh

SSH or Secure Shell is a protocol that allows a secure way to access remote computer.SSH implementation comes with scp utility for remote file transfer that utilises SSH protocol. Other applications such as sftp and rsync can also make use of SSH to secure its network transaction. All these applications allow us to copy our files from local to remote server and to copy files from remote. SSH-based remoting doesn't currently support remote endpoint configuration and Just Enough Administration (JEA). SSH remoting lets you do basic PowerShell session remoting between Windows and Linux computers. SSH remoting creates a PowerShell host process on the target computer as an SSH.

Read this article at https://www.pugetsystems.com/guides/1470
Written on May 31, 2019 by Dr Donald Kinghorn

Introduction

Secure Shell (ssh) is a standard tool included on most 'network' operating systems i.e. Linux, UNIX, MacOS, etc.. In the past Windows required a 3rd party application to get even a usable ssh client. For users who needed to connect securely to the rest of the world with a command line interface PuTTY has been a common addition. After several decades Microsoft finally has a native ssh client AND server on Windows! Both the client and server are standard (and in stable versions) on Windows 10 since the 1809 'October Update'.

For a developer or researcher it's not unusual to be working with several machines at the same time. Connecting remotely to servers or other workstations in a mixed OS environment is a common need. You can now connect from a Windows 10 system to Linux servers or workstations easily and you can go the other direction too. You can 'ssh into' a Windows 10 machine from Linux or other Windows machines. For me personally this kind of connectivity is essential. I may be using 3 or 4 different machine at the same time and I always have several terminal's open. I typically work with Linux and Windows 10 (locally or remotely) at the same time. The interoperability between Linux and Windows 10 has become very good.

This post is a setup guide and introduction to ssh client and server on Windows 10. I'm doing this partly as a reference for other posts that I'll be doing where this functionality will be utilized.

Documentation and Links

I am not going to cover much detail about using ssh. If ssh is new to you then note that Microsoft ssh is a native port of the widely used standard OpenSSH client and server. That means that most information about using ssh that you find online will apply even though those sources will likely be references from Linux, UNIX or MacOS. The official documentation for components of OpenSSH is the standard reference. The Windows Server documentation has a section titled 'OpenSSH in Windows'

The normal suite of of functions are included with the Windows 10 port,

  • ssh.exe, which is the SSH client used from the user's local system
  • sshd.exe, which is the SSH server that accept connections from other systems
  • ssh-keygen.exe generates, manages and converts authentication keys for SSH
  • ssh-agent.exe stores private keys used for public key authentication
  • ssh-add.exe adds private keys to the list allowed by the server
  • ssh-keyscan.exe aids in collecting the public SSH host keys from a number of- hosts
  • sftp.exe is the service that provides the Secure File Transfer Protocol, and- runs over SSH
  • scp.exe is a file copy utility that runs on SSH
Find computer ip address

The user applications that you will use most frequently are; ssh (secure shell), for connecting to other systems, and scp (secure copy) for for copying files and directories back and forth with remote systems.

Enable ssh and ssh server on Windows 10

Macos Find Computer Ip For Remote Ssh

I am using a fresh install of Windows 10 Pro 1903. I have done this on Windows 10 Home too.

The simplest way to setup ssh and ssh server is to use PowerShell. After all you do want to use the command-line, right?

You need administrator privileges to enable services so open Powershell as Administrator, (right click on the Powershell icon in the application menu)

The following command will show you the name and state of OpenSSH on your system,

You should see something like,

That is telling you that the ssh client is installed. (It's ready to use by default in recent Windows 10 builds.) The server is not setup yet.

Add the OpenSSh server component,

That command will download the server component and install it. Output will look like,

Note: If for some reason your systems showed 'NotPresent' for the client too then you would do the same command above but using 'OpenSSH.Client~~~~0.0.1.0'

You now have the ssh server installed but it is not running. The next command will start the service,

That will start silently. You can see that it is running with Get-Service,

You could stop it with, you guessed it, 'Stop-Service sshd'

Note: the name of the ssh server application is 'sshd'. This is a typical naming convention from UNIX. The 'd' means 'daemon'. Services in Linux/UNIX are called daemons. Now you understand the meaning of the BSD UNIX mascot 'Beastie' which you may have seen before.

In order to avoid having to manually start sshd you can do the following to have it start on boot.

The last thing to check is the firewall setting for sshd. It by default uses the port number 22. Enabling the service automatically created the following firewall rules,

Note: If you enable sshd you are creating an 'open port' for port 22. (Otherwise you wouldn't be able to connect to it.) If your system is exposed to the outside world then that might bother you. You can do things to tighten up security like disallowing passwords and requiring only 'public-key' access. I'm not going to cover any of that here. If you are on a private LAN you don't have too much to worry about, but always be security conscious and use good passwords!

Now that you have the server up and running you should close the Powershell that you were running as Administrator. Start another Powershell as your normal user for the examples below.

Using ssh on Windows 10

Now the fun stuff.

The basic connection command (on any OS) for ssh looks like,

If your user name on the system you are connecting from is the same as your user name on the system you are connecting to, then you can leave out the 'user-name-on-remote-sys@' part. There are a lot of options for ssh, to dig deeper look at the docs

If you are on a network with 'name resolution i.e. DNS' then you can use the name for the machine rather than it's ip address.

ssh from Windows 10 to Linux

For this example I'll go through the details you see when connecting to a Linux machine. I'm using Powershell on Windows 10.

The following shows my Powershell command prompt with my user name 'don'. I'm connecting to one of my Linux systems on a local network. My user name is 'kinghorn' on that machine.

Macos Find Computer Ip For Remote Ssh Download

When you first connect to a machine that you haven't accessed before you will see something like,

Saying 'yes' adds a key entry to your '.sshknown_hosts' file. The next time you connect ssh will check that key and will either silently connect or give you a scary message if the key doesn't match. [A key mismatch can happen if you reinstall the remote system and it still has the same ip address. It will have a new ssh key. To fix that you will need to remove the old key from the 'known-hosts' file.]

After your first connection with ssh look in your user directory and you should see a new directory named .ssh There is a lot of configuration options that can be set in various files in that directory but you usually don't need to do anything in there unless you start doing 'public key exchange' for connecting to systems securely without passwords.

Here's an example Powershell session 'ssh-ing' into a Linux system,

From there I am securely connected to my Linux system with a command prompt ready for what ever I need to do.

ssh From Linux to Windows 10

Since we have the OpenSSH server running on the Windows 10 system we can ssh into that now too.

You might not think you wouldn't do that much but I actually do that fairly often. Right now I have 3 Windows 10 machines running and 3 Linux machines including one at a remote location that I am doing testing on. I can connect from any of these machines to any other with ssh. I am writing this post on a Linux machine and I just used the 'scp' command (part of the ssh bundle) to copy a directory of screen shots from a Windows 10 machine here. And, I didn't even have to go near the Windows machine to do that.

Here is a session where I log into my Windows 10 laptop from an Ubuntu 19.04 machine.

When you connect to the ssh server on Windows 10 you are given a CMD shell (the old DOS like shell). From there I started Powershell and then started bash on Ubuntu 18.04 using WSL (Windows Subsystem for Linux). The interoperability between Windows 10 and Linux is getting very good!

Note: On that laptop I am using a Microsoft account so my password was for that account.

ssh from Windows 10 to Windows 10

This works the same as any other combination of OS's. From Windows 10 you can use Powershell or CMD to run ssh. [If you have WSL installed you can use that too.] By default when you ssh to a Windows 10 machine you will login to CMD, it doesn't matter what you use to connect from.

In this example I am connecting to the the Windows 10 machine that I used for the ssh setup testing. I'm connecting from the laptop I connected to in the example above. (I'm not anywhere near that laptop.)

No big surprises here, it just works. It's basically the same connecting from any OS to another. The main difference is the 'shell' command that you connect from and the shell you connect to.

scp Secure Copy

One of the most useful tools in the ssh suite is 'scp'. This gives you a simple to use encrypted remote copy capability. It uses ssh as a 'tunnel' for the copy.

The basic usage of scp for a single file copy to a remote machine is

The important thing to note here is that after 'machine-ip' ( : ) is the top level directory of the machine. The path-to-the directory should use the syntax of the machine you are connecting to i.e. for Linux the directory separator is (/) for Windows it's (). Also, on Linux (~) is shorthand for the login users home directory. Connecting to windows you have to give the full path. And, on Linux when accessing Windows you have to quote (') the username and path because of the backslashes.

To copy a file from a remote machine to your local machine it's,

You can use dot (.) to indicate the current directory on the local machine.

To copy directories use, -r (recursive)

or

That may be confusing so here are some real examples.

Copy a directory named 'ssh-images' from Windows 10 to Linux starting on the Windows machine with Powershell.

That put the ssh-images in 'tmp' in my Linux home directory.

Now the same thing but starting from the Linux machine (using dot (.) for the current directory)

Note the full path and quotes.

Conclusions

I hope this guide is helpful to both Windows and Linux users who want better interoperability. I also hope this is encouraging for user who may have never used ssh. I think it's great how easy it is getting to be to work productively in a mixes OS environment. Microsoft, much to their credit, keeps making Windows more useful for mixed environments. I'm looking forward to the terminal application they will have out soon and to the release of WSL2. With those 2 application in place windows will be nicely interoperable and will be much improved as a solid developers system.

One of the main reasons I wrote this post is because I want to refer to it in a post about using Python Jupyter notebooks remotely between machines with different OS's. Expect to see that post soon. I may also write about using WSL and an Xwindow server on Windows 10.

Happy computing! --dbk @dbkinghorn

Looking for a
Scientific Compute System?

Do you have a project that needs serious compute power, and you don't know where to turn? Puget Systems offers a range of HPC workstations and servers tailored for both CPU and GPU workloads.

Why Choose Puget Systems?


Built specifically for you

Rather than getting a generic workstation, our systems are designed around your unique workflow and are optimized for the work you do every day.

Fast Build Times

By keeping inventory of our most popular parts, and maintaining a short supply line to parts we need, we are able to offer an industry leading ship time of 7-10 business days on nearly all our system orders.

We're Here, Give Us a Call!

We make sure our representatives are as accessible as possible, by phone and email. At Puget Systems, you can actually talk to a real person!

Lifetime Support/Labor Warranty

Even when your parts warranty expires, we continue to answer your questions and even fix your computer with no labor costs.

Click here for even more reasons!

Puget Systems Hardware Partners

The first step of troubleshooting any network problem is by pinging the IP address. Well, for that you need to know the IP address of the device or in cases IP address of all the devices in the network. There are several ways to do this and it entirely depends on the type of OS you are using. So, here are ways to find the IP Address of other devices in your network whether it is Windows, Android, iOS, Ubuntu and macOS.

Find IP Address of Other Devices on Your Network

In this article, we would be dealing with ways to find the private IP address of devices. Since the public IP address of all the devices within the same network remains the same i.e. the IP address of your router. In case, you are surprised by the word public and private IP address, it’s fairly simple. We have a detailed article on the difference between Public and Private IP and how to find the IP address of your own device.

1. How to Find IP Address in cmd For Network

The simplest way to do that in Windows is via the command line. To open the command prompt, type “cmd” on the Start menu. When you see the command prompt, right click on it and click on “Run as Administrator”.

In case you are using windows 10, you can directly run Command Prompt as an Administrator. Just right-click on the Start icon and click on Command Prompt(Admin).

Once you get the Command Prompt window, type the following command.

This will display the entire list of ARP entries. In case you are wondering, ARP is a network utility which maintains a track of all private IP addresses in the network.

Find IP Address of all Devices on Network Using Windows App

Find IP addresses through the command line might be the simplest way but not the most intuitive one. If you are not good with command line then you should download this Nirsoft utility called Wireless Network Watcher. The app has a portable version as well as exe.

As soon as you open the app, it starts scanning your network. Give it some time and it will list up the active connections in your network. The app will display all computers, smartphones and smart homes devices that are currently connected to the network. Along with the Device Name and IP address, it also presents other relevant information like MAC Address, Device Information etc along with its IP Address.

Read: Useful NirSoft Utilities That Every Windows User Should Try

2. Find all IP Address on the Network on Ubuntu

If you are working with Ubuntu or any Unix based OS then following are the ways. You can find the IP address using arp utility on the terminal. To open the terminal, right-click anywhere on the desktop and select “Open Terminal”.

Alternatively, you can also click on the Activities button at the top-left corner. This will bring up a search bar. Type Terminal on it and click on the Terminal icon once it pops up.

Once the terminal window opens, type the following command.

Another intuitive way to do this is through GUI. You have to install a tool called Angry IP Scanner. To install the Angry IP Scanner, you need to add an entry to the APT repository. APT (Advanced Packaging Tool) will then be able to fetch Angry IP Scanner from that particular location. To add the entry to the repository, type the following command

In case you are facing any issues with IP Scan Installation, make sure you have disabled gpg signatures check. You can do that by using the following command.

Once the entry is successfully added, we need to update the apt-get repository. To do that, type the following command

Once the apt repository is updated successfully, we can install the Angry IP Scanner application. Type the following command to fetch and install the application

Alternatively, if you have a browser you can also choose to install from the Angry IP Scanner website directly. Once you launch the app, it will the network you are connected to. Once, it is completed you can see the active connections in your network.

It has advanced tools like opening an FTP, Telnet, SSH connection for any of the IP devices. One thing it lacks is the inability to show hostnames for the devices. Most of the devices come up as N/A in the hostname. This can, however, be found out by using the host command but that takes an extra step.

Read: How to use Angry IP Scanner – Beginners Guide

3. How to Find who is on my WiFi on macOS

On macOS, the steps are quite similar to that of Ubuntu. To find the IP Address of other devices in your network via the command line, we need to first open the terminal. To do that, hit Cmd + Space to trigger Spotlight Search. Type “Terminal” on the search bar. Click on the Terminal icon when the search results populate.

Once the terminal window opens, type the following command.

This will list down the IP’s in your local network with their MAC Addresses. IPs are listed in round brackets followed by the MAC Address.

You cannot see the hostname (name of the computer or smartphone) through the command line. For that, you will have to do a host search separately for each IP. For example, if I need to find the hostname of 192.168.1.105, then I have to execute the following command

host 192.168.1.105

If the commands sound too much work, you can download a freeware from the Mac App Store called LAN scan. This app will list the IP addresses connected to the Local network along with other details like MAC addresses, Vendor etc. This app does not grab he Hostnames like Wireless Network Watcher. In order to get the hostnames of the devices, you need to get the premium variant. It can be purchased at a one-time fee of $7.

Also Read: Find Out Who’s Connected to Your WiFi

4. Android & iOS

On Android and iOS, there is no native way to check the IP Address of all the devices in the network. Hence, you will have to download a third-party app for this. Fing is a powerful network utility available for both Android and iOS which lets you scan your network. All you have to do is open the app and it will automatically start scanning all of the devices on your network. You’ll see all of their IP addresses, their names.

Unlike all the other apps we tested for Windows and Mac, Fing was the only that can figure out your connected devices brands and models. It can even fetch the device icon – wheater it’s an iPhone, MacBook, Router or Printer etc.

Check out Fing (iOS, Android)

Apart from just scanning IPs, you can also ping them or see the open ports on the particular device.

5. Router

One of the most popular ways to check who is connected to your WiFi network is by using your router’s web interface.

In case you have access to the router web interface, you can simply log in to the web portal and check. The web portal address, username, and password are mostly printed behind the router. In case you don’t have physical access to the router, the web portal URL is mostly the PC’s gateway address. To find that, open command prompt and type the following command.

The default username and password depends on the router’s manufacturer. Mostly, the username and password is “admin”. In case this doesn’t work for you, visit the official manufacturer site to get the default credentials.

Once you are logged in, look out for the Wireless or DHCP option. We need to navigate to the DHCP client’s list. On this page, you can see the entire list of devices connected to the network with their Client Name and MAC Address. You can also choose to block particular devices from this interface. To read more about it, check our article on how to block someone from your network.

The good thing about this approach is that you don’t have to install any software because you can access your router from any device. However, the only downside is that you need to know the router’s login credentials. If you are in a work environment then you might not have access to these details to log into the routers admin page. In that case, you will have to use the methods mentioned above.

Final Say

Macos Find Computer Ip For Remote Ssh Windows 10

Once you have found the IP address of the devices in your network. You can start configuring your network accordingly. You can start assigning Static IP Addresses to your device, configuring SSH, access your computer remotely etc.