Skip to content

Instantly share code, notes, and snippets.

@hassan00dev
Last active September 2, 2021 08:05
Show Gist options
  • Select an option

  • Save hassan00dev/ef09b414569947a5f0e9081d3a8538ba to your computer and use it in GitHub Desktop.

Select an option

Save hassan00dev/ef09b414569947a5f0e9081d3a8538ba to your computer and use it in GitHub Desktop.
use putty(not encrypted) or ssh(secure because encrypted)
// control linux server with remote terminal
// for linux
sudo apt update // apt is package manager
sudo apt upgrade
sudo apt install apache2 -y
// ssh setting
ssh root@domain.com
ssh root@domain.com -p22 -i privateKey
ssh-keygen
ssh-keygen -o
eval $(ssh-agent -s) // run agent
ssh-add /.ssh/id_rsa_do // add other private key
cat ~/.ssh/id_rsa_do.pub // show public key
touch /home/root/.ssh/authorized_keys
sudo nano authorized_keys // open in terminal editor paste public key and press Ctrl+X
// add user
adduser hassan
usermod -aG sudo hassan
//when this error occur
// could not open a connection to your authentication agent.
eval `ssh-agent -s`
// checking ssh connection
ssh -T git@github.com
// other useful commands
ls // show all directories
ls -la // show all directories with user permissions
// setup for github
git remote set-url origin git@github.com:<Username>/<Project>.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment