ssh-keygen ssh-copy-id 无密码登陆
进行android开发经常需要登录远程ubuntu server服务器进行编译查看代码等,每次都需要输入密码,很烦人。
使用 ssh-keygen和ssh-copy-id配置一下就可以无需输入密码直接登录服务器了。
ssh-keygen 创建公钥和密钥。
ssh-copy-id 把本地主机的公钥复制到远程主机的authorized_keys文件上。
ssh-copy-id 也会给远程主机的用户主目录(home)和~/.ssh, 和~/.ssh/authorized_keys设置合适的权限 。
user@machine:~$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/user/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user/.ssh/id_rsa. Your public key has been saved in /home/user/.ssh/id_rsa.pub. The key fingerprint is: 43:c6:7d:c4:9c:85:bd:8f:f0:5a:b7:8b:37:e6:e9:12 user@machine The key's randomart image is: +--[ RSA 2048]----+ | o.=. | | . . .= . | | + . . . | | o .. . | | S o o | | . E+ o| | o...| | ...=.| | .*=o| +-----------------+ user@machine:~$ user@machine:~$ ls -l .ssh/ total 12 -rw------- 1 user user 1679 Sep 4 16:34 id_rsa -rw-r--r-- 1 user user 393 Sep 4 16:34 id_rsa.pub -rw-r--r-- 1 user user 222 Sep 3 13:03 known_hosts user@machine:~$ ssh-copy-id -i .ssh/id_rsa.pub user@172.16.2.15 user@172.16.2.15's password: Now try logging into the machine, with "ssh 'user@172.16.2.15'", and check in: ~/.ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. user@machine:~$ ssh user@172.16.2.15
如果有端口号的话:
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 20022 test@192.168.3.2
相关推荐
[root@hadoop1 sbin]# ssh-copy-id hadoop1 /usr/bin/ssh-copy-id: ERROR: failed to open ID file '/root/.pub': 没有那个文件或目录 (to install the contents of '/root/.pub' anyway, look at the -f option) ...
Publish Over SSH插件使用 在使用Publish Over SSH之前,需要制作SSH私钥。机器间做免密登录配置。...ssh-copy-id 192.168.BB.BBB 验证方式是:在A机器上执行ssh 192.168.BB.BBB,然后执行ifconfig
本文实例为大家分享了jaLinux配置远程SSH无密码登录的方法,供大家参考,具体内容如下 系统:CentOS 6.8 主机1:192.168.0.177 主机2:192.168.0.178 工具介绍: ssh-keygen:创建公钥和密钥 ssh-copy-id:把生成的...
【⼤数据】虚拟机免密登录 ⼀.ssh-keygen -t rsa 输⼊⽂件名xxx,此⽂件名下⼀步要⽤ ⼆.ssh-copy-id -i xxx.pub hadoop@hadoop02 将此密钥⽂件拷贝⾄其他机器 三、hadoop02授权 chmod g-w /home/hadoop chmod 700 /...
[VERT] Estabelecendorelaçãodeconfiança 热那亚人托多斯·奥·科曼多斯·德沃姆 要求前 吉特 ...cd vert_suporte/ Python ...Enter file in which to save the key (/root/.ssh/id_rsa): <ENTER
1、ssh-keygen -t rsa 2、ssh-copy-id -i /root/.ssh/id_rsa.pub USERNAME@host 这样原来的
[hadoop@a1 ~]$ ssh-copy-id -i /home/hadoop/.ssh/id_rsa.pub a3 [hadoop@a2 ~]$ ssh-copy-id -i /home/hadoop/.ssh/id_rsa.pub a1 [hadoop@a2 ~]$ ssh-copy-id -i /home/hadoop/.ssh/id_rsa.pub a2 [hadoop@a2 ~]...
venv/bin/activate # optional pip install budgie您需要为远程主机配置无密码 SSH: ssh-keygen -q -t rsa -N 'your_password_here' -f ~/.ssh/id_rsa ssh-copy-id localhost # Repeat this for each host eval &#...
.ssh / demo_id_rsa更新主机: vim主机更新SSH密钥文件路径: vim主机验证并获取有关您的Ansible库存的信息ansible-inventory -i主机--list部署公钥托管ssh-copy-id -i〜/ .ssh / demo_id_rsa.pub demouser@138.91....
ssh-copy-id root@123.45.56.78(你的服务器ip), 或这使用 cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys 即可将,你的客户端key传到服务器的~/.ssh/...
ssh-copy-id username@server_ip 新建autossh自启动脚本, chmod a+x autossh 并运行, 脚本的内容: #!/bin/bash /bin/su -c '/usr/bin/autossh -M 1234 -NR 19999:localhost:22 buhuipao@server_ip -p your_port' -...
Linux—设置虚拟机之间免密登录,适合集群之间,方便文件传输。 设置免密登录 很多帖子发的免密登录我不想吐槽,实力带躺,好好看下面五杀操作 为什么设置免密 从一台虚拟机上登录到另一台需要密码,两...ssh-copy-id h
ssh-copy-id 192.168.100.10(20.30.102) 2.上传安装包,解压编译安装 配置yum仓库 vim /etc/yum.repos.d/mhapath.repo ##进入yum仓库,插入以下 [mha] name=mhapath baseurl=file:///root/mhapath enabled=1 ...
如果本地计算机上有ssh-copy-id,请使用它。 local$ ssh-copy-id username@serverName.local否则,请手动进行。 local$ cat local$ ssh username@serverName.localserver-ssh-shell$ cd ~/server-ssh-shell$ mkdir ...
Apache Hadoop 安装 ... $ ssh-copy-id -i ~/.ssh/id_rsa.pub localhost $ ssh localhost $ exit install OpenJdk 1.7 sudo apt-get install openjdk-7-jdk Set JAVA_HOME in .bashrc export JAVA
非凡鼠标 将您的 reMarkable 用作绘图板。 特别感谢和的启发。 快速开始 在通过 USB 插入平板电脑的主机上: pip install remarkable-mouse remouse 默认情况下, 10.11.99.1...ssh-copy-id -i ~ /.ssh/remarkable
ssh - copy-id - i ~ / .ssh / id_rsa.pub root @192 .168.1.3 # Install pip for Ubuntu sudo apt install python - pip # Install dependencies from ``requirements.txt` sudo pip install - r requirements.txt ...
第一种1.安装git bash $ ssh 用户名@ ip地址 -p 端口号 例如:$ ssh root@111.44.254.164 -p 20003 ...将电脑ssh公钥添加到服务器:ssky-keygen + ssh-copy-id 无密码登陆远程LINUX主机 有一篇文章
$ssh-copy-id user@remotehost...或者仅使用ssh ... $cat ~/.ssh/id_rsa.pub | ssh user@remotehost "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"现在测试您可以不用密码访问远程服务器$ssh user@remote...