This guide will walk you through setting up SSH on your Ubuntu iMac and then connecting to it seamlessly using your latest iMac.
Prerequisites:
- Two iMacs:
- Your latest iMac (running macOS - this will be your client machine).
- Your 2012 iMac with Ubuntu 24.04 LTS successfully installed and running (this will be your server machine).
- Network Connection: Both iMacs must be connected to the same local network (via Ethernet or Wi-Fi).
- Basic Terminal Familiarity: Knowing how to open a terminal and run basic commands on both macOS and Ubuntu.
Step 1: Prepare the Ubuntu Server (2012 iMac)
First, we need to ensure the SSH server software is installed and running on your Ubuntu machine.
- Open the Terminal: On your Ubuntu 2012 iMac, open the Terminal application.
- Update Package Lists: It's always a good idea to update before installing new software.
Enter your password when prompted.Bashsudo apt update
- Install OpenSSH Server: If it's not already installed, install the SSH server package.
TypeBashsudo apt install openssh-server
Y
and press Enter if prompted to confirm the installation. - Check SSH Server Status: Verify that the SSH service is running.
You should see output indicatingBashsudo systemctl status ssh
active (running)
. Pressq
to exit the status view. - Find Your Server's IP Address: You'll need this address to connect from your client machine.
Look for the network interface name (commonlyBaship addr show
eth0
for wired orwlan0
for wireless) and find theinet
address. This is your local IP address (e.g.,192.168.1.100
). Note this down.
Your Ubuntu server is now ready to accept SSH connections.
Step 2: Connect from Your macOS Client (Latest iMac)
Now, switch over to your modern iMac and initiate an SSH connection to the Ubuntu server.
- Open the Terminal: On your latest iMac, open the Terminal application (Applications > Utilities > Terminal).
- Attempt the SSH Connection: Use the
ssh
command followed by your Ubuntu username and the server's IP address you noted in the previous step. ReplaceBashssh your_ubuntu_username@your_ubuntu_server_ip
your_ubuntu_username
with your actual username on the Ubuntu machine andyour_ubuntu_server_ip
with the IP address you found. - Handle the First Connection: The first time you connect, you'll see a message about the host's authenticity and be asked if you want to continue.
TypeThe authenticity of host 'your_ubuntu_server_ip (your_ubuntu_server_ip)' can't be established. ... Are you sure you want to continue connecting (yes/no/[fingerprint])?
yes
and press Enter. This adds the server's fingerprint to your known hosts list, so you won't be asked again unless the fingerprint changes (which could indicate a security issue). - Enter Your Password: You will be prompted for your password on the Ubuntu machine.
Type your password and press Enter. Note that the characters won't appear as you type.your_ubuntu_username@your_ubuntu_server_ip's password:
If successful, you will see the command prompt of your Ubuntu machine. You are now remotely connected! You can run commands directly on the server. Type exit
to close the SSH connection.
Step 3: (Optional but Recommended) Set Up SSH Key-Based Authentication
Typing your password every time can be tedious, and key-based authentication is generally more secure.
- Generate SSH Keys (on macOS Client): If you don't already have SSH keys on your latest iMac, generate them.
Press Enter for the default location (Bashssh-keygen -t rsa -b 4096
~/.ssh/id_rsa
). You can optionally set a passphrase for extra security (recommended), or leave it blank for no passphrase. - Copy Public Key to Ubuntu Server (from macOS Client): This command copies your public key (
id_rsa.pub
) to the server and adds it to theauthorized_keys
file, allowing key-based logins. You will be prompted for your Ubuntu password one last time. After this, it will copy the key.Bashssh-copy-id your_ubuntu_username@your_ubuntu_server_ip
- Test Key-Based Login (from macOS Client): Try connecting again using the
ssh
command from Step 2. This time, you should log in without being asked for a password (unless you set a passphrase, in which case you'll be asked for that).Bashssh your_ubuntu_username@your_ubuntu_server_ip
Troubleshooting Tips:
- Firewall: Ensure the firewall on your Ubuntu server (if active) allows incoming connections on port 22 (the default SSH port).
sudo ufw allow ssh
is a common command for this withufw
. - Incorrect IP: Double-check the IP address you are using. It should be the local network IP (e.g., 192.168.x.x or 10.0.x.x).
- SSH Service: Verify the SSH server is running (
sudo systemctl status ssh
). - Username/Password: Ensure you are using the correct username and password for your Ubuntu account.
- Key Permissions: If using key-based auth, ensure permissions on
.ssh
folder (chmod 700 ~/.ssh
) andauthorized_keys
file (chmod 600 ~/.ssh/authorized_keys
) on the server are correct.
Conclusion
You've successfully transformed your older iMac into a powerful, accessible development machine running Ubuntu 24.04. By setting up SSH you can now code, build, and manage projects on it directly from the comfort of your latest macOS machine. This not only gives your older hardware a new lease on life but also provides a flexible and efficient remote development environment.