cat | sudo tee somefile > /dev/null
is still my favorite way to paste text into an ssh session and save it to a protected file. cat | sudo tee somefile > /dev/null
is still my favorite way to paste text into an ssh session and save it to a protected file. <file ssh 'cat >file'
And you could just use scp, but I've found clients without scp and servers with the SFTP subsystem disabled. sudo tee somefile > /dev/null
And you will be able to paste from your clipboard or write anything you want. Without cat or piping.