SSH & DevOps Crash Course Snippets
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
$ touch hello.txt
$ sudo apt-get install apache2
$ ssh-keygen
> cat ~/.ssh/id_rsa.pub | ssh brad@192.168.1.29 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys
$ touch test.txt
$ scp ~/test.txt brad@192.168.1.29:~
Create account->create droplet
$ ssh-keygen -t rsa
Add Key When Creating Droplet
$ ssh root@doserver
$ ssh-add ~/.ssh/id_rsa_do
(or whatever name you used)
$ ssh root@doserver
$ sudo apt update
$ sudo apt upgrade
$ adduser brad
$ id brad
$ usermod -aG sudo brad
$ id brad
> ssh brad@doserver
$ ssh root@doserver
$ cd /home/brad
$ mkdir .ssh
$ cd .ssh
$ touch authorized_keys
> sudo nano authorized_keys
(paste in the id_rsa_do.pub key, exit and log in as brad)
$ sudo nano /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
$ sudo systemctl reload sshd
$ sudo chown -R brad:brad /home/brad
$ chmod 700 /home/brad/.ssh
$ sudo apt install apache2 -y
$ ssh-keygen -t rsa
(id_rsa_github or whatever you want)
$ ssh-add /home/brad/.ssh/id_rsa_github
```$ eval `ssh-agent -s````
$ git clone git@github.com:bradtraversy/react_otka_auth.git
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ npm install
$ npm start
$ npm run build
$ sudo mv -v /home/brad/react_otka_auth/build/* /var/www/html