Skip to content

5000+ Great Articles

Best Articles & Essays: Interesting Articles to Read Online

  • How to scan a QR code on iPhone and Android How-To
  • How To use Nvidia ShadowPlay to Record Games 2021 How-To
  • Which Webpages Should you Optimized For Adsense How-To
  • How To Download SoundCloud Songs Computer Tips
  • How To Create Gaming YouTube Videos Like a Pro in 2021 Gaming
  • Is a Curved Monitor Better? The Pros Vs. The Cons Gadgets
  • Best ti86 graphing calculator 2020

    Best ti86 graphing calculator 2020. 1 - Texas Instruments TI-86 Graphing Calculator Product descriptionFor advanced users, the TI-86 graphing c

  • The Most Common Windows 10 Error Messages & How To Fix Them Windows 10

Enable Public Key Authentication for SSH on Cisco SG300 Switches

Posted on October 9, 2020 By blog_786 No Comments on Enable Public Key Authentication for SSH on Cisco SG300 Switches

I previously wrote about how to enable SSH access to a Cisco switch by enabling the appropriate option in the GUI. This is great if you want to access the switch CLI over an encrypted connection, but it still only relies on the username and password.

If you are using this switch on a highly sensitive network that needs to be very secure, you may want to consider enabling public key authentication for your SSH connection. In fact, for maximum security, you can enable username / password and public key authentication to access your switch.

In this article, I will show you how to enable public key authentication on a Cisco SG300 switch and how to generate public / private key pairs using puTTYGen. Then I will show you how to log in with the new keys. Also, I’ll show you how to set it up so that you can either use only the key to log in, or force the user to enter the username / password along with the private key.

Note. Before proceeding with this tutorial, make sure you have already enabled SSH service on the switch I mentioned in the previous article above.

Enable SSH User Authentication with Public Key

In general, the process of making SSH public key authentication work is straightforward. In my example, I will show you how to enable features using the web GUI. I tried using the CLI to enable public key authentication, but it didn’t accept the format of my RSA private key.

Once I get this working, I’ll supplement this post with CLI commands that will do what we’ll now be doing through the GUI. First click on Security, then SSH Server and finally SSH User Authentication.

– /

Enable Public Key Authentication for SSH on Cisco SG300 Switches

In the right pane, check the Enable box next to SSH User Authentication by Public Key. Click the Apply button to save your changes. Don’t check the “Enable” box next to “Auto Login” yet, I’ll explain that below.

Now we need to add the SSH username. Before we move on to adding a user, we first need to generate public and private keys. In this example, we will use puTTYGen, the program that comes with puTTY.

Create private and public keys

To generate keys, first open puTTYGen. You will see a blank screen and you really don’t need to change any of the settings from the defaults shown below.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

Click the New button, and then hover your mouse over an empty area until the progress bar moves completely.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

After the keys have been generated, you need to enter a passphrase, which is basically like a password to unlock the key.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

It is recommended to use a long passphrase to protect the key from brute force attacks. After you have entered the passphrase twice, you must click the Save Public Key and Save Private Key buttons. Make sure these files are stored in a safe place, preferably in an encrypted container that requires a password to open. Check out my post on using VeraCrypt to create an encrypted volume

Add user and key

Now, back to the SSH user authentication screen we were on earlier. Here you can choose between two options. First, go to Administration – User Accounts to find out what accounts you have to log in.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

As you can see, I have one account called akishore to access my switch. I can currently use this account to access the web and command line interface. Back on the SSH User Authentication page, the user you want to add to the SSH User Authentication table (by public key) can be the same as the user in the Administration – User Accounts section, or different.

If you choose the same username, then you can check the “Enable” button in the “Auto Login” section, and when you log in, you just need to enter the username and password for the private key and you will be logged in.

If you choose to choose a different username here, you will receive a prompt asking you to enter your SSH private key username and password, and then you will need to enter your regular username and password (specified in the Admin – User Accounts section). If you need extra security, use a different username, otherwise just name it the same as your current one.

Click the Add button and the Add SSH User popup will open.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

Make sure the Key type is set to RSA, and then open the SSH public key file that you saved earlier with a program such as Notepad. Copy all content and paste it into the public key window. Click Apply and then click Close if a Success message appears at the top.

Log in with the private key

Now all we have to do is log in using our private key and password. At this point, when you try to log in, you will need to enter your credentials twice: once for the private key and once for the regular user account. Once we enable automatic login, you just need to enter the username and password for the private key and you will be signed in.

Open puTTY and, as usual, enter the IP address of your switch in the Host Name field. However, this time we also need to load the private key into puTTY. To do this, expand “Connection”, then expand “SSH” and click “Auth”.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

