WSL: ssh localhost Permission denied (publickey)
If you're running Ubuntu on Windows Subsystem for Linux, there will not be a preinstalled public key or authorized keys list, so you'll need to generate your own.
If you don't already have openssh-server installed:
sudo apt-get upgradesudo apt-get updatesudo apt-get install openssh-serversudo service ssh start
Then take the following steps to enable sshing to localhost:
cd ~/.sshssh-keygento generate a public/private rsa key pair; use the default optionscat id_rsa.pub >> authorized_keysto append the key to the authorized_keys filechmod 640 authorized_keysto set restricted permissionssudo service ssh restartto pickup recent changesssh localhost

浙公网安备 33010602011771号