$ ssh [email protected]
ssh -i "react-counter-app.pem" [email protected]
$ logout
$ mkdir test
$ cd test
$ touch hello.txt
$ sudo apt-get install apache2
$ ssh-keygen
> cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys
$ touch test.txt
$ scp ~/test.txt [email protected]:~
scp -i id_rsa_socket2 app.js [email protected]:/root/DashSocket
scp -i id_rsa_socket2 [email protected]:/root/DashSocket/app.js ./
scp -r [email protected]:/root/dist ./localPCFolder
Becareful with nested
node_modules
folder
nohup node app.js & exit
You have to kill the process on next SSH login by
pkill -f node
, (you can use other ways)
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
-
Set the following
PermitRootLogin no
PasswordAuthentication no
-
Reload sshd service
$ sudo systemctl reload sshd
-
Create password for root
sudo su passwd root nano /etc/ssh/sshd_config
-
Edit the ssh_config file with
PermitRootLogin yes PasswordAuthentication yes #PasswordAuthentication no
-
Restart sshd configuration file
service sshd restart
$ 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 [email protected]: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
- Some part of this sheet goes along with this SSH YouTube tutorial