Showing posts with label SSH-Agent Keys. Show all posts
Showing posts with label SSH-Agent Keys. Show all posts

Thursday, April 6, 2023

Secure Your Keys with Keychain: Setting Up Key Password Storage on WSL 2 Ubuntu 20.04



If you're using WSL 2 on Ubuntu 20.04 and have keys that you use for various purposes, it's important to keep them secure. One way to do this is by using a keychain to store your key passwords. This will also help to lock down WSL 2 since it requires a password to start the session. In this blog post, we will show you how to set up keychain on WSL 2 Ubuntu 20.04 to store your key passwords.

Step 1: Install Keychain


To install Keychain, open up the terminal in your Ubuntu WSL 2 instance and run the following command:

sudo apt-get install keychain


This will install Keychain on your system.

Step 2: Configure Keychain


Once you have installed Keychain, you need to configure it. To do this, open up your ~/.bashrc file using the following command:

vi ~/.bashrc


Add the following lines to the bottom of the file:

/usr/bin/keychain --clear ~/.ssh/id_rsa
source ~/.keychain/$HOSTNAME-sh


Save and exit the file.

The "--clear" option in the first line makes sure that intruders cannot use your existing SSH-Agent's keys. This is important for security purposes.

The second line automatically load your keys when you start a new terminal session

Step 3: Test Keychain


To test Keychain, open up a new terminal session and run the following command:

ssh-add -l


This command will list the keys that are currently loaded in Keychain..

Conclusion


In this blog post, we showed you how to set up Keychain on WSL 2 Ubuntu 20.04 to store your key passwords. Using Keychain can help to keep your keys secure and lock down WSL 2 since it requires a password to start the session. If you have any questions or comments, feel free to leave them below.

Exploring the Pros and Cons of Using the PHP ReflectionMethod

If you've worked with object-oriented programming in PHP, you may have heard of the ReflectionMethod class. This class is part of the P...