当前位置: 首页 > news >正文

东莞全网合一网站标志在线设计网站

东莞全网合一网站,标志在线设计网站,做seo网站公司,h5的网站环境准备: 将虚拟机1恢复快照,然后手动配置一个NAT模式IP为192.168.200.100,hostname设置为fuwu1 将虚拟机1复制为虚拟机2,然后手动配置一个NAT模式IP为192.168.200.200,hostname设置为fuwu2 windows准备 xshell 或 pu…

环境准备:
将虚拟机1恢复快照,然后手动配置一个NAT模式IP为192.168.200.100,hostname设置为fuwu1
将虚拟机1复制为虚拟机2,然后手动配置一个NAT模式IP为192.168.200.200,hostname设置为fuwu2
windows准备 xshell 或 putty 或 MobaXterm 或 SecureCRT,建议xshell

一、ssh命令登录以及Xshell登录

1、在虚拟机2上ssh登录虚拟机1

[root@fuwu2 ~]# ssh root@192.168.200.100
The authenticity of host '192.168.200.100 (192.168.200.100)' can't be established.
ECDSA key fingerprint is SHA256:LKt/z3vCmOSq+tKERl7omW+7L4kC0ngZTi7kimfHf5g.
ECDSA key fingerprint is MD5:2f:be:5b:f6:4b:d7:dc:44:ef:0e:c1:c4:ab:cd:a1:a4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.200.100' (ECDSA) to the list of known hosts.
root@192.168.200.100's password: 
Last login: Wed Aug 17 20:27:22 2022
[root@fuwu1 ~]#

2、虚拟机1上退出登录

[root@fuwu1 ~]# exit
登出
Connection to 192.168.200.100 closed.

3、Xshell登录虚拟机1

----界面演示----


二、验证配置禁止root用户远程登录后效果

1、虚拟机1上修改ssh配置文件,禁用root远程登录

[root@fuwu1 ~]# vi /etc/ssh/sshd_config


找到  #PermitRootLogin yes  一行,将 # 删除,并将 yes 修改为 no ,保存退出

2、重启sshd服务

[root@fuwu1 ~]# systemctl restart sshd

3、虚拟机2上以root尝试ssh登录虚拟机1验证

[root@fuwu2 ~]# ssh root@192.168.200.100
root@192.168.200.100's password: 
Permission denied, please try again.
root@192.168.200.100's password: 

发现root用户无法登录

4、Xshell上通过root用户登录尝试虚拟机1,发现也无法登录

5、恢复虚拟机1的ssh配置

[root@fuwu1 ~]# vi /etc/ssh/sshd_config


将 PermitRootLogin no  一行的 no 改回 yes,保存退出

重启sshd

[root@fuwu1 ~]# systemctl restart sshd

服务器2以及xshell以root用户重新登录可以成功登录


三、配置通过密钥登录

配置虚拟机2可以通过密钥的方式远程登录虚拟机1而不需要输入密码。

1、在虚拟机2中生成密钥文件

一路回车即可

[root@fuwu2 ~]# ssh-keygen
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:1E+B1rW5+VDzBf+Hy+Ri7saFwwhsVpwSiTHGyWuX1gE root@fuwu2
The key's randomart image is:
+---[RSA 2048]----+
|     o++E= +..o  |
|     .=.o.B .. = |
|       o.*... o.+|
|      o.O .o   ==|
|     . =S. o..* +|
|          . ++.+.|
|           .oo+ .|
|           oo.   |
|           oo    |
+----[SHA256]-----+

2、将公钥文件拷贝到虚拟机1中

[root@fuwu2 ~]# ssh-copy-id root@192.168.200.100
/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.200.100's password: Number of key(s) added: 1Now try logging into the machine, with:   "ssh 'root@192.168.200.100'"
and check to make sure that only the key(s) you wanted were added.

3、在虚拟机2上远程登录虚拟机1验证

[root@fuwu2 ~]# ssh root@192.168.200.100
Last login: Wed Aug 17 20:40:50 2022 from 192.168.200.1
[root@fuwu1 ~]#

发现这次没有输入密码即可自动登录,这就是密钥方式登录

4、Xshell配置密钥登录

先在windows上通过Xshell生成一个密钥,然后把密钥的公钥部分添加到虚拟机1的相关文件中

[root@fuwu1 ~]# vi /root/.ssh/authorized_keys

然后就可以密钥登录
-----界面演示-----


四、scp远程拷贝命令演示

scp即 ssh + cp ,实现与远程机器之间的文件拷贝

在虚拟机2上创建一个文件a.txt,并将该文件远程传输到虚拟机1的 /root/ 目录下

[root@fuwu2 ~]# touch a.txt[root@fuwu2 ~]# scp a.txt root@192.168.200.100:/root/a.txt
a.txt

在虚拟机1上验证

[root@fuwu1 ~]# ll /root/ |grep a.txt
-rw-r--r--. 1 root root    0 8月  17 21:12 a.txt

http://www.yayakq.cn/news/726683/

相关文章:

  • 网站顶部有空白怎么推广自己的偏方
  • 搭建网站大概多少钱哪个网站免费做简历
  • 三五互联做网站吗劳务派遣东莞网站建设
  • 品牌网站建设推荐乐云seo免费发布网页的网站
  • 购买一级域名做网站济南工装定制公司
  • 做展示网站要恋用什么程序迅虎wordpress开放平台
  • 广州天河区建设网站公司北京网站建设公司哪个好
  • 官网网站备案wordpress汉化包
  • 电脑做微信推送的网站怎样做水族馆网站
  • 手机ftp传网站文件在哪里服装外贸erp
  • 自建网站平台有哪些wordpress 添加js
  • 兴宁网站建设设计网络营销方案设计
  • 怎样做网站海报福州建设银行官网招聘网站
  • 网站开发信息文档iis 配置网站 404页面
  • 怎么在网站做浮动图标微芒网站建设
  • 网站新闻关键词中秋网页设计素材网站
  • 重庆平台网站建设价格无锡电商网站设计
  • 如何申请一个网站 新网沧浪企业建设网站价格
  • 快速建站全流程详细指导手册绍兴建站模板厂家
  • 太原建筑公司网站网站导航条制作
  • 网站的最近浏览 怎么做济南网站建设联 系小七
  • 郴州网站网络推广平台关键词挖掘爱站网
  • 盛泽做网站的成都旅游酒店住哪里比较方便
  • 网站建设发货流程图电商网站开发的主流技术
  • 中山门户网站建设有哪些网站可以做ppt
  • 怎样做淘宝推广网站找别人做网站怎么防止后门
  • 自助建站系统怎么用计算机编程是做网站
  • 网站建设基础及流程深圳网站建设哪个好
  • 深圳设计网站培训wordpress 4.0 简体中文
  • 如何攻克房地产网站网站建设服务费计入什么科目