---
title: "Lab 2"
author: "Juhyun Kim, Hua Zhou"
date: "1/16/2020"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

1. On your local machine (laptop), check whether you already have SSH keys at default location `~/.ssh`. 
    - On MacOS terminal: 
        - The permission for the `~/.ssh` folder should be `700 (drwx------)`. 
        - The permisison for the private key `~/.ssh/id_rsa` should be `600 (-rw-------)`. 
        - The permission of the public key `~/.ssh/id_rsa.pub` should be `644 (-rw-r--r--)`.
    - On Window Git Bash, the following permission could also work (thanks to Ranjana): 
        - The permission for the `~/.ssh` folder can be `755 (drwxr-xr-x)`. 
        - The permisison for the private key `~/.ssh/id_rsa` can be `644 (-rw-r--r--)`. 
        - The permission of the public key `~/.ssh/id_rsa.pub` can be `644 (-rw-r--r--)`.
    
2. On the teaching server, put the same pair of keys under `~/.ssh`. 
    - The permission for the `~/.ssh` folder should be `700 (drwx------)`. 
    - The permisison for the private key `~/.ssh/id_rsa` should be `600 (-rw-------)`.
    - The permission of the public key `~/.ssh/id_rsa.pub` should be `644 (-rw-r--r--)`. 
    - The `authorized_keys` file should contain the public key (cannot duplicate) and its permission should be `600 (-rw-------)`.
   
3. (optional) If no SSH keys yet, generate a pair of SSH RSA keys
    - Method 1: generate keys on MacOS Terminal or Windows Git Bash. Follow [instructions in lecture notes](https://ucla-biostat203b-2020winter.github.io/slides/02-linux/linux.html#steps-to-generate-keys).  
    - Method 2: Use RStudio to generate keys. Tools -> Global Options... -> Git/SVN. 
Using either method, make sure keys are in the default location `~/.ssh/`

4. Register an account on [GitHub Student Developer Pack](https://education.github.com/pack), **using ucla.edu email**. 

5. Upload the public key to GitHub account.

6. Create a **private repository** called `biostat-203b-2020-winter` and add `Hua-Zhou` and `juhkim111` as your collaborators with write permission. Gitignore R.

7. Set up seemless SSH connection between (1) laptop, (2) teaching server, and (3) GitHub.

8. Log in to the RStudio server on teaching server <http://server.ucla-biostat-203b.com:8787>, using the username and password on the teaching server.

8. On teaching server, initialize a project from GitHub within RStudio. Make sure use the Git address instead of the HTTPS address. You can also initialize a project using RStudio on your laptop. But HW1 is mostly about Linux and most easily done on teaching server.

9. Commit the `Rproj` file.

10. Create a new branch called `develop`.

11. Within `develop` branch, create folder `hw1` and start working on `hw1sol.Rmd`. Commit `hw1sol.Rmd`.

12. Basics of RMarkdown.

13. QA and hints for HW1.
