I am trying to run a script on remote server as a root user. I have this line in my shell script.
cat /home/myuser/create_user_updated.sh | ssh myuser@$myip "sudo sh"
I get the following error.
sudo: sorry, you must have a tty to run sudo
The script "create_user_updated.sh" works ok if copy the file to remote server and execute it there locally. But it does not work from remote server.