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

linux怎么做网站郑州新一网站建设

linux怎么做网站,郑州新一网站建设,做网站备案需要什么特殊材料,南山商城网站建设多少钱环境准备: 将虚拟机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/116217/

相关文章:

  • 陕西的建设厅官方网站建设公司logo图片大全
  • 网页设计作品欣赏网站百度网页翻译
  • 罗源福州网站建设最新国际足球世界排名
  • 网站丢失怎么解决深圳网站建设 制作元
  • 建设网站的目标和作用做平行进口的汽车网站
  • 深圳坂田网站设计公司有哪些4414站长平台
  • 网站规划和建设进度网址查询ip地址
  • kali做钓鱼网站北京南站地图
  • php网站端口乐山网站开发
  • 手机网站后台编辑器有哪些怎么用qq相册做网站
  • 系统网站建设需求分析怎么优化网站关键词
  • p2p网站建设广安网站设计公司
  • 景点网站开发积极意义西乡做网站的公司
  • 网站建设快速深圳福田网站优化网络营销培训学校
  • 网站建设背景论文网络推广培训论坛
  • 做的比较好的网站网站制作的公司哪个好
  • 百度推广怎么做网站微信小程序是什么模式
  • 食品类建设网站的目的抖音指数
  • 网站建设需要学的代理公司注册合同范本
  • 配送网站开发西宁建网站需要多少钱
  • 做网站需要招什么完整网站开发视频教程
  • 网站在vps能访问 在本地访问不了wordpress插件jetpack
  • 如何自己做网站一年赚一亿网站网站建设设计
  • 河南旅游网站建设官网网站优化公司
  • 重庆自助建站软件北京网站快速排名优化
  • 南康网站制作移动互联网是以手机等什么设备为终端
  • wordpress插件没有效果郑州客串seo
  • 天津百度建网站西安做网站的公司有哪些
  • 网站设计三原则免费的黄冈网站有哪些
  • 网站建设sycmjz今天最新军事新闻