SSH configuration
SSH
To configure SSH initially.
- In the command prompt, type the following:
ssh-keygen
-
By default, the system will save the keys to C:\Users\your_username/.ssh/id_rsa.
-
You’ll be asked to enter a passphrase. Hit Enter to skip this step.
-
The system will generate the key pair, and display the key fingerprint and a randomart image.
-
Open your file browser.
-
Navigate to C:\Users\your_username/.ssh.
-
You should see two files. The identification is saved in the id_rsa file and the public key is labeled id_rsa.pub. This is your SSH key pair.
Allow password login
SSH root login is disabled by default as a security feature
Open the /etc/ssh/sshd_config file with administrative privileges and change the following line:
nano /etc/ssh/sshd_config
FROM:
#PermitRootLogin prohibit-password
TO:
PermitRootLogin yes
Restart SSH service:
sudo systemctl restart ssh
Copy public key to server
The following command will copy the public key to the server.
ssh-copy-id user@remote-host
Now try to login with
ssh root@server
SSH config file
The config file helps to configure all the host details which facilitates the connection:
Here is a sample config:
Host targaryen
HostName 192.168.1.10
User daenerys
Port 7654
IdentityFile ~/.ssh/targaryen.key
Host tyrell
HostName 192.168.10.20
Host martell
HostName 192.168.10.50
Host *ell
user oberyn
Host * !martell
LogLevel INFO
Host *
User root
Compression yes
Having the config file saved in c:\users\username.ssh\config
You can ssh just by typing the hostname :
ssh targaryen