I'm trying to do the following but it's not quite right.
cat ~/Desktop/blah.png | ssh -t -t [email protected] "cat | sudo -i 'cat | /path/to/blah.png'"
I have my public ssh key in the [email protected] user's .ssh folder, so no initial password is needed. When the sudo -i
command finally starts, it prompts me for the root password, but immediately fails as if I had pressed enter but I didn't even touch the keyboard. I have a feeling maybe the cat
command is being catted into the password prompt. The output looks like this:
trusktr@LENOVO-PC ~
$ cat ~/Desktop/win-8.1-missing-lockscreen-setting.png | ssh -t -t [email protected] "cat | sudo -i 'cat > /srv/http/default/htdocs/~/img/win-8.1-missing-lockscreen-setting.png'"
tcgetattr: Not a character device
[sudo] password for root:
You type like i drive.
[sudo] password for root:
Your mind just hasn't been the same since the electro-shock, has it?
[sudo] password for root:
Maybe if you used more than just two fingers...
sudo: 3 incorrect password attempts
Connection to 50.116.4.56 closed.
I don't have direct ssh access through the root user, only through a normal user with access to sudo using the root password.
How might I cat the image through ssh, through the non-root user, into the root location all in a single command?