The following command puts the content of the local id_rsa.pub into the authorized_keys file on the host. But I don't quite understand how cat and | works together to achieve this goal, can someone explain?cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
How does this shell command work?
shell;ssh
The cat command outputs contents of the file .ssh/id_rsa.pub; the | (pipe) receives this text output and then sends (i.e. pipes) the text to ssh.Then, ssh uses this text as input for the cat >> .ssh/authorized_keys command.