Contents
1.1 SSH Keys-An Overview
1.2 Installation of SSH Keys on Linux-A Step-By Step Guide
Conclusion
1.1 SSH Keys-An Overview
________________________________________
SSH keys offer a highly secure manner of logging into a server with SSH as against mere dependence on a password. While a password stands the risk of being finally cracked, SSH keys are rather impossible to decipher using brute force. As a matter of fact, generating a key pair offers users two lengthy strings of characters corresponding to a public as well as a private key. Users can, thus, place the public key on any server, and subsequently unlock the same by connecting to it with a client that already possesses the private key. Upon matching up of the two keys, the system unlocks without any irksome dependence on a password. The security may be further smartly firewalled by guarding the private key with a passphrase.
1.2 Installation of SSH Keys on Linux-A Step-By Step Guide
Outlined below is a step-by-step guide detailing the process of installing SSH Keys on a Linux server:
Step One-Creation of the RSA Key Pair
________________________________________
The first step in the installation process is to create the key pair on the client machine, which would, more often than not, be your own system. Users need to use the following command:
ssh-keygen -t rsa
The above command kicks off the SSH Key installation process for users.
Step Two-Storing the Keys and Passphrasing
________________________________________
Upon entering the primary Gen Key command, users need to go through the following drill by answering the following prompts:
Enter the file where you wish to save the key (/home/demo/.ssh/id_rsa)
Users need to press ENTER in order to save the file to the user home
The next prompt would read as follows:
Enter passphrase
If, as an administrator, you wish to assign the passphrase, you may do so when prompted (as per the question above), though this is optional, and you may leave the field vacant in case you do not wish to assign a passphrase.
However, it is pertinent to note there that keying in a unique passphrase does offer a bevy of benefits listed below:
1. The security of a key, even when highly encrypted, depends largely on its invisibility to any other party. I 2. In the likely instance of a passphrase-secure private key falling into the custody of an unauthorized user, they will be rendered unable to log in to its allied accounts until they can crack the passphrase. This invariably gives the victim (the hacked user) precious extra time to avert the hacking bid On the downside, assigning a passphrase to the key requires you to key it in every time you make use of the Key Pair, which makes the process a tad tedious, nonetheless absolutely failsafe.
Here is a broad outline of the end-to-end key generation process:
root@server1:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
38:16:50:fe:8d:da:02:bb:46:1b:66:0c:10:8e:81:2d root@server1.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|+o ... |
|E.. o |
|.+ o |
| . + o |
| o. + S . |
| *+ + |
| +.oo . |
| o. . |
| .. |
+-----------------+
The public key can now be traced to the link ~/.ssh/id_rsa.pub
The private key (identification) can now be traced to the link-/home/demo/.ssh/id_rsa 3
Step Three-Copying the Public Key
________________________________________
Once the distinct key pair has been generated, the next step remains to place the public key on the virtual server that we intend to use. Users would be able to copy the public key into the authorized_keys file of the new machine using the ssh-copy-id command. Given below is the prescribed format (strictly an example) for keying in the username and IP address, and must be replaced with actual system values:
ssh-copy-id user@192.168.0.100
As an alternative, users may paste the keys by using SSH (as per the given command):
cat ~/.ssh/id_rsa.pub | ssh user@192.168.0.100 "cat >> ~/.ssh/authorized_keys"
Either of the above commands, when used, shall toss the following message on your system:
The authenticity of host '192.168.0.100 ' can't be established. RSA key fingerprint is b1:2d:32:67:ce:35:4d:5f:13:a8:cd:c0:c4:48:86:12. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.100' (RSA) to the list of known hosts. user@192.168.0.100's password: Now try logging into the machine, with "ssh 'user@192.168.0.100'", and check in: ~/.ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
After the above drill, users are ready to go ahead and log into user@192.168.0.100 without being prompted for a password. However, if you have earlier assigned a passphrase to the key (as per Step 2 above), you will be prompted to enter the passphrase at this point (and each time for subsequent log-ins.).
Step Four (This Step is Optional)-Disabling the Password to Facilitate Root Login
After users have copied their SSH keys unto your server and ensured seamless log-in with the SSH keys only, they have the option to restrict the root login, and permit the same only through SSH keys. To accomplish this, users need to access the SSH configuration file using the following command:
sudo nano /etc/ssh/sshd_config
Once the file is accessed, users need to find the line within the file that includes PermitRootLogin , and modify the same to ensure a foolproof connection using the SSH key. The following command shall help you do that:
PermitRootLogin without-password
The last step in the process remains to implement the changes by using the following command:
reload ssh
The above completes the process of installing SSH keys on the Linux server.
Conclusion
The above steps shall help you install SSH keys on any virtual private server in a completely safe, secure and hassle-free manner.
分享到:
相关推荐
在Ubuntu系统上安装SSH(Secure Shell)是连接远程服务器、进行安全远程操作的重要步骤。SSH是一种网络协议,用于安全地远程登录到服务器,执行命令、传输文件等操作。本指南将详细阐述如何在Ubuntu上安装并配置SSH...
SSH, the Secure Shell, is a reliable, reasonably easy to use, inexpensive security product for computer networks and the people who use them. It’s available for most of today’s operating systems. ...
启示录 第二版 Marty Cagan(压缩卷第一部分,共三部分)
Have you ever tried to install macOS Mojave on your laptop Windows 10? but, before visiting begin ...So begins our article, to indicate you ways How to install macOS Mojave 10.14.3 final on VirtualBox.
You will learn about the basic plots, how to customize them, and combine them to make sophisticated figures. Along with basic plots, you will also learn to make professional scientific plots.
VCL Layout Control - How to Create and Customize a Simple Layout [720p]
The UBTECH Jimu Robots Builder's Guide How to Create and Make Them Come to Life 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
What SSH is and how to use it, including creating and using SSH keys. The file system layout of Linux systems and where to find programs, configurations, and documentation. The basic Linux commands ...
You should ensure that the server's public keys are loaded by the client as described in How to use SFTP (with server validation - known hosts), or you may want to switch off server validation to get ...
This book is a practical guide on how to create artwork for computer games - a burgeoning area in which thousands of artists are hired each year. The guide mostly focuses on fantasy art but the ...
packaging and running portable distributed applications, Deepak Vorhadiscusses how to build, ship and run applications on any platform such as a PC, the cloud, data center or a virtual machine....
Chapter 5 How to List the Authors and Addresses Chapter 6 How to Prepare the Abstract Chapter 7 How to Write the Introduction Chapter 8 How to Write the Materials and Methods Section Chapter 9 How to ...
启示录 第二版 Marty Cagan (压缩卷第二部分,共三部分) INSPIRED_ How to Create Tech Products Customers Love, 2nd Edition part2.rar
C++ How to Program presents leading-edge computing technologies in a friendly manner appropriate for introductory college course sequences, based on the curriculum recommendations of two key ...
This book: Provides an overview of Common Lisp for the ...Shows how to find what you need among the thousands of documented and undocumented functions and variables in a typical Common Lisp system.
This is the source to my OCX. This demontrates how to create a basic OCX. This will aid anyone who wants to create an OCX.
An example of how to create a coolbar such as the one in Internet Explorer without using a 3rd party control.