SSH Practices

Scenario: A computer (windows or linux or mac, no matter) needs to connect B via ssh.

SSH service is required in B:

~> sudo apt install ssh -y

then at A:

C:\> ssh-keygen -t ed25519 -C “Computer A’s key”

Possible Output:
Enter file in which to save the key (/c/Users/User_Name/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase): _
Enter same passphrase again: _
Your identification has been saved in /c/Users/User_Name/.ssh/id_ed25519
Your public key has been saved in /c/Users/User_Name/.ssh/id_ed25519.pub
The key fingerprint is: _
SHA256:VXFsrOqXzdsI6zbjMblbIlcvqqLar9uWoE6Sw7NHzw4 User_Name@ComputerA
The key’s randomart image is:

Then copy the key id to the opposite side, machine B

~> ssh-copy-id -i ~/.ssh/id_ed25519 username@computer-B

Possible Output:
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/c/Users/User_Name/.ssh/id_ed25519.pub”
The authenticity of host ‘computer-B (192.168.1.41)’ can’t be established.
ED25519 key fingerprint is ed25519:u4gIVMfQfFXuSvmniQGVTgyg4LyB/uutOn77BNkKgSQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
username@computer-B’s password: _

Enter the password of the remote machine.

Possible Output:
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘username@computer-B'”
and check to make sure that only the key(s) you wanted were added.

After this output the last move is:

ssh ‘username@computer-B’

username@computer-B:~$

Bam! you are logged in without password request.

— ## How to add SSH Key in your git cloud manager 1. Make a key at your `~/.ssh` folder “$ ssh-keygen -t ed25519 -C “[email protected]”“ 1. Add the key to the SSH Agent, first check if added already “$ ssh-add -l“ “$ ssh-add ~/.ssh/filename_of_the_key“ 1. Add and verify your key at the settings page at git.gitpub.org (follow instructions there) 1. Setup your `~/.ssh/config` file by adding lines “` # git.disroot.org Host git.gitpub.org Hostname git.gitpub.org User your_username IdentityFile ~/.ssh/filename_of_the_key “`

Start the Discussion!Leave a Reply