Basically I want to remotely cat a file, this is what I have so far. It doesn't work. I'm fairly new to all this:
echo /root/.ssh/id_rsa.pub | ssh root@HOSTNAME "cat >> /root/.ssh/authorized_keys
do not use echo
, use cat
cat /root/.ssh/id_rsa.pub | ssh root@HOSTNAME "cat >> /root/.ssh/authorized_keys"
echo /root/.ssh/id_rsa.pub
will output the string /root/.ssh/id_rsa.pubcat /root/.ssh/id_rsa.pub
will output the content of /root/.ssh/id_rsa.pub
ssh-copy-id -i my/alternate/pub.key root@HOSTNAME
might be a solution, you will be asked password the first time.
After setting trusts between servers with you can cat a file with ssh command
ssh-keygen -t rsa
ssh-copy-id [email protected]
ssh -l username server.ip.addr "cat file.txt"
ssh-copy-id
for this.