initial commit

This commit is contained in:
2021-09-09 10:30:45 +02:00
3 changed files with 157 additions and 1 deletions

View File

@@ -18,3 +18,62 @@ Default generally is `~/.ssh/id_rsa`, you can omit `-f "/opt/.certs/service"` if
ssh-keygen -t rsa -b 4096 -f "/opt/.certs/service" -C "Private Key Comment"
```
Key should be created along also with .pub key
```
eval $(ssh-agent -s)
ssh-add /opt/.certs/service
ssh-copy-id -i /opt/.certs/service USERNAME@IP -p PORT
```
Login one last time using your old username and password and remember to disable them or remove them.
<br>
After that you can login into the host with:
```
ssh -i /opt/.certs/service -p PORT USERNAME@IP
```
<br>
Or you can go little further and create file:
```
sudo nano /etc/ssh/ssh_config.d/myssh.conf
```
<br>
With:
```
Host 192.168.1.*
AddKeysToAgent yes
IdentityFile /opt/.certs/service
Port 22
Host service.local 192.168.1.2
User USERNAME
HostName 192.168.1.2
### Github.com
# don't forget to add the .pub key into your profile
Host github.com
User git
Hostname github.com
AddKeysToAgent yes
IdentityFile /opt/.certs/github
### Gitea
# don't forget to add the .pub key into your profile
Host gitea.com
User git
Hostname gitea.com
AddKeysToAgent yes
IdentityFile /opt/.certs/gitea
### Gitlab
# don't forget to add the .pub key into your profile
Host gitlab.com
User git
Hostname gitlab.com
AddKeysToAgent yes
IdentityFile /opt/.certs/gitlab
```
Now you should be able to connect using `ssh service` or ssh git clone your repos from respective git repository
Test if it's working with: ```ssh -T git@github.com```