这是本文档旧的修订版!


Autossh 免密码登录

Install SSH

安装 sudo apt install openssh-server

允许根用户登录

sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo service ssh restart

mac/linux

参考文献 / 项目地址

安装依赖


Linux yum
install expect
apt-get install expect

安装 autossh

$ git clone https://github.com/FeeiCN/autossh.git
$ sudo cp autossh/autossh /usr/local/bin/

配置服务器

$ cat ~/.autosshrc
server_name|192.168.1.110|root|password|port|is_bastion

:!: 重新布置服务器,密码更改以后需要取消原来的key

ssh-keygen -R 217.160.61.19

Windos

安装 putty ,然后建立一个桌面快捷方式:

"C:\Program Files\PuTTY\putty.exe" -ssh -l <username> -pw <password> -i "servername" -P 22 192.168.0.*

ssh-keygen

ssh-keygen # 生成新的公钥,不需要额外设置 ssh-keygen -t rsa 
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

设置完登录一次,填写密码,以后就不需要了。(查看自己的公钥 cat ~/.ssh/id_rsa.pub

ssh 手冊

  1. 指定端口 ssh 192.168.0.116 -p 1234
,
it/server/autossh.1639969549.txt.gz · 最后更改: 2021-12-20 03:05 由 goldentianya
回到顶部
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0