Linux多个服务器之间的免密登录、时间同步问题以及防火墙的操作

一、免密登录

远程登录进行操作指令的时候都要输入密码

安全验证机制有两种
1)用户名和密码
2)公钥和私钥机制
请求方需要事先创建一对密钥(公钥,私钥; 私钥自己持有,公钥交给目标机器)
这里写图片描述
实现步骤:
在A机器(hadoop01)上生成密钥对:
ssh-keygen -t rsa (rsa是一种加密算法)
将生成好的公钥注册给目标机器(hadoop02):
ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop02(ip地址)
以后再进行连接 hadoop2这台机器的是时候或者是在发送指令的时候就不需要在输入密码了。

二、时间同步

1、date 查看当前系统时间
2、date -s 00:00:00(时间) 手动设置时间,可以在每台机器设置同样的时间
3、yum install -y ntp 安装ntp
  ntpdate cn.pool.ntp.org (0.asia.pool.ntp.org) 同步网络时间

三、防火墙开启、关闭、查看状态

1、开启

临时开启:service iptables start
永久开启:chkconfig iptables on

2、关闭

临时关闭:service iptables stop (重启系统后失效)
永久关闭:chkconfig iptables off (重启系统后仍然有效)

3、查看防火墙状态

service iptables status

猜你喜欢

转载自blog.csdn.net/amin_hui/article/details/82461538
今日推荐