Ssh and input length

Hello,
sometimes I need to enter a command that exceeds the maximum line limit for ssh
Is it possible to increase this limit?

Thanks

  • Copy command to a file in /tmp
  • chmod +x
  • Execute command
  • Is this an OpenWrt device?
    • If so, what version?
  • What is this "line limit"?
  • Can you show an example?
1 Like

Yes the trick of creating a file is what I have been doing, but it is somewhat uncomfortable.

MediaTek MT7621 OpenWrt 21.02.3

Sometimes I download something from a free slow server to leave hours downloading to a USB with Curl. And many times the url does not fit in the command

Example:

curl 'https://duckduckgo.com/assets/icons/meta/DDG-iOS-icon_152x152.png' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0' -H 'Accept: image/avif,image/webp,*/*' -H 'Accept-Language: es-ES,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://duckduckgo.com/' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: image' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' -JO


root@OpenWrt:~# curl 'https://duckduckgo.com/assets/icons/meta/DDG-iOS-icon_152x152.png' -H 'User-Agent: Mozil
la/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0' -H 'Accept: image/avif,image/webp,*/*' -H '
Accept-Language: es-ES,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://duckduckgo.com/'
 -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: image' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch
-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailer

Have you actually checked that you absolutely need all the headers you're specifying, like e.g. if you're downloading binary files, then specifying what languages you accept isn't going to actually change anything.

It is only an example of capacity, in real use I do not include any header only the url is very long.

Is it a dropbear limitation or is it configurable?

1 Like

This is not a limit in ssh. It is a command line length limit in the ash shell.
I encountered this problem a while ago. I don't recall the exact size limit but is around 1024 characters I think.
I got round it by piping the output of a file into the executable.
eg try something like

cat /tmp/mycommandline.txt | command_executable
2 Likes

For now I was doing,

#!/bin/bash
command_executable

thanks for the suggestion

"ash shell" is also not configurable that we know of isn't it?

Bash is not available by default. Do you mean you have installed it to fix the problem?
It should be:
#!/bin/sh
for ash.

1 Like

Right, I installed it for a script of my own that was more complex than sh allowed.