当前位置:网站首页>SSH uses private key to connect to server without key
SSH uses private key to connect to server without key
2022-04-23 10:23:00 【The goose is like a small drop of stone ~】
List of articles
General operation commands
If you want to use ssh Connection service , First, we need to generate the private key and public key , The private key is left locally , Upload the public key to the server , So when connecting , Before you can do authentication services .
At the beginning , about linux Every user on the system , Corresponding home There's one in the directory .ssh Hide directory , It is used to store the generated secret key and private key
use ssh-keygen Generate command generate secret key and public key
ssh-keygen -t rsa
Key pair generated successfully , You can see two more files ,id_rsa It's a private key file , Stay on this machine to connect to the server , id_rsa_pub Is the corresponding A public key file , Upload to the server to use
Command to log in ssh -i Private key path user name @IP Address
If you use by default .ssh Private key under There is no need to add -i Option to specify the secret key used
ssh [email protected] -i id_rsa
sshd_config Some option settings
/etc/ssh/sshd_config
Port 22 # port
# AddressFamily any
# Listen to specific ip The connection of
# ListenAddress 0.0.0.0
# ListenAddress ::
# Whether to allow root User remote connection
PermitRootLogin yes
# Password authentication
PasswordAuthentication yes
Set file permissions
chmod 0600 ~/.ssh/authorized_keys
permissions
chmod 700 /.ssh
chmod 644 /.ssh/authorized_keys // All permissions for the public key file
chmod 600 /.ssh/id_rsa // All permissions for the private key file
Report errors invalid format solve

For me, yes windows Using GlassFish Arbitrary file reading Access the private key file ed25519_key when , Copy and paste the saved key file

This may lead to more /n What? , Directly in Linux Firefox I'm going to visit , Then copy and paste , If you save it in the following format, no format error will be reported

Remember to have Line break Oh !
SSH permision denied Possible solutions
This is mainly the pot on the service side , Don't learn ,Mark!
How to Fix SSH Failed Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)
Finally everything was repaired , As a result, it was connected , Let me enter the password , I'm really convinced , It is said to be the pot of server configuration , File permissions that can be changed locally 、 The key file format has been done
ublickey)
Finally everything was repaired , As a result, it was connected , Let me enter the password , I'm really convinced , It is said to be the pot of server configuration , File permissions that can be changed locally 、 The key file format has been done
版权声明
本文为[The goose is like a small drop of stone ~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231020528988.html
边栏推荐
猜你喜欢

Net start MySQL MySQL service is starting MySQL service failed to start. The service did not report any errors.

得到知识服务app原型设计比较与实践

Solve the problem of installing VMware after uninstalling

Zhengda international explains what the Dow Jones industrial index is?

基于PyQt5实现弹出任务进度条功能示例

101. Symmetric Tree

Question bank and answers of Shanghai safety officer C certificate examination in 2022

解决方案架构师的小锦囊 - 架构图的 5 种类型

shell脚本免交互
![[untitled]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[untitled]
随机推荐
ansible 云计算 自动化 命令行精简版
Juc并发编程06——深入剖析队列同步器AQS源码
DBA常用SQL语句(4)- Top SQL
1、两数之和(哈希表)
2022年广东省安全员A证第三批(主要负责人)考试试题及答案
Juc并发编程09——Condition实现源码分析
通过流式数据集成实现数据价值(1)
SQL tuning series - Introduction to SQL tuning
得到知识服务app原型设计比较与实践
微信小程序简介、发展史、小程序的优点、申请账号、开发工具、初识wxml文件和wxss文件
Sim Api User Guide(4)
Jerry's factors that usually affect CPU performance test results are: [article]
Leetcode22:括号生成
Solve the problem of installing VMware after uninstalling
142、环形链表||
0704、ansible----01
正大国际讲解道琼斯工业指数到底是什么?
What are the system events of Jerry's [chapter]
1. Sum of two numbers (hash table)
Chapter 3 enable and adjust the size of IM column storage (im-3.1)