ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer How-Tos & Tutorials

How to use SSH on Windows and Mac

Updated on March 20, 2014
Source
Source

Secure Shell - encrypted access for remote administration

SSH provides an encrypted alternative for the telnet and rsh suite of remote access functions. The first version was released in 1995, but ssh2 is preferred due to vulnerabilities discovered in ssh1.

If you use telnet on an insecure network, it's time to move on to SSH. Newsflash: there's no such thing as a secure network.

If you spend too much time looking up host names or IP addresses or usernames, then you will want to take advantage of this tutorial.

This tutorial will lead you through the following scenarios:

  • create a saved session
  • use keyboard shortcuts to access saved sessions

Each scenario will be presented first on Windows, then on Mac.

Note that there are enough similarities between the command line environment of Mac and Linux that the astute observer should be easily able to adapt the Mac tips to Linux.

Client workstation

My client operating system of choice is

See results

Windows

System control panel
System control panel | Source
Environment variables
Environment variables | Source
Modify the path
Modify the path | Source

Mac

enable the option "Keep in Dock"
enable the option "Keep in Dock" | Source
pull-down menu for Spotlight search
pull-down menu for Spotlight search | Source

Prepare your environment

If you're familiar with ssh and already have a client set up, skip this section.

Windows

If you're on a Windows computer, visit the Putty downloads and grab the latest installer. I installed using all the default options, which drops the executable into my C drive under the Program Files directory, creating a new directory named Putty.

Once the putty installation has completed, open your System control panel and select Advanced system settings. Scroll through the Environment variables until you find Path. Double-click the word Path and type in ;C:\Program Files\Putty at the end. (If you changed the default installation options, modify Path to match your changes.)

To launch Putty, click on the Start menu, look under All Programs, and scroll down until you find the PuTTY folder. Click on the PuTTY icon.

Alternatively, you can launch Putty using only the keyboard. When we changed the Path environment variable, we made putty.exe available from the Run command. Access the Run command with the key-combo Windows-r, type putty, then press the enter key.

Look on the sidebar for the screencaps.

Mac

Open the Applications folder, then open the Utilities folder. Click on the Terminal.app icon. You may want to pin this app to your Dock. Go to the Dock, right-click (or option-click) the Terminal.app icon, and select Options -> Keep in Dock.

If you find the mouse's point-and-click routine takes too long, try launching Terminal from Spotlight. The keyboard shortcut for Spotlight is command-space. You should see a drop-down window pop up from the upper right corner of your screen. Type in Terminal and press enter.

Terminal brings up Mac's built-in terminal emulator, which defaults to a bash command line. From the command line, type in ssh -V and you will see the version header from Mac's built in ssh client.

The screencaps on the side show the Spotlight window and the Dock options.

Create and save a session on Windows

Using the keyboard shortcut Windows-r to open the run command, type in putty then press enter. Under "Host Name" type in the IP address of the session you wish to open. Under "Saved Sessions" type in the shortcut name for the session. Select Connection -> Data from the Category tree on the left, and specify the remote username under "Auto-login username". Click back to "Session" on the Category tree, and click Save. Double-click the saved session name to open the remote connection.

Note that multiple sessions can be saved, with unique usernames and hostnames set up for each session. Once you create a new session (i.e., "myhost") you can use the keyboard shortcut to access that session directly with the @ symbol

putty @myhost

For this section, I've posted a brief video tutorial instead of distinct screencaps.

cd .ssh
cd .ssh | Source
Add new session profile
Add new session profile | Source
Open ssh connection to new session
Open ssh connection to new session | Source

Create and save session on Mac

To set up a saved ssh session on Mac, we will need to create and edit text files. My text editor of choice on the Mac is vi but you can use any program that saves ASCII output. Open the Terminal app, and create (or open if it exists) the file ~/.ssh/config. (The tilde is a shortcut for your home directory /Users/yourUserName)

Let's save the session settings for ssh://jdubya@myhost - but it turns out, there's no DNS entry for myhost, so we'll have to save the IP instead of the hostname. No worries, we can handle that! Add the following lines to .ssh/config

Host myhost
Hostname 192.168.1.100
User jdubya

If there is a DNS name for the Host entry, then there's no need to specify a Hostname. Each distinct ssh profile will have its own Host, Hostname, and Username setting. Save your changes, and quit your text editor. Now access your saved session by typing the following command at the Terminal prompt:

ssh myhost

To see how these variables are put to use, try the command again as ssh -v myhost for verbose output. More information on ssh config options is available in the online manual.

For the next SSH tutorial ...

I want to see a deeper dive on

See results

More to explore

OK, just kidding, I can't take you deeper into the Mariana Trench but this short introduction only scratches the surface of what's available from ssh.

As the poll suggests, key authentication saves you the trouble of remembering passwords. Or for another thought, key auth can facilitate secure scripting by keeping passwords out of clear text script files.

Port forwarding opens up lots of possibilities.

If you throw in some scripting (Perl is my ax of choice but it's not the only tool in the shed) then dynamic interactive scripts can take advantage of two-way communication over secure channels.

Let me hear from you in the comment section, and I'll put together a hub on the topic of your choice. Good luck with ssh!

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: "https://hubpages.com/privacy-policy#gdpr"

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)