3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

Inhaltsverzeichnis

Step 1: Create public and private keys using ssh-key-gen on local-host

On your local machine you need to create ONCE the ssh key-pair:

ssh-keygen -o -t rsa -C "herwart@wermescher.com" -b 4096 -N '' -f $HOME/.ssh/id_rsa

Copy the public key to remote-host using ssh-copy-id

ssh-copy-id -i ~/.ssh/id_rsa.pub RemoteHost

you need to enter the password of the remote host once.

Login to remote-host without entering the password

ssh remote-host

Done!

Fix offending key in local store

change the linenumber resp. the ip address before applying the command below

remove 10th line:

sed -i '10d' ~/.ssh/known_hosts

GIT key

If you already have ssh key on your machine then type the following command to retrieve the public key:

cat ~/.ssh/id_rsa.pub

Otherwise type:

ssh-keygen -o -t rsa -C "herwart@wermescher.com" -b 4096

Enter passphrase and store it in the keypass file.!

Now type:

cat ~/.ssh/id_rsa.pub

On Gitlab

Go to GitLab pages and navigate to the ‘SSH Keys’ tab in your ‘Profile Settings’. Paste your key in the ‘Key’ section

https://gitlab.com/profile/keys

and give it a relevant ‘Title’. Use an identifiable title like ‘Work Laptop – Windows 7’ or ‘Home MacBook Pro 15’.

If you manually copied your public SSH key make sure you copied the entire key starting with ssh-rsa and ending with your email.

On GitHub

Click on your profile picture (top right) and select “Settings”.
On the Menu on the left side you see „SSH and GPG keys.
You can store your public key there.

On GitLab

Click on your avatar picture (top left) and select “Edit Profile”.
On the Menu on the left side you see „SSH Keys“
You can store your public key there.

When you click on add you need to get the key from your server by use:

cat ./.ssh/id_rsa.pub

Usage type: Authentication

rsync

copy from server

rsync ???

Teilen:
Weitere Posts
ChatGPT für CISOs

Eingangsstatement ChatGPT kann erfahrene ISMS-Berater nicht ersetzen, aber es bietet eine wertvolle Unterstützung bei schnellen Recherchen, der Dokumentenerstellung und konkreten Fragestellungen. So können Berater sich

Sende uns eine Nachricht