-
Notifications
You must be signed in to change notification settings - Fork 0
15_SSH
Davood Dorostkar edited this page Dec 23, 2023
·
5 revisions
when you make a key, you will have a private key (without extension) and a public key (*.pub). you need to give your public key to the host system to enable ssh connection. your public key will be stored in ~/.ssh/authorized_keys
in the host system. whenever you make a connection, the host's public key will be also stored in ~/.ssh/known_hosts
for future to prevent man-in-the-middle.
ssh-keygen -t <algorithm>
ssh-keygen -t <algorithm> -f <path>
make key with custom comment; comment is by default like davood@davood-pc
:
ssh-keygen -C
change existing key comment:
ssh-keygen -c
in debian: ~/.ssh/
in windows: /c/Users/<USER>/.ssh/
this will add your public key to ~/.ssh/authorized_keys
in the host system.
ssh-copy-id -i <path_to_pub_key> <user>@<IP_address>
be default login to root with password is disabled in many cases for security. (even if you have set a password for it). to enable it:
- set a password:
passwd
- enable password authentication in
/etc/ssh/sshd_config
:
PasswordAuthentication yes
- enable root login:
PermitRootLogin yes
- restart ssh service:
service ssh restart