SSHリモートコマンドの最大長を定義するものは何ですか?

SSHリモートコマンドの最大長を定義するものは何ですか?

これはやや関連しています。コマンドの単一パラメータの最大サイズを定義するものは何ですか?。しかし、これはシェル自体に関連しています。

コマンドを使用して最大サイズまたは文字列の長さを定義するものが何であるかを知りたいですssh。例はです$ ssh user@remote "echo very big command"

トレースとエラーでテストするためにいくつかのスクリプトが見つかりました。しかし、もっと良い方法があると思います。しかし、最初に文字列の最大長を定義することが何であるかを理解したいと思います。

以下は、最大長の誤差を発生させる方法の例です。

Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import Popen
>>> Popen(['ssh', 'user@localhost', 'echo', '{}'.format('T' * 500000)])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 7] Argument list too long: 'ssh'

私のシステム(ARM64hfのDebian 11)の制限は131067文字(startを除く)で始まりsshますecho。しかし、getconf ARG_MAXはるかに高いです2097152

ベストアンサー1

おすすめ記事