SSH
Key
ssh-keygen -t rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
Your identification has been saved in id_rsa_1s2n.
Your public key has been saved in id_rsa_1s2n.pub.
The key fingerprint is:
ae:71:3a:16:22:91:78:7b:25:1e:5f:dd:60:fc:f2:28 dang@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| + |
| . . o + |
|. + o . . o o |
| . + = .S + |
| o + o.E . . |
| o ...o. |
| o= |
| .o. |
+-----------------+
ssh/config
Host gitserv remote.server.com
Hostname remote.server.com
IdentityFile ~/.ssh/id_rsa.github
IdentitiesOnly yes
# If you have a file named ~/.ssh/id_rsa that will get tried BEFORE your ~/.ssh/id_rsa.github without this option.
Host friendly-name
HostName long.and.cumbersome.server.name
IdentityFile ~/.ssh/private_ssh_file
User username-on-remote-machine
ssh-agent
ssh -T git@gitlab.tubit.tu-berlin.de -vvv
# this show some 3 keys were tried but not successful and password prompted.
ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-VBvlf1OVNNP5/agent.27629; export SSH_AUTH_SOCK;
SSH_AGENT_PID=27630; export SSH_AGENT_PID;
echo Agent pid 27630;
[dang@dai142 NetworkManagementPaper]$ ssh-add -l
Could not open a connection to your authentication agent.
ssh-agent bash
[dang@dai142 NetworkManagementPaper]$ ssh-add -l
The agent has no identities.
[dang@dai142 NetworkManagementPaper]$ ssh-add ~/.ssh/id_rsa-git_at_dai
Identity added: /home/dang/.ssh/id_rsa-git_at_dai (/home/dang/.ssh/id_rsa-git_at_dai)
ssh -T git@gitlab.tubit.tu-berlin.de
Welcome to GitLab, Xuan Thuy Dang!