Click the Browse button under the Authentication Private Key File and select the Private Key File you saved earlier from puTTY. Now click the “Open” button to connect.

The first prompt will be a login, and this should be the username you added for SSH users. If you used the same username as the main account, it doesn’t matter.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

In my case, I used akishore for both user accounts, but I used different passwords for the private key and for my main user account. You can make the passwords the same if you like, but that doesn’t make any sense, especially if you enable automatic login.

Now, if you don’t want to have to log in twice to log into the Switch, check the Enable box next to Auto Login on the SSH User Authentication page.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

When this is enabled, you will simply need to enter credentials for the SSH user and you will be logged in.

Enable Public Key Authentication for SSH on Cisco SG300 Switches

It’s a little tricky, but it makes sense if you experiment a little. As I mentioned earlier, I will also write CLI commands as soon as I can get the private key in the correct format. By following the instructions given here, accessing your switch via SSH should now be much more secure. If you have any problems or have any questions, write in the comments. Enjoy!

–

Share this:

  • Twitter
  • Facebook
How-To

Post navigation

Previous Post: The Easiest Way to Remotely Connect to Linux Mint from Any OS
Next Post: How to Enable SSH Access for Cisco SG300 Switches

Related Posts

  • 9 Tips for Better Privacy on Facebook How-To
  • How to Bypass Google reCAPTCHA Verification in Chrome And Firefox How-To
  • How to Download Directly to Google Drive on Chromebook How-To
  • How to Remove Bloatware from Chinese Phones without Root How-To
  • CD or DVD Drive Won’t Eject or Open? How-To
  • How to go Back to the old YouTube Layout (2013) How-To

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archives

  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • March 2021
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • December 2019
  • July 2019
  • May 2019
  • April 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018

Categories

  • AI Tools & Guides
  • Amazon Web Services
  • Apple Watch
  • Computer Tips
  • Cool Websites
  • Featured Posts
  • Free Software Downloads
  • Gadgets
  • Gaming
  • General Software
  • Google Software/Tips
  • Hardware
  • Help Desk
  • How-To
  • iOS
  • iPad
  • iPhone
  • islamic Books
  • Linux
  • Linux Tips
  • Mac OS X
  • macOS
  • MS Office Tips
  • Networking
  • Office Tips
  • OS X
  • Product Reviews
  • Reviews
  • Safari
  • Smart Home
  • Smartphones
  • Software Reviews
  • technology
  • text
  • Tools Review
  • Troubleshooting
  • Tutorials
  • Uncategorized
  • Urdu Books PDF
  • Web Site Tips
  • Windows
  • Windows 10
  • Windows 7
  • Windows XP Tips
  • Wordpress
  • 3 Sites like YouTube to Earn Money With Your Videos
  • Buying Bitcoin in India? Top 4 Indian Bitcoin Exchange Compared
  • TemplateMonster WordPress Theme Review – Build a Site With Ease
  • 6 Best FTP Clients For Android
  • MailTag: Real-time Email Tracking, Made Easy
DMCA.com Protection Status

Recent Posts

  • How to Watch Winter Olympics 2018 from Anywhere
  • 5 Sites That Are Like Audible, But Free
  • How to Reduce PNG File Size of a Photo
  • Why does Instagram say this story is unavailable?
  • How to turn off Do Not Disturb mode on Android

Recent Comments

  1. 5 Sites That Are Like Audible, But Free on 14 Best Free Audiobooks on Audible – 2022
  2. How to Reduce PNG File Size of a Photo on How to Convert a Screenshot to a Jpeg on a Mac
  3. 3 Sites like YouTube to Earn Money With Your Videos on Here are the Top 10 highest paid YouTubers of 2013
  4. Buying Bitcoin in India? Top 4 Indian Bitcoin Exchange Compared on How to Buy Bitcoin in India – Step by Step Guide
  5. TemplateMonster WordPress Theme Review Build a Site With Ease on How to make a secure website with WordPress 2023
  • Facetime not working on mac General Software
  • How to Block YouTube Channels
  • Miss Hotmail? Microsoft Outlook Email Services Explained Office Tips
  • How To Play Blu-Ray Discs On Your Computer Windows 10
  • How to Retrieve Archived Emails in Gmail How-To
  • The Easiest Raspberry Pi Projects for Beginners Networking
  • Best Free Ways to Convert BMP to JPG Computer Tips
  • 12 Best Bluetooth Speakers In 2020 Product Reviews

Copyright © 2023 How To Blog.

Powered by PressBook News WordPress theme

Go to mobile version