need add string to file on remote ssh server without prompting sudo password
myuser=testuser
$ sshpass -p "$mypass" ssh -t -o StrictHostKeycheking=no $myuser@$myhost "echo $mypass | sudo -S -s /bin/bash -c \"echo $myText >> test.txt\""
sometimes it gives me
[sudo] password for testuser: /bin/bash: line 1: test.txt: No such file or directory
sudo tee test.txt <<< "$myText"or write to/tmpandsudo mvto the final destination. You should review your workflow, this is a security nightmare.