connection layer<\/em>, which manages the connection between the client and the server after a successful authentication.<\/li>\n<\/ol>\n\n\n\nTo establish a connection with an SSH server, the client needs to initiate a request with an SSH server. Once the server receives the connection request, encryption negotiation begins. The server sends a public cryptography key to the client and the key is used to verify the identity of the SSH server. Afterwards, the server negotiates parameters and creates a secure channel for the client. Finally, the client logs into the server.<\/p>\n\n\n\n <\/figure>\n\n\n\nEnabling SSH to Securely Access a Remote Mac\u2019s Shell<\/h2>\n\n\n\n SSH remote login to an Apple computer is disabled by default. In this section, we will take you through the process of enabling SSH.<\/p>\n\n\n\n
Open the Terminal App on Your MacBook<\/h3>\n\n\n\n You can do this by searching \u201cterminal\u201d using the Spotlight search option of your computer or navigating through Applications > Utilities > Terminal<\/strong>.<\/p>\n\n\n\nEnter and Run the Command<\/h3>\n\n\n\n To enable SSH, enter and execute the -setremotelogin<\/code> command as follows:<\/p>\n\n\n\nsudo systemsetup -setremotelogin on<\/code><\/p>\n\n\n\nIt is necessary to add sudo because the command requires administrator privileges. You will be required to input your user password when you run the command. Provide the password and press enter (as shown in Figure 1 below).<\/p>\n\n\n\nFigure 1<\/figcaption><\/figure>\n\n\n\nNote: In Mac, SSH is also known as Remote Login.<\/p>\n\n\n\n
Check if SSH is Enabled<\/h3>\n\n\n\n Once you complete step 2, you will not get any message to confirm that SSH has been enabled. However, you can use a command to know if SSH has been successfully enabled. Simply run and execute the following:<\/p>\n\n\n\n
sudo systemsetup -getremotelogin<\/code><\/p>\n\n\n\nIf SSH is on, you will get a message that reads “Remote Login: On” <\/strong>(refer to Figure 2).<\/p>\n\n\n\nFigure 2<\/figcaption><\/figure>\n\n\n\nWant to Disable SSH?<\/h2>\n\n\n\n While you have now learned how to enable SSH, it\u2019s equally important to know how to turn it off in case you wish to disable any remote login in future. The process of disabling SSH is similar to the process you followed to enable it.<\/p>\n\n\n\n
Simply open the terminal app and run the following command:<\/p>\n\n\n\n
sudo systemsetup -setremotelogin off<\/code><\/p>\n\n\n\nAfter successfully executing the command, you will get a question: \u201cDo you really want to turn remote login off? If you do, you will lose this connection and can only turn it back on locally at the server (yes\/no)?\u201d Refer to Figure 3.<\/p>\n\n\n\nFigure 3<\/figcaption><\/figure>\n\n\n\nType \u201cyes\u201d to confirm. This will disable SSH and disconnect any active SSH connections on your MacBook. <\/p>\n\n\n\n
Bypass the Yes\/No Question Anytime You Disable SSH<\/h3>\n\n\n\n Meanwhile, if you want to bypass being asked a question of yes\/no anytime you try to disable SSH, you can use the -f<\/code> flag to force the command to execute immediately and without the prompt.<\/p>\n\n\n\nsudo systemsetup -f -setremotelogin off<\/code><\/p>\n\n\n\nTo confirm if SSH is off, run the command: sudo systemsetup -getremotelogin<\/code><\/p>\n\n\n\nYou should get a message that reads “Remote Login: Off” <\/strong>(as shown in Figure 4).<\/p>\n\n\n\nFigure 4<\/figcaption><\/figure>\n\n\n\nFinal Thoughts<\/h2>\n\n\n\n As stated earlier, SSH is a cryptographic network protocol used to establish a secure, encrypted connection between two computers. In this article, you learned how to enable or disable SSH by running a command in the terminal app. Enabling SSH will allow you to remotely connect your macOS device, transfer files, and perform admin tasks securely.<\/p>\n\n\n\n
There are two other ways you can enable SSH for macOS devices:<\/p>\n\n\n\n
\nTurn on SSH in the GUI by going to System Preferences > Sharing > Remote Login.<\/li>\n\n\n\n Leverage the Commands tab<\/a> in the JumpCloud Directory Platform to enable SSH across your fleet.<\/li>\n<\/ol>\n\n\n\nOverall, SSH keys provide a more secure and convenient way to authenticate remote systems than the conventional username\/password approach. To ensure the authorization each SSH key has is accurate, it\u2019s important to deploy the right management tool and put sound policies in place. Simplified SSH key management<\/a> is one of the many ways IT admins can make their lives easier with our cloud directory platform. Sign up for a trial of JumpCloud<\/a> today to test out the possibilities in your own environment.<\/p>\n","protected":false},"excerpt":{"rendered":"In the first of our series on important macOS commands for IT admins, learn how to enable SSH on a Mac to securely access remote devices.<\/p>\n","protected":false},"author":131,"featured_media":59289,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","inline_featured_image":false,"footnotes":""},"categories":[23,2781],"tags":[],"collection":[2778,2775],"platform":[],"funnel_stage":[3017],"coauthors":[2568],"acf":[],"yoast_head":"\n
How to Enable SSH on Mac - JumpCloud<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n\t \n\t \n\t \n