To turn on SSH on a Mac, open System Settings, choose General, then Sharing, and switch on Remote Login. This enables the Mac’s built-in SSH server so you can connect to it from another device using a user account allowed by the Remote Login settings.
What SSH and Remote Login Do
SSH, short for Secure Shell, is a way to access a computer’s command line over a network through an encrypted connection. On macOS, Apple provides the SSH server as part of the system; the Remote Login control turns that server on and lets you choose who may connect.
SSH is useful for administering a Mac without sitting in front of it, transferring files with tools such as SFTP, or running commands from another computer. It does not share the Mac’s graphical desktop. For screen sharing, use the separate Screen Sharing feature instead.
Turning on Remote Login does not automatically make the Mac reachable from everywhere. The connecting device still needs a network route to the Mac, and the Mac must be awake and connected. A home router, firewall, or organization’s network rules may also restrict connections.
Turn On Remote Login in System Settings
- On the Mac you want to access, open the Apple menu and select System Settings.
- Select General, then Sharing.
- Find Remote Login and turn it on. If macOS asks for an administrator password or confirmation, approve the change.
- Check the access setting beside “Allow access for.” Choose All users only if every local account should be able to attempt an SSH login. Otherwise, choose Only these users and add the specific accounts that need access.
- Read the connection information shown in the Remote Login panel. It includes a suggested SSH command and the Mac’s local network name or address.
The wording and layout can vary slightly across macOS releases, but Remote Login is under General and Sharing in current System Settings. On older macOS versions, open System Preferences and choose Sharing; Remote Login is in that pane.
Connect From Another Device
On a Mac or another device with an SSH client, open Terminal and use the command shown in the Remote Login panel. The general form is:
ssh accountname@hostname
Replace accountname with the short account name on the destination Mac and hostname with its reachable name or IP address. For example, if the account is sam and the Mac’s local address is 192.168.1.25, enter ssh sam@192.168.1.25. The first time you connect, SSH may ask whether to trust the host key; verify that you are connecting to the intended Mac before accepting. Then enter the account password when prompted. Password characters normally do not appear as you type.
Use the account’s short name, not necessarily the full name shown on the login screen. To check a Mac’s short account name, open Terminal on that Mac and enter whoami. The device running the SSH command must be able to reach the destination Mac over the network.
Choose Access and Find the Mac
The Remote Login access choice determines which local accounts can authenticate. “All users” is convenient for a private, trusted network, but it expands the list of accounts that can try. “Only these users” is a narrower choice for a Mac shared by several people. A permitted account still needs valid credentials; enabling SSH does not create a new account or remove the normal sign-in requirements.
For devices on the same home or office network, use the local hostname or address displayed in Sharing. A local hostname may end in .local. You can also find the Mac’s network address in its network settings. Addresses assigned by a router can change, so a saved address may stop working after a network change.
Connecting from outside the local network is a different setup. The Mac must be reachable through the router or other network, and the network administrator may need to configure access. Do not assume that turning on Remote Login publishes the Mac to the internet; it generally enables the service, not a complete remote-access route. Avoid exposing SSH broadly unless you understand the network and account security implications.
Security and Good Practice
- Limit permitted accounts. Select “Only these users” and allow only accounts that need remote access.
- Use strong account passwords. SSH access can provide command-line control under the account’s permissions, so protect the account as carefully as local sign-in.
- Turn it off when finished. If you no longer need remote access, return to General > Sharing and disable Remote Login.
- Keep macOS updated. Updates include system changes and security fixes; use the normal Software Update settings.
- Be cautious on untrusted networks. Encryption protects the SSH connection, but it does not make an unknown destination trustworthy or compensate for weak account security.
SSH is encrypted in transit, which helps protect commands and credentials from being read on the network. It is not a substitute for controlling who can log in, protecting the Mac itself, or checking that the host you are connecting to is the right one.
Common Connection Problems
- “Connection refused” or a timeout: Confirm Remote Login is on, the Mac is awake, and both devices can reach each other. Check that you used the destination Mac’s current hostname or address.
- “Permission denied”: Check the short account name and password, and confirm that the account is included under “Only these users” if that option is selected.
- The hostname does not resolve: Try the local IP address shown in network settings. A name ending in
.localmay not resolve across separate networks. - The Mac sleeps: A sleeping Mac may not respond to a connection attempt. Review its battery and lock-screen settings for available wake or sleep options; settings differ by Mac and macOS version.
- You are connecting from another network: A local address such as
192.168.x.xis generally not reachable directly from the internet. Network routing and firewall rules must permit the connection.
When diagnosing a problem, test from another device on the same local network first. This helps distinguish a Remote Login or account issue from a router or external-network issue.
Frequently Asked Questions
Does turning on SSH let me control the Mac’s desktop?
No. SSH gives command-line access. Use Screen Sharing or another appropriate remote desktop feature if you need to see and interact with the graphical interface.
How do I turn SSH off on a Mac?
Open System Settings > General > Sharing and switch off Remote Login. This disables the built-in SSH server for new connections.
Can I SSH into my Mac from an iPhone or Windows PC?
Yes, if the device has an SSH client and can reach the Mac. Enter the Mac account name and its hostname or network address in that client.
What username should I use for Mac SSH?
Use the short name of a permitted account on the destination Mac. On that Mac, Terminal’s whoami command displays the current account’s short name.
Is Mac SSH enabled by default?
Remote Login is controlled separately in Sharing. Check its switch rather than assuming SSH is enabled or disabled on a particular Mac.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Immortals Fenyx Rising Co-op, Crossplay and Friends
- AI Inference Near the Device: When It Makes Sense
- Restore Default Settings on a Sons of the Forest Server
- Best Music Streaming Service in India: How to Choose
- How to Clean Gaming Headset Ear Pads Safely
- First Light Trophy List and How to Earn Them