Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joeynimu/c83c45a164a0aecdccaa to your computer and use it in GitHub Desktop.
Save joeynimu/c83c45a164a0aecdccaa to your computer and use it in GitHub Desktop.

Revisions

  1. @learncodeacademy learncodeacademy renamed this gist Jul 2, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @learncodeacademy learncodeacademy created this gist Jul 2, 2014.
    43 changes: 43 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    ###SSH into a remote machine###
    ```
    ssh [email protected]
    #or by ip address
    ssh [email protected]
    ```
    __exit:__ `exit`
    ###Install Something###
    ```
    #If it's a new server, update apt-get first thing
    sudo apt-get update
    #then you can install something - say Git
    sudo apt-get install git
    ```

    ###Copy/Deploy files###
    ```
    #copy all of the files in this directory to the /home/will/newapp directory
    rsync -av . [email protected]:~/newapp
    #delete a file and run rsync again, and it only copies the one mising file
    ```

    ###Generate an SSH keypair for passwordless SSH###
    ```
    #on your computer
    cd ~/.ssh
    #you might need to make the .ssh directory
    ssh-keygen -C "[email protected]"
    #hit enter a few times to generate key

    #copy the file contents to the clipboard
    cat id_rsa.pub | pbcopy

    #log into your machine
    ssh [email protected]
    #make the .ssh directory and get in it
    mkdir .ssh
    cd .ssh
    #open authorized_keys in nano and paste the contents in
    nano authorized_keys
    #paste contents in and save by hitting ctrl+x

    #exit and you can now ssh without a password!