SSH login without password
SSH login without password
Your aim
You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.
How to do it
First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password:
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B hostname
B
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
- Put the public key in .ssh/authorized_keys2
- Change the permissions of .ssh to 700
- Change the permissions of .ssh/authorized_keys2 to 640
Keywords: ssh openssh password Author: Mathias Kettner
SSH login without password的更多相关文章
- 3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-s ...
- 【转载】SSH login without password 免密登陆
Your aim You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic l ...
- Fixing ssh login long delay
原文:http://injustfiveminutes.com/2013/03/13/fixing-ssh-login-long-delay/ For a long time I had a prob ...
- 无法连接 MKS: Login(username/password)incorrect
升级到Vmware Workstation 12之后,客户端能连上虚拟机服务器,但却打不开共享的虚拟机,提示报错"无法连接 MKS: Login(username/password)inco ...
- 实现ssh的无password登录
这里所说的ssh是指OpenSSH SSHclient.是用于登录远程主机.而且在远程主机上运行命令.它的目的是替换rlogin和rsh,同一时候在不安全的网络之上,两个互不信任的主机之间,提供加密的 ...
- Passwordless SSH Login
原文地址:http://manjeetdahiya.com/2011/03/03/passwordless-ssh-login/ Consider two machines A and B. We w ...
- Security configuration of SSH login entry - enterprise security practice
catalog . 引言 . 修改ssh端口 . 禁用root远程ssh登录 . 只使用SSH v2 . 限制用户的SSH访问 . 禁用.rhosts文件 . 禁用基于主机的身份验证 . 基于公私钥的 ...
- ssh 设置免password登录
如果: 实现->操作机A机 要以用户"user1"身份.免password登录B机和C机? B机和C机 建立用户 user1 而且能够ssh 登录. A机设置: 1.安装ss ...
- ssh login nova vm
$ sudo cat >> /usr/bin/nova-ssh << END FIRST=$1 IDX=`expr index $1 "@"`if [[ ...
随机推荐
- vuex其实超简单,只需3步
前言 之前几个项目中,都多多少少碰到一些组件之间需要通信的地方,而因为种种原因,event bus 的成本反而比vuex还高, 所以技术选型上选用了 vuex, 但是不知道为什么,团队里的一些新人一听 ...
- docker:安装redis
文章来源:https://www.cnblogs.com/hello-tl/p/9239474.html 1.添加镜像 # docker pull redis:4.0 2.在/data下新建文件夹re ...
- cygin常用命令
基本操作命令: ---------------------------------------------------------------------- --------------------- ...
- Repo command reference
Repo command reference In this document init sync upload diff download forall prune start status Rep ...
- tomcat启动后 404 页面无法访问
如果修改端口后还不能访问,先关闭tomcat, 在bin目录下命令 ./shutdown.sh 找到80进程 netstat -an | grep 80 杀死80进程 ps -ef | grep h ...
- mysql 面安装配置
解压MySQL压缩包 将以下载的MySQL压缩包解压到自定义目录下,我的解压目录是: "D:\Program Files\MySQL\mysql-5.6.13-win32&quo ...
- 关于面试总结-SQL经典面试题
关于面试总结6-SQL经典面试题 前言 用一条SQL 语句查询xuesheng表每门课都大于80 分的学生姓名,这个是面试考sql的一个非常经典的面试题 having和not in 查询 xueshe ...
- 初识LiveScript
The LiveScript Book 邂逅 LiveScript 就像很多现代化的语言一样,LiveScript 使用缩进来表示语句块,使用换行取代分号来表示一个语句的结束 (如果你想要一行 ...
- POJ-2078 Matrix,暴力枚举!
Matrix 题意:一个n*n的数字矩阵,每次操作可以对任意一行或者一列进行循 ...
- tomcat在centos6+上的自启动脚本
#!/bin/bash # # tomcat startup script for the Tomcat server # # chkconfig: 345 80 20 # description: ...