openeuler的安装和两台linux主机配置ssh实现互相免密登陆

一、openeuler的安装

下载OpenEuler

设置自定义硬件

  • 内存:推荐2GB

  • 处理器:1颗、2核心

  • ==新CD/DVD:适应ISO映像文件,点击浏览按钮,选择之前下载好的openEuler-22.03-LTS-SP2-x86_64-dvd.iso镜像文件==

  • 网络适配器:选择NAT模式

  • 显示器:去掉"加速3D图形"的对钩

  • 最终:如图

虚拟机安装的其他步骤可参考 创建虚拟机及远程连接Linux_如何利用远程服务器搭建linux虚拟机-CSDN博客

OpenEuler22.03操作系统的安装部署

  • 使用鼠标点击黑色界面进入OpenEuler22.03系统,通过ctrl+alt可以释放鼠标焦点回到Windows

  • 通过键盘方向键选择第一项Install openEuler 22.03-LTS-SP2 选项进行安装系统

  • 选择语言:中文或英文

  • 安装信息摘要设置

  • 安装目的地:显示安装位置,一般为硬盘,点击自定义进行行分区

  • 网络和主机名:打开网卡连接

  • root账户密码设置自定义(密码难度太弱可能无法确认)

  • 创建用户:创建一个普通账户fox(可自定义)

  • 重启系统

配置OpenEuler22.03

进行账户和密码登录

二、两台linux主机配置ssh实现互相免密登陆

1.查询有无ssh服务软件

复制代码
#ssh服务安装包
[root@csa ~]# rpm -qa | grep ssh
libssh-config-0.9.6-3.el9.noarch
libssh-0.9.6-3.el9.x86_64
openssh-8.7p1-24.el9_1.x86_64
openssh-clients-8.7p1-24.el9_1.x86_64
openssh-server-8.7p1-24.el9_1.x86_64

2.确认ssh服务开启

状态为active(running)表示该服务正常运行,可以进行连接

3.ssh服务默认端口为22(端口号应该大于1024)

4.生成非对称密钥

复制代码
[root@csa ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
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:
SHA256:8EuqY4qEF2vshJu9vK5btQs+VA++7vxsB0uABbPQKzg root@csa
The key's randomart image is:
+---[RSA 3072]----+
|..o.             |
| ..o.            |
|. .+  .          |
|E o +  o         |
| o.o.+  S        |
|.o.+..+o .       |
|ooO .o.o.        |
|.&.o++o .        |
|*+XO*+o.         |
+----[SHA256]-----+

5.关闭服务端防火墙

复制代码
[root@csa ~]# systemctl stop firewalld.service

6.查看

id_rsa:储存私钥的文件
id_rsa.pub:储存公钥的文件

7.将生成的公钥发给需要免密登录的设备

8.在对端查看ssh配置文件

复制代码
[root@192 ~]# ll .ssh/
total 4
-rw-------. 1 root root 562 Jan 10 20:51 authorized_keys

9.直接登录服务端,登录成功后,对端会将公钥传回

复制代码
[root@csa ~]# ssh 192.168.112.133
Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Wed Jan 10 20:44:42 2024 from 192.168.112.1
[root@192 ~]# 

10.对另一端进行同样操作

复制代码
[root@192 ~]# 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:
SHA256:LOjoB4tHdrQID57klrpzfM9eSN1EyUj/lFnyCViwRAU root@192.168.112.133
The key's randomart image is:
+---[RSA 3072]----+
|       ..+EB= .  |
|        .++. B . |
|          + + o  |
|o.  .. o o o     |
|++oo..o S . .    |
| **oo. o         |
|o=.+. . .        |
|+.= o. .         |
|.=.o o+          |
+----[SHA256]-----+
[root@192 ~]# ssh-copy-id 192.168.112.131
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.112.131 (192.168.112.131)' can't be established.
ED25519 key fingerprint is SHA256:+WZK8ViECx/xdyXqi4IRo3YdT8brzFKaKVJ6AmZTYwY.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.112.131's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '192.168.112.131'"
and check to make sure that only the key(s) you wanted were added.

[root@192 ~]# ssh 192.168.112.131
Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Wed Jan 10 19:51:08 2024 from 192.168.112.1
[root@csa ~]# 
相关推荐
爱写代码的森4 小时前
鸿蒙三方库 | harmony-utils之ImageUtil图片保存到本地详解
服务器·华为·harmonyos·鸿蒙·huawei
HLC++7 小时前
Linux的进程间通信
android·linux·服务器
华清远见IT开放实验室8 小时前
实验室建设案例 | 石家庄科技信息职业学院嵌入式实验室——从底层硬件到系统应用,一所应用型高校的嵌入式人才培养这样落地
linux·arm开发·stm32·嵌入式硬件·高校·实验室建设
白露与泡影9 小时前
Arthas 实战指南:从方法耗时定位到 JVM 变量热修改
服务器·jvm·c#
神奇霸王龙10 小时前
Claude Code屠榜:MiMo与Grok紧追Codex
服务器·网络·人工智能·gpt·ai·ai编程
Web极客码10 小时前
WordPress SEO优化:提升网站排名的13个关键步骤
服务器·seo·wordpress
groundhappy11 小时前
idalib安装和codex ida-mcp配置
linux·开发语言·python
通信小小昕11 小时前
Ubuntu 26.04 中文输入法安装
linux·运维·ubuntu
张小姐的猫13 小时前
【Linux】网络编程 —— HTTP协议(上)
linux·运维·服务器·网络·http·单例模式·策略模式
国科安芯13 小时前
星间光链路:AS32S601型抗辐射MCU在空间激光通信终端控制中的技术实现
服务器·网络·单片机·嵌入式硬件·物联网·安全·信息与通信