SecureCRT login configuration method with SSH key

Time:2021-10-19

Server side configuration

OS: Debian-6.0.5

Copy code

The code is as follows:

#Apt get install SSH service

Edit / etc / SSH / sshd_ Config configuration file

Copy code

The code is as follows:

Port 3322 # modify the port to 3322 (custom)
Permitrotlogin no # prevents the root user from logging in remotely
Pubkeyauthorization yes # allow login with key
Passwordauthentication no # prevents remote SSH clients from logging in with passwords

Iptables settings enable port 3322 to allow access

Copy code

The code is as follows:

iptables -I INPUT -p tcp –dport 3220 -j ACCEPT

Method 1: the administrator generates keys for ordinary users on the server side

(if there is no user, create a new user first. Debian uses addUser)

If the SSH key is generated for the user name Fengzhi,

Copy code

The code is as follows:

AddUser Fengzhi # add user
Su – fengzhige # login with fengzhige user

Generating keys with SSH keygen

Copy code

The code is as follows:

SSH keygen – t RSA # generates keys of RSA type
[email protected]:~# su – fengzhige
[email protected]:~$ pwd
/home/fengzhige
[email protected]:~$ ssh-keygen -t rsa
Generating public/private rsa key pair. Enter file in which to save the key (/home/fengzhige/.ssh/id_rsa): fengzhige-key
Enter passphrase (empty for no passphrase):
Enter same passphrase again: Your identification has been saved in fengzhige-key.
Your public key has been saved in fengzhige-key.pub. The key fingerprint is: f1:f5:5c:59:aa:4d:7d:b2:9a:56:c8:bc:50:8b:87:80
[email protected] The key’s randomart image is:
+–[ RSA 2048]—-+
| .|
| . oo|
| E o o +.+|
| + B O +.|
| S = B * |
| o = |
| = |
| . |
| |
+—————–+
[email protected]:~$

Set the public key

Copy code

The code is as follows:

The keys generated by SSH keygen in Debian will be in the current directory:
(Fengzhi key private, Fengzhi key. Pub public)
cd /home/fengzhige
CD. SSH # can create a new. SSH directory, where the public key is placed
cat id_ key.pub >> authorized_ Keys # to the specified file name authorized_ keys

Save the private key to the client with SecureCRT.

connect:

 

 

This article comes from the “song of Maple” blog

Recommended Today

SQL exercise 20 – Modeling & Reporting

This blog is used to review and sort out the common topic modeling architecture, analysis oriented architecture and integration topic reports in data warehouse. I have uploaded these reports to GitHub. If you are interested, you can have a lookAddress:https://github.com/nino-laiqiu/TiTanI recorded a relatively complete development process in my hexo blog deployed on GitHub. You can […]