栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

RHCE---day1作业

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

RHCE---day1作业

1.配置桥接
#配置网桥
[root@localhost ~]# nmcli c add type bridge con-name br1 ifname br1 ipv4.addresses 192.168.230.222/24 ipv4.gateway 192.168.230.2 ipv4.method manual
Connection ‘br1’ (4bf065f0-a117-4dc6-bbb4-68572e3a0d20) successfully added.
#将ens224网卡连接在网桥上
#网桥的作用:转换数据包
#数据包流向=》网桥=》ens224
[root@localhost ~]# nmcli c add type bridge-slave con-name br1-port1 ifname ens224 master br1
Connection ‘br1-port1’ (752079b7-467d-4e6b-b693-59d3d9380e0c) successfully added.
[root@localhost ~]# nmcli c up br1-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/60)
[root@localhost ~]# nmcli c up br1
2.ssh:拒绝用户远程登录
修改配置文件:vim /etc/ssh/sshd_config
将PermitRoorLogin yes -> no

重启服务:systemctl restart sshd(显示被拒绝)

3 ssh免密登录
1.产生公钥和私钥
公钥:id_rsa.pub
私钥:id_rsa
命令:ssh-keygen -t rsa
[root@localhost ~]# cd ~/.ssh
[root@localhost .ssh]# cd ~/.ssh/
[root@localhost .ssh]# ls
known_hosts
[root@localhost .ssh]# 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:3sXljtxF7gdtusrkYuEMubiwhGlBuy59zrIs/MyU+XE root@localhost.localdomain
The key’s randomart image is:
±–[RSA 3072]----+
| |
| |
| . . .|
| . . . o + |
| o S. o o =|
| =o .o…o + * |
|…=+o. E.=…+ + o|
|o=*ooo+ . =+ …|
| o=O+… . .+… |
±—[SHA256]-----+
[root@localhost .ssh]# ls
id_rsa id_rsa.pub known_hosts

2.将公钥写入authorized_keys(=>将公钥传递给远端的服务器)
命令:ssh-copy-id 用户名
=> 将id_rsa.pub的内容写入authorized_keys文件中 (等价于:cat id_rsa.pub >> authorized_keys)
[root@localhost .ssh]# ssh-copy-id localhost
[root@localhost .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts

3.将authorized_keys拷贝到远端: /root/.ssh/
命令:scp ~ /.ssh/authorized_keys 192.168.75.131:~/.ssh/
[root@localhost .ssh]# scp authorized_keys 192.168.102.130:~/.ssh/
root@192.168.102.130’s password:
authorized_keys 100% 580 564.6KB/s 00:00
[root@localhost .ssh]# ssh root@192.168.102.130

同理在要登录的设备上也同样操作这三步

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/600049.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号