Sunday, July 09, 2023
SSH private key authentication with WinSCP and PuTTY Gen
Simplify your login process by using SSH keys for authentication when you are connecting to your server.
1st step is to run the PuTTYGen software and generate a key.
Next, login into you server through SSH and create "~/.ssh" directory if it doesn't exists.
chmod the directory to 700.
[applmgr@vm-centos7 ~]$ cd ~ [applmgr@vm-centos7 ~]$ mkdir -p .ssh [applmgr@vm-centos7 ~]$ chmod 700 .ssh [applmgr@vm-centos7 ~]$ ls -al total 12 drwx------. 6 applmgr applmgr 119 Jul 9 20:27 . drwxr-xr-x. 4 root root 36 Jul 9 20:05 .. -rw-r--r--. 1 applmgr applmgr 18 Oct 31 2018 .bash_logout -rw-r--r--. 1 applmgr applmgr 193 Oct 31 2018 .bash_profile -rw-r--r--. 1 applmgr applmgr 231 Oct 31 2018 .bashrc drwxrwxr-x. 3 applmgr applmgr 18 Jul 9 20:06 .cache drwxrwxr-x. 3 applmgr applmgr 18 Jul 9 20:06 .config drwxr-xr-x. 4 applmgr applmgr 39 Jul 4 19:01 .mozilla drwx------. 2 applmgr applmgr 6 Jul 9 20:27 .ssh
Create "authorized_keys" if it doesn't exists.
chmod it to 600 and edit the file, in my example, using "vi"
[applmgr@vm-centos7 ~]$ cd .ssh/ [applmgr@vm-centos7 .ssh]$ touch authorized_keys [applmgr@vm-centos7 .ssh]$ chmod 600 authorized_keys [applmgr@vm-centos7 .ssh]$ vi authorized_keys
Copy and paste (or add new line) the content of the public key into this file.
Under "SSH" > "Authentication", check the "Allow agent forwarding", and select the privates key file that you've saved just now.
Subscribe to:
Posts
(
Atom
)