Here we simply copy a previously existed ssh keys from another system, instead of doing all the ssh stuff!!
# change ownership of folder and contents
sudo chown nabily4e_suse:users .ssh/ .ssh/* .gitconfig
# change .ssh/ .ssh/* permissions
# change to the .ssh folder
~/.ssh/
sudo chmod 644 id_rsa.pub
sudo chmod 600 id_rsa
sudo chmod 644 known_hosts
# change out to set the folder permissions
../
sudo chmod 700 .ssh/
# authenticate with GitHub
ssh -T [email protected]The preivous block is a series of commands that can be used to set up SSH keys for GitHub on openSUSE, a Linux distribution. SSH keys are a way of authenticating with GitHub without using a password. Here is a brief explanation of what each command does:
sudo chown nabily4e_suse:users .ssh/ .ssh/* .gitconfig: This command changes the ownership of the.sshfolder, its contents, and the.gitconfigfile to the usernabily4e_suseand the groupusers. This is done to ensure that only the usernabily4e_susecan access and modify these files, which contain sensitive information such as the private SSH key and the GitHub configuration.sudo chmod 644 id_rsa.pub: This command changes the permissions of the fileid_rsa.pub, which is the public SSH key, to644. This means that the owner (nabily4e_suse) can read and write the file, while the group (users) and others can only read the file. This is done to prevent unauthorized modification of the public key, which is used to verify the identity of the usernabily4e_susewhen connecting to GitHub.sudo chmod 600 id_rsa: This command changes the permissions of the fileid_rsa, which is the private SSH key, to600. This means that only the owner (nabily4e_suse) can read and write the file, while the group (users) and others have no access to the file. This is done to protect the private key, which is used to encrypt and decrypt the communication with GitHub, from being stolen or compromised by anyone else.sudo chmod 644 known_hosts: This command changes the permissions of the fileknown_hosts, which is a file that stores the fingerprints of the hosts that the usernabily4e_susehas connected to via SSH. This file is used to prevent man-in-the-middle attacks, where a malicious third party tries to impersonate a legitimate host. The permissions are set to644to allow the owner (nabily4e_suse) to read and write the file, while the group (users) and others can only read the file.sudo chmod 700 .ssh/: This command changes the permissions of the.sshfolder to700. This means that only the owner (nabily4e_suse) can read, write, and execute files in the folder, while the group (users) and others have no access to the folder. This is done to prevent anyone else from accessing the files in the.sshfolder, which contain the SSH keys and other SSH-related configuration.ssh -T [email protected]: This command tests the SSH connection to GitHub by using the SSH key pair that was set up. The-Toption tells SSH not to request a shell on the remote host, but just to verify that the authentication works. If the connection is successful, the usernabily4e_susewill see a message from GitHub welcoming them and confirming their username.
from: https://nabily4e_susespence.com/posts/using-opensuse-for-webdev#add-ssh-keys