首页 > 系统相关 >CentOS7 双机搭建互相

CentOS7 双机搭建互相

时间:2023-09-23 11:46:45浏览次数:49  
标签:rsync 双机 bytes rsa 192.168 CentOS7 ssh root 搭建

CentOS7 双机搭建互相

两台机器互推文件

Connecting to 192.168.150.134:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Thu Feb 17 21:19:16 2022 from 192.168.150.134

 _____  ___   ____  _____ 
|  ___|/ _ \ |  _ \|_   _|
| |_  | | | || |_) | | |  
|  _| | |_| ||  _ <  | |  
|_|    \___/ |_| \_\ |_|  
                          

[root@Fort ~]# 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:jdb+Oagpz+yf1Ewv6LIIq3xirPnuhJZ7i5bww9r4xt8 root@Fort
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|                 |
|         +       |
|        S o .    |
|...    . . = .   |
|oBo .     +.+ .  |
|.O%..+.+.+.o.o   |
|*%XB+ E+O=+ o.   |
+----[SHA256]-----+
[root@Fort ~]# rsync -auvz /root/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys
The authenticity of host '192.168.150.128 (192.168.150.128)' can't be established.
ECDSA key fingerprint is SHA256:uLTfPtgfAO1fpKBJkgPvjnnmsTPPGf0pJ0ktcHSXql0.
ECDSA key fingerprint is MD5:db:2e:75:cb:d3:aa:10:21:e7:5d:91:1d:17:2c:ff:b7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.150.128' (ECDSA) to the list of known hosts.
[email protected]'s password: 
sending incremental file list
id_rsa.pub

sent 421 bytes  received 35 bytes  60.80 bytes/sec
total size is 391  speedup is 0.86
[root@Fort ~]# rsync -auvz /root/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys
sending incremental file list

sent 49 bytes  received 12 bytes  122.00 bytes/sec
total size is 391  speedup is 6.41
您在 /var/spool/mail/root 中有邮件
[root@Fort ~]# rsync -auvz /root/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys
sending incremental file list

sent 49 bytes  received 12 bytes  122.00 bytes/sec
total size is 391  speedup is 6.41
[root@Fort ~]# 

指令记录

ssh-keygen -t rsa		# 生成公私钥
rsync -auvz /root/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys
rsync  -auvze 'ssh -p 220' /root/liuzonglin/ [email protected]:/root/liuzonglin/authorized_keys		# 同步公钥到指定机器并改名为authorized_keys

ssh -p 22 [email protected]

/etc/init.d/keepvlied stop
/etc/init.d/keepvlied start 
keep 做负载浮动IP keep在A B定时器检测Akeep是否正常,如果不正常 B就启动keep

rsync 出错

问题一:rsync 推数据的时候,被推送的机器上必须要有rsync指令

image

问题二:rsync推送清理原本缓存数据​

image

标签:rsync,双机,bytes,rsa,192.168,CentOS7,ssh,root,搭建
From: https://www.cnblogs.com/liuzonglin/p/17724068.html

相关文章

  • CentOS7 用户操作
    CentOS7用户操作1.创建用户默认情况下创建一个用户账号,会创建一个家目录和一个用户邮箱(在/var/spool/mail目录以用户名命名)useradd<username>useradd参数说明:-b,--base-dirBASE_DIR 新账户的主目录的基目录-c,--commentCOMMENT新账户的GECOS字段......
  • CentOS7 修改网卡名
    CentOS7修改网卡名参考资料:Centos7更改网卡名称Eth0并配置静态IPcd/etc/sysconfig/network-scripts/ #配置网络路径cpifcfg-enp4s0ifcfg-enp5s0[root@Fortnetwork-scripts]#catifcfg-GE0-0TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFR......
  • CentOS7 安装 XManager
    CentOS7安装XManageryuminstall-yepel-release#安装epel源yuminstall-ylightdm&&yumgroupinstall-yxfce#安装lightdm和Xfce修改lightdm.conf文件`vim/etc/lightdm/lightdm.conf[XDMCPServer]enabled=trueport=177systemctldisableg......
  • CentOS7 防火墙
    CentOS7防火墙sudosystemctlstatusfirewalld#查看防火墙的状态sudosystemctlstartfirewalld#临时打开防火墙,立即生效。sudosystemctlstopfirewalld#临时关闭防火墙,立即生效。sudosystemctlenablefirewalld#永久开启防火墙,重启后生效。sudosy......
  • CentOS7 关闭防火墙或开放端口
    CentOS7关闭防火墙或开放端口关闭防火墙systemctlstartfirewalld.servicesystemctlstatusfirewalld.servicesystemctlstopfirewalld.service#设置开机启用防火墙systemctlenablefirewalld.service#设置开机禁用防火墙systemctldisablefirewalld.service开......
  • CentOS7 设置中文环境
    CentOS7设置中文环境查看当前字符集locale查看有没有zh_CN.utf8locale-a|grepCN安装langpacks-zh_CNyuminstall-ylangpacks-zh_CN配置>/etc/locale.conf;echo'LANG="zh_CN.UTF-8"'>>/etc/locale.conf重启系统shutdown-rnow‍......
  • CentOS7 关于Linux Polkit本地权限提升漏洞(CVE-2021-4034)的在线和离线的两种修复方式
    CentOS7关于LinuxPolkit本地权限提升漏洞(CVE-2021-4034)的在线和离线的两种修复方式https://blog.csdn.net/liangtongning/article/details/122805070在线修复yumcleanall&&yummakecacheyumupdatepolkit-y[root@Fort~]#yumcleanall已加载插件:fastestmirror......
  • CentOS7 双机 rsync出错
    CentOS7双机rsync出错问题一:rsync推数据的时候,被推送的机器上必须要有rsync指令问题二:rsync推送清理原本缓存数据......
  • CentOS7图形界面与命令行界面如何切换
    在CentOS 7中,您可以使用以下方法在图形界面和命令行界面之间进行切换: 1. 从图形界面切换到命令行界面:请按下Ctrl + Alt + F2(或F3、F4、F5),这将使您进入一个新的TTY终端窗口。在这个终端窗口中,您可以使用命令行界面进行操作。 2. 从命令行界面切换回图形界面:请按下Ctr......
  • CentOS7图形界面和命令行界面的切换
    从图形界面进入命令行:ctl+alt+F2从命令行返回图形界面:ctl+alt+F1修改系统默认启动级别:#获取默认的targetsystemctlget-default#设置系统启动后进入文本界面systemctlset-defaultmulti-user.target#设置系统启动后进入图形界面systemctlset-defaultgraphical.target#以......