Last active
September 5, 2018 18:49
-
-
Save GabLeRoux/ad3fb942d788e6f49e6ce3fe3c310cb8 to your computer and use it in GitHub Desktop.
Revisions
-
GabLeRoux revised this gist
Aug 31, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ ssh-add ~/.ssh/EXAMPLE_rsa ## 2. Add your public key to the remote server ```bash ssh-copy-id -i ~/.ssh/EXAMPLE_rsa -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected] ``` ## 3. Add an entry to your `~/.ssh/config` @@ -20,7 +20,7 @@ ssh-copy-id -i ~/.ssh/my_key_rsa -o PreferredAuthentications=password -o PubkeyA Host example-alias example.com Hostname example.com User user IdentityFile ~/.ssh/EXAMPLE_rsa IdentitiesOnly yes ``` -
GabLeRoux revised this gist
May 24, 2018 . 4 changed files with 32 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ ## 1. Generate yourself a new ssh key ```bash # Generate new ssh key (from github) # https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ ssh-keygen -t rsa -b 4096 -C "[email protected]" eval "$(ssh-agent -s)" ssh-add ~/.ssh/EXAMPLE_rsa ``` ## 2. Add your public key to the remote server ```bash ssh-copy-id -i ~/.ssh/my_key_rsa -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected] ``` ## 3. Add an entry to your `~/.ssh/config` ``` Host example-alias example.com Hostname example.com User user IdentityFile ~/.ssh/my_key_rsa IdentitiesOnly yes ``` Note: you can use these instead of `IdentitiesOnly yes` for your first connection ```bash PreferredAuthentications=password PubkeyAuthentication=no ``` -
GabLeRoux revised this gist
May 24, 2018 . 3 changed files with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/usr/bin/env bash # Generate new ssh key (from github) # https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ ssh-keygen -t rsa -b 4096 -C "[email protected]" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,4 @@ #!/usr/bin/env bash # run this on your system ssh-copy-id -i ~/.ssh/my_key_rsa -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected] File renamed without changes. -
GabLeRoux revised this gist
May 24, 2018 . 4 changed files with 3 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ #!/usr/bin/env bash ssh-copy-id -i ~/.ssh/my_key_rsa -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Host example-alias example.com Hostname example.com User user IdentityFile ~/.ssh/my_key_rsa IdentitiesOnly yes # use these instead of 'IdentitiesOnly yes' for your first connection -
GabLeRoux created this gist
May 14, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ #!/usr/bin/env bash # Generate new ssh key (from github) # https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ ssh-keygen -t rsa -b 4096 -C "[email protected]" eval "$(ssh-agent -s)" ssh-add ~/.ssh/EXAMPLE_rsa This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ # Connect without using ssh keys ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/usr/bin/env bash # run this on the remote server # Append ssh key to authorized_keys (replace public key with yours) export TEMP_SSH_USERNAME=$(whoami) export SSH_TEMP_PUBLIC_KEY="PASTE YOUR PUBLIC KEY HERE" mkdir ~/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys echo $SSH_TEMP_PUBLIC_KEY >> ~/.ssh/authorized_keys sudo chown -R $TEMP_SSH_USERNAME:$TEMP_SSH_USERNAME /home/$TEMP_SSH_USERNAME/.ssh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # Add entries like this to your ~/.ssh/config file Host example-alias example.com Hostname example.com User user IdentityFile ~/.ssh/EXAMPLE_rsa IdentitiesOnly yes # use these instead of 'IdentitiesOnly yes' for your first connection #PreferredAuthentications=password #PubkeyAuthentication=no