This sheet goes along with this SSH YouTube tutorial
$ ssh [email protected]
$ mkdir test
$ cd test
$ touch hello.txt
$ sudo apt-get install apache2
$ ssh-keygen
or
ssh-keygen -t rsa
to copy the new key use:
pbcopy < ~/.ssh/id_rsa.pub
> 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]:~
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 [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
$ ssh-agent bash -c 'ssh-add /somewhere/yourkey; git clone [email protected]:user/project.git'
You will need an ssh client, since it appears you on using windows you can use http://cygwin.com/ and it will come with one, I don't know about a portable version of ssh, though.
How to add the passphrase of an specific ssh key and stop getting the error with VSCode requering the public key
First add the passpharse to your keychain
ssh-add -K ~/.ssh/id_rsa
Where id_rsa
is the name of the ssh key, change this value to whatever name you use.
Then edit the ssh config file
code ~/.ssh/config
Paste this to it:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Where again id_rsa
is the name of the ssh key you want to add to the verification.
Refences: