Creating an SSH Key on macOS for Automatic Login to Linux

Lately I have been working a lot in a terminal, specifically with Linux VMs in my home lab environment. Logging into multiple VMs over and over again over SSH has become fairly repetitive, that is until I created myself an SSH key for automatic login to my VMs.

To make things easier in the future when it comes to logging in via Terminal, you can setup SSH keys, so you won’t need a password when you login.

In my lab I have been primarily working with “minimal” installations of CentOS 6 and CentOS 7. When you do a “minimal” install of CentOS, the installation doesn’t install services like rsync and scp by default.

To install rsync and scp run the following on your CentOS client:

While still connected to my CentOS client, I created a directory to store my RSA keys with the following command:

With the Terminal open on your macOS system, enter the following command to generate an RSA key for login:

Press enter three times to accept the default settings.

On my macOS client, I like to tighten up the file system permission via the following example:

To verify our permissions we can run:

On my macOS client, I see the following:


Now that we have a key, the next thing to we need to do is copy the key to a directory on the server we intend to SSH to via Terminal. This will allow for password-less logins. With the IP or DNS name of the server we intend to connect to in mind, we can enter a command similar to the following to copy our key to the CentOS VM:

Like my macOS client where we created the RSA key, I will tighten up my CentOS VM SSH directories with the following commands from my macOS Terminal:

We should now be able to SSH from our macOS client to our CentOS VM without providing a password!






Installing PowerShell and VS Code on Mac OSX

“If someone told me 10 years ago that we (Microsoft) would offer SQL Server on Linux, I would have laughed them out of the room.” – Presenter while at Microsoft HQ Redmond, WA

It’s 2016 and Microsoft is breaking down the walls to its golden garden. With recent announcements coming from all across the board at Microsoft, it really is an interesting time. Never before have the tech giants been so open to sharing software across distributions and vendors.

In the early 1980s, Richard Matthew Stallman began a movement within the software industry, preaching that software should be free.

“Free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech,” not as in “free beer.”

Why would anyone in their right mind want to give away their software for free? I think the better question is: “How do we enable ourselves as developers and users, while protecting ourselves at the same time?” A user of the software should never be forced to deal with a developer who might or might not support that user’s intentions for the software. The user should never have to wait for bug fixes to be published. Code developed under the scrutiny of other programmers is typically of higher quality than code written behind locked doors. (We have been looking at you Apple and Microsoft) One of the great benefits of open source software comes from the users themselves. If a user desires or has the need for a new feature, they can add it to the original program and then contribute it back to the source so that everyone else can benefit from it. It is this sole reason why the popularity of GitHub has risen so dramatically in the last couple of years.

This line of thinking sprung a desire to release a complete UNIX-like system (Linux) to the public, free of license restrictions.

Just a couple of weeks ago Microsoft released this blog article announcing its latest “customer obsessed” move and to further convince us that “Microsoft loves Linux.” PowerShell and Visual Studio can now be ran on Linux and OSX.

It’s about time.

I have been running OSX Sierra on my 2015 13-inch MacBook Pro for as long as the public beta has been available, and now I can edit and run my PowerShell scripts directly in my Terminal.

Installing PowerShell

Firstly you will need to download the PKG package powershell-6.0.0-alpha.9.pkg from the page from here onto your macOS machine.

Either double-click the file and follow the prompts, or install it from the terminal.

Screen Shot 2016-09-04 at 1.13.35 PM

Once the package has been installed, running the command powershell puts you directly into a PowerShell session in your Mac OSX terminal:

Screen Shot 2016-09-04 at 1.12.00 PM

$PSHOME is/usr/local/microsoft/powershell/6.0.0-alpha.9/, and the symlink is placed at /usr/local/bin/powershell.

Installing VSCode


  1. Download Visual Studio Code for Mac OS X.
  2. Double-click on the downloaded archive to expand the contents.
  3. Drag Visual Studio to the Applications folder, making it available in theLaunchpad.
  4. Add VS Code to your Dock by right-clicking on the icon and choosing Options, Keep in Dock.

Tip: If you want to run VS Code from the terminal by simply typing ‘code’, VS Code has a command, Shell Command: Install ‘code’ command in PATH, to add ‘code’ to your $PATHvariable list.

After installation, launch VS Code. Now open the Command Palette (⇧⌘P) and typeshell command to find the Shell Command: Install ‘code’ command in PATH command.

OS X shell commands

After executing the command, restart the terminal for the new $PATH value to take effect. You’ll be able to simply type ‘code .’ in any folder to start editing files in that folder.

Installing PowerShell Extension

Launch the Visual Studio Code app by:

  • Windows: typing code in your PowerShell session
    • Press F1 (or Ctrl+Shift+P) which opens up the “Command Palette” inside the Visual Studio Code app.
  • In the command palette, type ext install and hit Enter. It will show all Visual Studio Code extensions available on your system.
  • Choose PowerShell and click on Install, you will see something like below


  • After the install, you will see the Install button turns to Enable.
  • Click on Enable and OK
  • Now you are ready for editing. For example, to create a new file, click File->New. To save it, click File->Save and then provide a file name, let’s say “helloworld.ps1”. To close the file, click on “x” next to the file name. To exit Visual Studio Code, File->Exit.

For further information, check out Microsoft’s documentation on GitHub: