ssh 连接子系统_是否可能有多个SSH连接到同一系统?

ssh 连接子系统

ssh 连接子系统_是否可能有多个SSH连接到同一系统?

When you’re setting up a personal server for the first time, you may find yourself with quite a few questions about what it is, or is not capable of doing. With that in mind, today’s SuperUser Q&A post has answers for a curious reader’s question.

首次设置个人服务器时,您可能会遇到很多有关其功能或不能够执行的问题。 考虑到这一点,今天的SuperUser Q&A帖子为读者提出了一个好奇的问题的答案。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

Screenshot courtesy of Casablanca (Wikimedia Commons).

屏幕截图由卡萨布兰卡(Wikimedia Commons)提供

问题 (The Question)

SuperUser reader Sam3000 wants to know if It is possible to have multiple SSH connections to the same system:

超级用户阅读器Sam3000想知道是否可以有多个SSH连接到同一系统:

I have a Linux computer acting as a server that can accept incoming SSH connections. Is it possible to reliably connect multiple devices at the same time, such as my mobile phone and laptop, as well as other desktops, to the same server using SSH?

我有一台充当服务器Linux计算机,可以接受传入的SSH连接。 是否可以使用SSH同时将多个设备(例如我的手机和笔记本电脑以及其他台式机)可靠地连接到同一台服务器?

Is it possible to have multiple SSH connections to the same system?

到同一系统是否可以有多个SSH连接?

答案 (The Answer)

SuperUser contributors badge-be and Hastur have the answer for us. First up, badge-be:

超级用户贡献者badge-be和Hastur为我们找到了答案。 首先,徽章是:

The Short Answer

简短答案

Yes, it usually works by default.

是的,默认情况下通常可以使用。

The Long Answer

长答案

It depends on what you are using it for. It may slow down with multiple connections, but that is a bandwidth issue, not an SSH issue.

这取决于您使用它的目的。 通过多个连接,它可能会变慢,但这是带宽问题,而不是SSH问题。

Followed by the answer from Hastur:

接下来是Hastur的答案:

Yes it is possible, it is the default behavior. You can rely on it if you are using an updated version of SSH and it is no longer set to Protocol 1. The command below should give you Protocol 2.

是的,这是可能的,这是默认行为。 如果您使用的是SSH的更新版本,并且不再设置为Protocol 1 ,则可以依靠它。 以下命令应为您提供协议2

  • grep “Protocol” /etc/ssh/sshd_config

    grep“协议” / etc / ssh / sshd_config

Limits for the Connections

连接限制

You can look upon SSH as an encrypted evolution of telnet, born to allow remote access to a server. Note that SSH connects over TCP and it is able to forward X-sessions (graphical sessions) too. Multi-tasking and multiple users are a part of the inner nature of Unix (even if it is not without limits).

您可以将SSH看成是telnet的加密演变,它是为允许远程访问服务器而诞生的。 请注意,SSH通过TCP连接,它也能够转发X会话(图形会话)。 多任务和多个用户是Unix内部特性的一部分(即使并非没有限制)。

You can see some of those limits in the TCP and SSH limits:

您可以在TCP和SSH限制中看到其中一些限制:

  • cat /proc/sys/net/core/somaxconn (usually 128, to see the maximum number of TCP outstanding connections you can have)

    cat / proc / sys / net / core / somaxconn (通常为128,以查看可以拥有的TCP未完成连接的最大数量)

The kern.ipc.somaxconn sysctl(8) variable limits the size of the listening queue for accepting new TCP connections. The default value of 128 is typically too low for robust handling of new connections on a heavily loaded web server.

kern.ipc.somaxconn sysctl(8)变量限制了用于接受新的TCP连接的侦听队列的大小。 默认值128通常太低,以至于无法在负载沉重的Web服务器上可靠地处理新连接。

  • cat /proc/sys/net/core/netdev_max_backlog (usually 1000, the maximum length of the TCP packet queue)

    cat / proc / sys / net / core / netdev_max_backlog (通常为1000,TCP数据包队列的最大长度)

  • less /etc/security/limits.conf (you can find the limits for the number of users)

    /etc/security/limits.conf更少(您可以找到用户数量的限制)

  • MaxSessions in /etc/ssh/sshd_config (specifies the maximum number of open sessions permitted per network connection, the default is set at 10)

    / etc / ssh / sshd_config中的MaxSessions (指定每个网络连接允许的最大打开会话数,默认设置为10)

  • #MaxStartups 10:30:60, usually commented in the /etc/ssh/sshd_config (specifies the maximum number of concurrent unauthenticated connections to the SSH daemon, the default is set at 10)

    #MaxStartups 10:30:60 ,通常在/ etc / ssh / sshd_config中进行注释(指定与SSH守护程序的并发未认证连接的最大数量,默认设置为10)。

References

参考文献

1. man ssh and man sshd on your computer

1. man sshman sshd在您的计算机上

2. The man pages for sshd and sshd_config

2. sshdsshd_config的手册页



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/240809/is-it-possible-to-have-multiple-ssh-connections-to-the-same-system/

ssh 连接子系统

相关文章: