节点n1 n2 n3 互通

第一步:n1->n2互通

  admin@n1 > ssh-keygen -d

  

   admin@n1 > scp id_dsa.pub n2:~/.ssh/authorized_keys

  这样就实现了 ssh n2 无密码登录

下面的同理:将本机生成的.pub文件追加到对方的authorized_keys文件里面就可以了。

这里出现过一个问题。n1->n2 正常,n2->n1同样的步骤就是不行,admin@n2 > ssh n1 总是需要密码。怎么回事?时间的问题?修改时间同样不行。

最后找出是 .ssh 权限的问题。

Make sure the permissions on the ~/.ssh directory and its contents are proper. When I first set up my ssh key auth, I didn't have the ~/.ssh folder properly set up, and it yelled at me.

  • Your home directory ~ and your ~/.ssh directory on the remote machine must be writable only by you: rwx------ and rwxr-xr-x are fine, but rwxrwx--- is no good, even if you are the only user in your group (if you prefer numeric modes: 700 or 755, not 775).
  • Your private key file (on the local machine) must be readable and writable only by you: rw-------, i.e. 600.
  • Your ~/.ssh/authorized_keys file (on the remote machine) must be readable (at least 400), but you'll need it to be also writable (600) if you will add any more keys to it.
  • Also, if SELinux is set to enforcing, you may need to run restorecon -R -v ~/.ssh (see e.g. Ubuntu bug 965663 and Debian bug #658675; this is patched in CentOS 6).

ssh 无密码互通的更多相关文章

  1. Linux服务器SSH无密码访问

    1.编辑Hosts文件: [root@yqtrack-elk01 /]# vim /etc/hosts

  2. 普通用户ssh无密码登录设置

    这段时间在做Hadoop的环境配置,用root用户只需要按照一定的步骤进行操作就可以直接实现无密码登录,但如果使用新建用户,怎么尝试都不行. 本帖大部分都是其他人帖子的内容.如果按照下面的步骤还是不能 ...

  3. 烂泥:学习ssh之ssh无密码登陆

    本文由秀依林枫提供友情赞助,首发于烂泥行天下 最近一个月没有写过文章,主要是刚刚换的新工作.新公司服务器OS使用的是ubuntu server版,和以前熟悉的centos还是有很多不同的. 刚好这几天 ...

  4. SSH 无密码远程执行脚本

    ssh无密码登录及远程执行脚本要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS7为例. 测试环境:机器A(10.0.224.80):机器B(192.16 ...

  5. CentOS下SSH无密码登录的配置

    1.确认本机sshd的配置文件(需要root权限) $ gedit /etc/ssh/sshd_config 找到以下内容,并去掉注释符"#" RSAAuthentication ...

  6. ssh-keygen+ssh-copy-id 在linux下实现ssh无密码登录访问(转)

    转自:http://blog.csdn.net/pennyliang/article/details/8556662 ssh-keygen+ssh-copy-id 在linux下实现ssh无密码登录访 ...

  7. ssh 无密码登录

    ssh 无密码登录要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS为例. 有机器A(192.168.1.155),B(192.168.1.181).现想 ...

  8. CentOS配置ssh无密码登录

      CentOS配置ssh无密码登录的注意点   前提配置:使用root登录修改配置文件:/etc/ssh/sshd_config,将其中三行的注释去掉,如下: 然后重启ssh服务:service s ...

  9. SSH无密码验证

    一.安装和启动SSH协议 sudo yum install ssh sudo yum install rsync service sshd restart 启动服务 (rsync是一个远程数据同步工具 ...

随机推荐

  1. POJ1690 简单运算去括号

    题目大意: 给定一串只含加减和括号的运算,去掉没用的括号和空白字符输出 这里其实只要去找当前括号前面那个运算符是不是减号,如果是减号且这个括号内出现过运算符说明这个括号应该存在 #include &l ...

  2. 【贪心】codeforces A. Heidi and Library (easy)

    http://codeforces.com/contest/802/problem/A [题意] 有一个图书馆,刚开始没有书,最多可容纳k本书:有n天,每天会有人借一本书,当天归还:如果图书馆有这个本 ...

  3. 【bzoj4260】 Codechef REBXOR trie树

    Input 输入数据的第一行包含一个整数N,表示数组中的元素个数. 第二行包含N个整数A1,A2,…,AN.     Output 输出一行包含给定表达式可能的最大值.   Sample Input ...

  4. windows下安装使用WGET

    windows下安装WGET   1. 安装wget    www.2cto.com   网址:http://gnuwin32.sourceforge.net/packages/wget.htm 下载 ...

  5. 栈 练习 Codevs 3137 3138 3139

    3137 栈练习1 时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题目描述 Description 给定一个栈(初始为空,元素类型为整数,且小于等于100),只 ...

  6. django学习之- session

    session和cookie关系:session依赖于cookie基于cookie做用户验证时,敏感信息不适合放在cookie中原理:cookie定义:保存在用户游览器端的键值对session定义:保 ...

  7. HDU 6396 贪心+优先队列+读入挂

    Swordsman Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total ...

  8. [NOI2012(bzoj2879)(vijos1726)]美食节 (费用流)

    2879: [Noi2012]美食节 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 2288  Solved: 1207[Submit][Status ...

  9. 仿苹果app下载动画-煎饼

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. Google的Guava类库简介(转)

    说明:信息虽然有点旧,至少可以先了解个大概. Guava是一个Google的基于Java的类库集合的扩展项目,包括collections, caching, primitives support, c ...