SSH:修订间差异

来自OSSmedia
无编辑摘要
无编辑摘要
第54行: 第54行:
         PubkeyAuthentication yes
         PubkeyAuthentication yes


== 引用公钥 ==
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
curl https://github.com/username.git >> ~/.ssh/authorized_keys
== 错误排查 ==
== 错误排查 ==
  详见[[SSH/错误排查]]
  详见[[SSH/错误排查]]

2024年5月30日 (四) 02:01的版本

ssh是用来连接其他电脑的工具软件,广泛用于服务器运维。

客户端配置

用户的配置文件位于 ~/.ssh/config 下。

参数

禁用局域网内部的主机密钥检查

Host 192.168.*.*
 UserKnownHostsFile /dev/null
 StrictHostKeyChecking no

为github配置ssh

Host github
 User git
 HostName github.com
 IdentityFile ~/.ssh/github
 ProxyCommand nc -X 5 -x 127.0.0.1:2080 %h %p

ssh over ssl

Host ossmedia
 HostName ossmedia.cn
 ProxyCommand openssl s_client -quiet -servername <host> -connect <host:port>
 User username

默认为所有ssh目标主机配置代理

Host *
  RemoteForward 12321 127.0.0.1:2080

使用多个配置文件

Include config.d/home

服务端配置

服务器

UseDNS no
AddressFamily inet
SyslogFacility AUTHPRIV
PermitRootLogin no
PasswordAuthentication yes

TCPKeepAlive yes
ClientAliveInterval 100
ClientAliveCountMax 240

局域网

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication no
Match Address 192.168.*
       PermitRootLogin yes
       PasswordAuthentication yes
       PubkeyAuthentication yes

引用公钥

mkdir ~/.ssh touch ~/.ssh/authorized_keys curl https://github.com/username.git >> ~/.ssh/authorized_keys

错误排查

详见SSH/错误排查