Secure Your VPS with SSH Keys!

How to Create & Add SSH Keys on Any OS | Secure Your VPS

Estimated read time: 1:20

    Learn to use AI like a Pro

    Get the latest AI workflows to boost your productivity and business performance, delivered weekly by expert consultants. Enjoy step-by-step guides, weekly Q&A sessions, and full access to our AI workflow archive.

    Canva Logo
    Claude AI Logo
    Google Gemini Logo
    HeyGen Logo
    Hugging Face Logo
    Microsoft Logo
    OpenAI Logo
    Zapier Logo
    Canva Logo
    Claude AI Logo
    Google Gemini Logo
    HeyGen Logo
    Hugging Face Logo
    Microsoft Logo
    OpenAI Logo
    Zapier Logo

    Summary

    In today's digital landscape, securing VPS access through SSH keys is vital for both security and efficiency. SSH keys use public key cryptography, which is more secure than traditional passwords, to protect against brute force attacks. The video explains how to generate and set up SSH keys on various operating systems, such as Linux, MacOS, and Windows. It emphasizes the use of algorithms like RSA and ed25519, showcasing the steps to create, manage, and utilize these keys effectively across multiple servers. The tutorial also provides best practices for managing SSH keys, enhancing security, and ensuring seamless server access.

      Highlights

      • SSH keys eliminate the need to enter passwords every time you access your VPS. ๐ŸŽ‰
      • Public and private keys ensure secure communication, safeguarding against unauthorized access. ๐Ÿ”
      • Ed25519 is recommended for its efficiency and smaller key size without compromising security. ๐Ÿ”„
      • Tutorials available for generating and connecting SSH keys on Windows, Linux, and MacOS. ๐Ÿ–ฅ๏ธ
      • Use SSH agents to manage multiple keys and streamline multiple server logins. ๐ŸŽฎ

      Key Takeaways

      • SSH keys offer enhanced security and eliminate the need for passwords every time you log into a VPS. ๐Ÿ”‘
      • Learn to generate SSH keys on Linux, MacOS, and Windows using simple commands or tools like PuTTY. ๐Ÿ’ป
      • Ed25519 is the new industry standard for SSH keys, being more efficient and secure than RSA. ๐Ÿš€
      • Manage multiple SSH keys across different servers and ensure their safe storage with SSH agents. ๐Ÿ—๏ธ
      • Follow best practices such as disabling password authentication and regularly updating your keys for optimal security. ๐Ÿ”’

      Overview

      Enhancing VPS security and access efficiency just got easier with SSH keys. This video walks you through the seamless setup of SSH keys across different operating systems, replacing passwords with robust public key cryptography. Discover how SSH keys can save time by eliminating the password prompt and bolstering your server's defenses against brute force attacks.

        Learn how to generate SSH keys on Linux, Windows, and MacOS with either command-line tools or user-friendly software like PuTTY. Whether you prefer RSA or the new industry standard, Ed25519, this tutorial has you covered. The easy step-by-step guide ensures you can follow along regardless of your technical ability, and additional resources are provided for command references.

          Managing multiple SSH keys for different projects or servers can be hassle-free with SSH agents. Gain insights into best practices, including using key aliases and regularly updating your keys to prevent security breaches. With these tips, you'll keep your keys organized and your server access secure, all while staying ahead of the curve in VPS management.

            Chapters

            • 00:00 - 00:30: Introduction to SSH Keys The chapter covers the basics of SSH keys, highlighting their convenience over traditional username and password methods when logging into VPS environments. It aims to guide readers on setting up SSH keys quickly and easily across various operating systems.
            • 00:30 - 01:00: Vulnerability of Passwords & SSH Benefits The chapter discusses the vulnerability of passwords, specifically to Brute Force attacks, highlighting how they can be compromised. It introduces SSH (Secure Shell) as a more secure and convenient alternative, explaining that SSH Keys use public key cryptography. This method is considered more robust than passwords. The SSH protocol involves two keys: a private key, which acts like a secret digital signature that should remain secure, and a public key.
            • 01:00 - 01:30: How SSH Keys Work The chapter explains the role of SSH keys in secure communication. The public key is like a digital lock, used to encrypt messages meant for you, while the private key decrypts them. Storing the public key in your VPS environment allows others to encrypt data for you, which only your private key can decrypt, ensuring security and eliminating the need for entering a password repeatedly.
            • 01:30 - 02:30: Generating SSH Keys on Linux & Mac OS In this chapter, the process of generating SSH keys on Linux and Mac OS is discussed. It starts with generating a pair of public and private SSH keys. The chapter also guides on how to connect the public key to your VPS using H panel. The steps vary depending on the operating system, and this chapter provides instructions for Linux and Mac OS. It hints at the need to run commands in the terminal, suggesting the reader refer to further resources for detailed command instructions.
            • 02:30 - 04:00: Generating SSH Keys on Windows The chapter introduces the process of generating SSH keys on Windows. It suggests subscribing to the presenterโ€™s content for more VPS tips and tutorials and announces a start with commands suitable for Linux and Mac OS, mentioning two commonly used algorithms for SSH key generation: RSA and ed25519, the latter referred to as 'Ed 25'.
            • 04:00 - 07:00: Connecting SSH Keys to VPS This chapter discusses the transition from SSH RSA keys to ed25 keys in the industry. While RSA keys were previously the standard due to their security and reliability, ed25 keys are becoming more popular because of their smaller size and efficiency without compromising security. The chapter also notes that while RSA is being deprecated in favor of ed25, it is important to verify which key type your VPS supports. Hostinger VPS, for instance, supports both SSH RSA and ed25 keys.
            • 07:00 - 09:00: Managing Multiple SSH Keys The chapter titled 'Managing Multiple SSH Keys' focuses on generating a pair of SSH keys, specifically using the ed25 algorithm, although RSA is also a valid option. The process is similar across different operating systems including Linux and Mac OS. To generate the keys, users need to access the terminal on their local computer and enter a specific command. During this process, users can choose the location to store their keys, with the flexibility to save them in a different location if preferred by altering the specified path.
            • 09:00 - 12:00: Best Practices for SSH Key Management The chapter discusses best practices for managing SSH keys. It emphasizes the importance of creating a passphrase for your private key to enhance security. The chapter highlights that while one can skip adding a passphrase, it is advisable to create one. If someone gains unauthorized access to your private key, having a passphrase ensures they cannot use it. The process involves entering your chosen passphrase twice to confirm it during key creation.
            • 12:00 - 13:00: Conclusion and Viewer Engagement In this chapter, the focus is on generating and securing key pairs for connecting to a Virtual Private Server (VPS). The process includes creating a public key and a private key, ensuring the private key remains secure on the user's computer, and connecting the public key to the VPS. The chapter provides a step-by-step guide for generating these keys in a Windows environment, with additional resources available via timestamps in the video description.

            How to Create & Add SSH Keys on Any OS | Secure Your VPS Transcription

            • 00:00 - 00:30 are you tired of having to type out your VPS password every single time if so you're not alone in this video I'll tell you all about SSH keys and how to set them up fast and easy on any operating system let's go generally people log into their VPS environments with the tried ENT username and password combo while this will work just fine for most it can be extremely
            • 00:30 - 01:00 vulnerable to Brute Force attacks what's more the process can be made much more efficient this is where SS steps in offering both security and convenience SSH Keys utilize public key cryptography a system more robust than passwords let's briefly go over how it all works the SSH protocol utilizes two keys a private key and a public key think of the private key as your secret digital signature which is kept secure on your
            • 01:00 - 01:30 local computer the public key on the other hand is designed to operate out in the open you would add it to your VPS environment like a digital lock in essence anyone can use your public key to encrypt messages specifically for you but only your private key can decrypt them this ensures secure communication and protects your VPS from unauthorized access this also makes it so you don't need to enter a password every time you come connect which helps save a bit of
            • 01:30 - 02:00 time if all of this sounds great you will want to generate your first pair of public and private SSH keys after that I'll show you how to connect the public key to your VPS using H panel keep in mind that the steps to do all of this will differ based on your operating system but don't worry though as I'll be demonstrating how to do this for Linux Mac OS and windows you'll also need to run some commands in the terminal so head down below and check out our
            • 02:00 - 02:30 hosting your tutorials article which has all the necessary commands for you to copy but before we begin make sure to hit that subscribe button to see more VPS tips and tutorials like this all right let's Jump Right In starting with Linux and Mac OS there are two commonly used algorithms for generating authentication Keys RSA and ed25519 I'll call it Ed 25
            • 02:30 - 03:00 for short an SSH RSA key is a previous industry standard while it's secure and reliable it's rapidly being replaced by ed25 ed25 is the newcomer coming in with a much smaller key size it's much more efficient and does not compromise on security either while the current trend is deprecating RSA and embracing ed25 as the new standard it's always best to check which one your seral will support FYI hostinger VPS supports both
            • 03:00 - 03:30 algorithms that being said the steps to generate the pair of keys are almost identical regardless of your choice I'm going to use ed25 as an example RSA will work just fine as well for both Linux and Mac OS access the terminal on your local computer and enter this command wait for the process to finish the key generator will ask you to choose a location to store the keys if you prefer to save them in different location just change the P then hit enter to save them
            • 03:30 - 04:00 in the location that you specified in the terminal next the key generator window will ask you to create an SSH key passphrase this will be used to access your private key you can press enter to skip the step but I highly recommend creating a private key passphrase this way if someone does manage to gain unauthorized access to your private key they won't be able to use it without the passphrase then just retype the key passphrase and enter again the SSH key
            • 04:00 - 04:30 gen command should also have created a public key and a private key in this specific path and file name the public key file in particular should have a pub extension now that you have generated the pair of keys within your desired directory the private key will stay nice and secure in your computer now you just need to connect the public key to your VPS you can find the time stamp for that in the description below as for now I'll be showing how to generate the keys in Windows
            • 04:30 - 05:00 to generate SSH keys on Windows you'll need to get both puty and puty gen installed on your computer if you don't already have putty you can find it quick and easy by just typing putty in your search bar as for puty Jen you can grab it on the official website you'll find the link in the description below once everything's ready start party Jen while you can adjust things like key length before the generation the default options will work just by
            • 05:00 - 05:30 simply hit generate to get your SSH key pair when the process bar starts loading give your mouse a workout by moving it around this will help the software generate a random pattern for your key once that's done your public SSH key will be displayed on the screen if you're going to use the key for the Linux based VPS make sure to copy the open SSH public key this is because Linux systems don't support the default party format then even though you can
            • 05:30 - 06:00 keep those boxes empty I highly recommend creating a pass phrase for your SSH private key doing so will add an extra layer of security to your server once done save your private key to any desired location on your computer name it anything you like now just repeat the process to save your public key to the same location and that's it the private key should stay on your computer while your public key needs to be uploaded to the server you wish to connect to we'll go over that in the the next section for now though you'll need
            • 06:00 - 06:30 to attach the private key to puty this way your server will recognize your computer when using putty to connect open putty and navigate to connection SSH O then choose credentials in the sidebar on the left browse for your private key file in this field select the private key file the one with the PPK extension and click open once that's done we can finally connect the public key to the remote server
            • 06:30 - 07:00 while the steps so far were different depending on the operating system connecting a public key to your VPS will depend on your hosting provider we're using hostinger VPS hosting and we can do everything super quick with the H panel all in just a single click you just need to open your public key file from the directory as a reminder it's the one with the pub file extension let's keep this window open while moving on to the new tab log into H panel and
            • 07:00 - 07:30 navigate to the VPS menu then pick a server go to settings SSH Keys now just click this button to add your SSH key a popup will appear asking you to give a name for where the sshh key is saved once that's done copy and paste the content of the pub file in the respective box finally hit add SSH key and that's it for assistance go to our knowledge base or cont contact our
            • 07:30 - 08:00 customer success team our VPS even includes a built-in AI assistant that can help you with any issues you might have if everything went smoothly you just set an SSH key and can access your server but what if you have multiple servers can you generate multiple SSH keys of course and it's even highly recommended continue watching for tips on managing multiple SSH keys
            • 08:00 - 08:30 as your projects grow and diversify you may find yourself using many SSH Keys all for different servers user accounts or projects if this occurs I highly recommend an SSH agent it will quietly run in the background and securely store any private Keys you might have not only that it will also let you manage SSH key pairs across multiple connections and even remember your private key passphrase within the same session if that's sounds good just launch your
            • 08:30 - 09:00 terminal or an SSH client like puty if you want with puty you'll also need to get pageant from their downloads page for this to work then enter this command to start the SSH agent next write the SSH add command to add your private key to the SSH Agent following the command add your private key file name if your private key is protected with a passphrase it will prompt you to enter it once that's done run this command to confirm that your private key has been added it will list the identities
            • 09:00 - 09:30 currently held by the agent and now you can connect to remote servers without entering your passphrase for each session simply use this command to log in now let's start wrapping things up with the best practices for managing your SSH key a lot of things can go wrong with SSH keys if you're not paying attention you could lose track of them or even worse get them compromised to avoid any
            • 09:30 - 10:00 of that make sure to have everything in order first disable password authentication use only private public key authentication as your main server login this way only authorized users can access the server via SSH once that's applied you need to ensure that SSH key storage is secured restrict access to your private keys by storing them in the protected area of your system if needed you can also set proper permissions using the C hod command update your
            • 10:00 - 10:30 private and public Keys regularly to reduce the likelihood of compromising your keys run the SSH key gen command regularly to create new keys and replace old ones also limit the key pair usage while you can use the same keys for different servers doing so is not safe if the private key gets lost it will compromise the security of all its Associated devices ensure that a single key pair is used used for one purpose
            • 10:30 - 11:00 only such as a specific project or user account this makes your keys easier to manage and isolates potential security risks practicing this means you can keep multiple SSH keys so there are more points to keep in mind organize your keys pairs neatly some of the best practices are clear naming conventions applying logical directory structures and maintaining proper permissions this way each SSH key p is easily
            • 11:00 - 11:30 identifiable use key aliases to help distinguish each key purpose or Associated project in fact during the key generation process you can add the comment with C flag to specify the Alias for instance like this then you can run the host name command to display the host name of the current system this helps ensure you select the appropriate key for the chosen host lastly adjust the SSH settings for specific hosts the SSH configuration file lets you define
            • 11:30 - 12:00 which SSH keys to use for certain hosts or domains this minimizes the risk of using the wrong key during the login process now that's how you set up SSH Keys how did it go for you leave your thoughts and questions in the comments below just don't post your private key if you found this video helpful don't forget to give it a like and share subscribe for more videos on BPS tips and tutorials like this and and turn on your notification so you won't miss our
            • 12:00 - 12:30 new videos every week thanks for watching and good luck on your online Journey