Skip to content

Instantly share code, notes, and snippets.

@thinkjrs
Forked from nickbayley/alt-ssh-copy-id.md
Created October 15, 2022 20:25

Revisions

  1. @nickbayley nickbayley renamed this gist Apr 30, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @nickbayley nickbayley revised this gist Apr 30, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,15 @@
    ## Windows alternative to ssh-copy-id
    ## Simple Alternative to `ssh-copy-id`

    Replace `user` with the name of the user you want to ssh as.

    Replace the `ip` with the ip of the machine / host / vps you want to connect to.

    ``` shell
    cat ~/.ssh/id_rsa.pub | ssh user@ip "cat >> ~/.ssh/authorized_keys"
    ```

    If the directory .ssh is not yet created on the machine / host / vps, use this small variation:

    ``` shell
    cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
    ```
  3. @nickbayley nickbayley revised this gist Apr 30, 2015. 2 changed files with 12 additions and 8 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ## Windows alternative to ssh-copy-id

    Replace `user` with the name of the user you want to ssh as.
    Replace the `ip` with the ip of the machine / host / vps you want to connect to.
    ``` shell
    cat ~/.ssh/id_rsa.pub | ssh user@ip "cat >> ~/.ssh/authorized_keys"
    ```

    If the directory .ssh is not yet created on the machine / host / vps, use this small variation:
    ``` shell
    cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
    ```
    8 changes: 0 additions & 8 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +0,0 @@
    # the below is a simple shell command which is similar in functionality to ssh-copy-id

    # replace user with the name of the user you want to ssh as
    # replace the ip with the ip of the machine / host / vps you want to connect to
    cat ~/.ssh/id_rsa.pub | ssh user@ip "cat >> ~/.ssh/authorized_keys"

    # if the directory .ssh is not yet created on the machine / host / vps, use this small variation:
    cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
  4. @nickbayley nickbayley created this gist Apr 28, 2015.
    8 changes: 8 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # the below is a simple shell command which is similar in functionality to ssh-copy-id

    # replace user with the name of the user you want to ssh as
    # replace the ip with the ip of the machine / host / vps you want to connect to
    cat ~/.ssh/id_rsa.pub | ssh user@ip "cat >> ~/.ssh/authorized_keys"

    # if the directory .ssh is not yet created on the machine / host / vps, use this small variation:
    cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"