赞
踩
不要私钥密码 连续回车 win git
ssh-keygen -t rsa -b 4096 -C "yourname or youremail""
qs@Dell MINGW64 ~/.ssh $ ssh-keygen -t rsa -b 4096 -C "qs" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/qs/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/qs/.ssh/id_rsa Your public key has been saved in /c/Users/qs/.ssh/id_rsa.pub The key fingerprint is: SHA256:w+FK6G7tG7TCxhSPbD7j/o4FdUwg533xzFh5GCC9/Sc qs The key's randomart image is: +---[RSA 4096]----+ | . o.o.o.o+ | | + + ..Bo . | | . o = oo+. | | . * + o. . | | B + S . | | B + o . E .| | X.= o | | +.*.. | | o=+=. | +----[SHA256]-----+ qs@Dell MINGW64 ~/.ssh $ ls id_rsa id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub yourname@hostname
# win
ssh-copy-id -i /c/Users/yourname/.ssh/id_rsa.pub yourname@hostname
#linux
ssh-copy-id -i ~/.ssh/id_rsa.pub yourname@hostname
qs@Dell MINGW64 ~/.ssh
$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.0.0.5
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/c/Users/qs/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@10.0.0.5's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@10.0.0.5'"
and check to make sure that only the key(s) you wanted were added.
vim /etc/ssh/sshd_config
# ADD#
# AllowTcpForwarding yes
/etc/init.d/ssh restart
vim /etc/ssh/sshd_config
ClientAliveInterval 30
ClientAliveCountMax 86400
# #
# 1、客户端每隔多少秒向服务发送一个心跳数据
# 2、客户端多少秒没有相应,服务器自动断掉连接
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。