Skip to main content

Linux command: ssh-keygen - Generate SSH Keys

ssh-keygen -t rsa -C

ssh-keygen — authentication key generation, management and conversion

$ ssh-keygen -t rsa -C "your@email.address"

Private and public keys are save in ~/.ssh/ directory.

$ ls ~/.ssh
authorized_keys  id_rsa  id_rsa.pub  known_hosts

Using ssh key on Microsoft Windows 10

Copy private key id_rsa to %userprofile%\.ssh folder. However, you will get warning and cannot use that private key unless you limit permission to the owner ONLY.

C:\Users\Tuyen>ssh tuyendq@002.practicehabits.net
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'C:\\Users\\Tuyen/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "C:\\Users\\Tuyen/.ssh/id_rsa": bad permissions
tuyendq@002.practicehabits.net's password:

Using icacls to limit permission to access id_rsa key file

:: Set key variable as full path the the private key id_rsa file ::
set key="%userprofile%\.ssh\id_rsa"

:: Remove default inheritance ::
cmd /c icacls %key% /c /t /inheritance:d

:: Set ownership to the owner ::
cmd /c icacls %key% /c /t /grant %username%:F

:: Remove All users, except the owner ::
cmd /c icacls %key% /c /t /remove Administrator Administrators SYSTEM "Authenticated Users" "Users"

:: Then verify settings ::
cmd /c icacls %key%
:: End of script

Remove passphrase, you must have your old passphrase

openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_new

Popular posts from this blog

Microsoft Windows Server 2012 R2 Standard Evaluation Product Key

Microsoft Windows Server 2012 R2 Standard Evaluation D2N9P-3P6X9-2R39C-7RTCD-MDVJX DBGBW-NPF86-BJVTX-K3WKJ-MTB6V

Statistics and Probability: Free Online Courses

"I keep saying the sexy job in the next ten years will be statisticians. People think I’m joking, but who would’ve guessed that computer engineers would’ve been the sexy job of the 1990s?" — Hal Varian , The McKinsey Quarterly, January 2009

VMware vSphere Hypervisor Free Version

Bare in mind that VMware vSphere Hypervisor Free Version comes with limitations Maximum 2 physical CPUs Maximum 8 vCPU per VM Cannot add to vCenter when using free license key. VMware vSphere Hypervisor Free Version supports unlimited cores per CPU and unlimited physical memory . Where to download VMware vSphere Hypervisor Free Version VMware: VMware vSphere Hypervisor (64 bit) VMware vSphere Hypervisor 8.0 (11 October 2022): https://customerconnect.vmware.com/en/evalcenter?p=free-esxi8 VMware vSphere Hypervisor 6.x: https://my.vmware.com/en/group/vmware/evalcenter?p=free-esxi6