Im trying to do some automated updates on the routers by remote ssh commands.
so I try this
ssh username@hostname /system/identity/print
and I get the name of the router
now I try
echo “/system/identity/print” > input.txt
ssh username@hostname < input.txt
and the ssh connection hangs.
On other routers this method works without an issue.
Anyone have a hint on how to work around this?
I could upload the commands to execute into a file and upload the file but then I need a way to tell the mikrotik to execute all the commands in that file.
The other option would be to use the api but that then becomes way more complex.
What version of ssh do you use, that not support "Disable pseudo-terminal allocation" ?
I can see that dropbear ssh client dbclient also support that option.
ssh -V OpenSSH_10.2p1, OpenSSL 3.6.0 1 Oct 2025 $
Maybe there are some another options to do the same.
And do you use ssh correctly ? Providing the username and password or using more secure one like the PKI with public and private keys.
Sorry for not address the question to the correct user, my prev post was addressed to @mantouboji
But I can address a question to you also, is this for deployment of lots of routers configs, you could use the netinstall-cli to deploy the config, and also the newest firmware and RouterOS.(sadly not not remotely)
And also when scripting, there also you have the <CR><LF> or only <LF> or only <CR> of end of lines to think of, what the cli environment uses.
we want to use it to automatically deploy generated BGP route filters on a daily basis.
Works great on all non mikrotik routers but on the mikrotiks, the feeding of the cli with commands failed.
As I said, the workaround should work but I still dont fully understand why ssh 1.1.1.1 < inputfile is any different to ssh 1.1.1.1 and then pasting the input file into the standard input
The same problem… It’s not very good to upload tons of files to execute it from router… May be any other ideas how to run multiline script from remote host?