linux下配置SSH免密码连接
来源:互联网 发布:软件设计师教程 编辑:程序博客网 时间:2024/05/29 15:49
linux下配置SSH免密码连接 1)关闭防火墙(在配置SSH无密码连接前,先关闭防火墙): service iptables status# 查看防火墙状态service iptables stop# 关闭防火墙chkconfig --list | grep iptables# 查看防火墙开机启动状态chkconfig iptables off # 关闭防火墙开机启动2)检查SSH是否已安装 rpm -qa | grep openssh # 如果出现:openssh-askpass-5.3pl-81.e16x86_64 ...,则说明SSH已安装。 rpm -qa | grep rsync # 如果出现:rsync-3.0.6-9.e16.x86_64 ,则说明rsync安装。安装SSH协议: yum install ssh yum install rsync # rsync是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件。 启动SSH服务: service sshd restart 3)生成SSH公钥(以hadoop用户执行) 1>在主节点执行: ssh-keygen -t rsa # 输入"ssh-keygen -t rsa"命令并回车后,还需要敲3个回车!# -t 表示指定生成的密钥类型结果:生成了~/.ssh文件夹、私钥文件(~/.ssh/id_rsa)、公钥文件(~/.ssh/id_rsa.pub)eg:[hadoop@master data]$ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): Created directory '/home/hadoop/.ssh'.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/hadoop/.ssh/id_rsa.Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.The key fingerprint is:2e:3f:80:cb:7d:f4:af:e5:ee:6a:2a:d5:a9:0e:64:0c hadoop@masterThe key's randomart image is:+--[ RSA 2048]----+| || || E || o || .+ S. . || .o..o o || . oo+.o . || o o++ oo || +++o*= |+-----------------+[hadoop@master data]$2>生成公钥后,将公钥拷贝到要免密登录的机器上ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@master # 将公钥发至本机的authorized_keys的列表ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@slave1 # 将公钥发至从节点的authorized_keys的列表 补充: # ssh-copy-id命令可以把本地主机的公钥复制到远程主机的authorized_keys文件上。 # ssh-copy-id命令也会给远程主机的用户主目录(home)、~/.ssh以及~/.ssh/authorized_keys设置合适的权限。 # -i 表示指定公钥文件4)验证:说明:本机通过ssh连接本机时,如果没有设置免密码连接,则也需要输入密码,故可以使用通过ssh本机连接本机来验证。[hadoop@master ~]$ ssh hadoop@master# 如果没有出现输入密码的提示,则配置成功,以后master就可以通过ssh免密码登录master了# 如果找不到ssh命令,则yum -y install openssh-clients# 安装ssh客户端# 备注:ssh是客户端,sshd是服务器通过ssh免密码登录slave1来验证:[hadoop@master ~]$ ssh hadoop@slave1# 如果没有出现输入密码的提示,则配置成功,以后master就可以通过ssh免密码登录slave1了如果没有成功,可能是/home/hadoop/.ssh文件夹的权限问题,以hadoop用户执行:chmod 700 /home/hadoop/.sshchmod 644 /home/hadoop/.ssh/authorized_keys
阅读全文
0 1
- linux下配置SSH免密码连接
- Centos6下SSH免密码连接配置
- Linux下配置SSH免密码登录
- linux ssh 免密码连接
- Linux下ssh免密码登录配置(20160309)
- Linux下快速配置SSH免密码登录
- linux 免密码 ssh 互相连接
- ubuntu下ssh免密码登录配置
- CentOS下配置ssh免密码登录
- linux 配置 SSH免密码登录
- linux配置免密码ssh登录
- Linux ssh免密码登陆配置
- linux配置SSH免密码登陆方法
- linux配置SSH协议免登录密码
- linux ssh 免密码登录配置
- Linux---ssh配置免密码登录
- linux使用:配置SSH免密码登陆
- 配置Linux系统ssh免密码登陆
- 数据库操作如:插入操作,批处理与循环逐个插入性能比较
- java利用DecimalFormat保留小数点后两位,不足用0补齐
- Linux 学习笔记(二)文件管理
- 【Dubbo分布式服务框架】3.基于注解的服务提供者和消费者
- 利用表格建立如下网页(歌曲自选,至少选择3首歌曲)。
- linux下配置SSH免密码连接
- Maven项目下的Spring Quartz简单集成
- AngularJS—学习 ui-router
- PHP入门之字符串、Cookie和Session简介
- 51Nod 1019 逆序数
- resultset结果集封装为json的各种形式
- IPC--共享内存
- jQuery的extend方法
- META标签的用法