锁屏后 ssh断线

锁屏后ssh 连接会自动断线。

  • ssh_config 已经设置ServerAlive 60
chenzijian@chenzijians-MacBook-Air ~ % head .ssh/config 
Host *
ServerAliveInterval 60
chenzijian@chenzijians-MacBook-Air ~ % tail /etc/ssh/ssh_config
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

Host *
	#SendEnv LANG LC_*
	XAuthLocation /opt/X11/bin/xauth
chenzijian@chenzijians-MacBook-Air ~ % 



  • 电池设置

chenzijian@chenzijians-MacBook-Air ~ % sudo su
Password:
root@chenzijians-MacBook-Air chenzijian # systemsetup -getsleep
Sleep: Computer sleeps Never
Sleep: Display sleeps after 15 minutes
Sleep: Disk sleeps Never
root@chenzijians-MacBook-Air chenzijian # 


  • 应该不是服务器端的问题,因为我连接的所有服务器都会断线


MacBook Air 13″, macOS 11.1

发布日期 2021年1月19日 上午2:21

回复
问题被标记为 排名最靠前的回复

发布日期 2021年1月19日 上午10:30

另外在.ssh/config 中加一行在ServerAliveInterval 60之后:

ServerAliveCountMax 10


应为默认是 3,那么正好是 3 分钟。

类似问题

回复量: 5

2021年1月19日 上午10:48 回应 tonyfromcalgary

root@chenzijians-MacBook-Air chenzijian # pmset -g custom
Battery Power:
 Sleep On Power Button 1
 standby              1
 powernap             1
 ttyskeepawake        1
 displaysleep         5
 sleep                1
 tcpkeepalive         1
 lessbright           1
 disksleep            0
AC Power:
 Sleep On Power Button 0
 standby              1
 powernap             1
 ttyskeepawake        1
 womp                 1
 displaysleep         15
 networkoversleep     0
 sleep                0
 tcpkeepalive         1
 disksleep            0
root@chenzijians-MacBook-Air chenzijian #

查看了一下manual,感觉pmset应该可以解决我的问题,我稍晚点试验一下

这个主题已被系统或社区团队关闭。 你可以为你认为有帮助的任何帖子投票,也可以在社区中搜索其他答案。

锁屏后 ssh断线

欢迎来到 Apple 支持社区
Apple 客户在其产品方面互相帮助的论坛。使用您的 Apple 帐户开始畅游其中吧!!