Skip to content

Instantly share code, notes, and snippets.

@matheuseduardo
Created May 9, 2025 18:25
Show Gist options
  • Save matheuseduardo/4b384c927b9395ee921bcc6688802dbf to your computer and use it in GitHub Desktop.
Save matheuseduardo/4b384c927b9395ee921bcc6688802dbf to your computer and use it in GitHub Desktop.
use same ssh keys between windows user and wsl user
# source: https://superuser.com/a/1676775/91564
# - só devem ser executados após alterar o mount no /etc/wsl.conf
# - e reiniciar o Ubuntu
# (wsl --terminate Ubuntu; wsl --list --verbose)
# checar se terminou e iniciar
cd ~ # ir até pasta do usuário
mv .ssh .ssh_orig # fazer backup do conteúdo atual
ln -s /mnt/c/Users/<user>/.ssh/ .ssh # criar um link da pasta do usuário atual do windows dentro do WSL
chmod 700 .ssh
chmod 600 .ssh/id_rsassh list
chmod 644 .ssh/id_rsa.pub
sudo services ssh reload
sudo services ssh restart
# /etc/wsl.conf
# adicionar:
[automount]
options = "metadata,umask=022,fmask=111"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment