Criar e usar chaves SSH no Windows para acessar Ubuntu Server
Enviado: 16 Out 2025, 17:53
- Windows com PowerShell, Git Bash ou WSL
- Acesso ao servidor Ubuntu via SSH
- Usu谩rio criado no Ubuntu (ex: )
C贸digo: Selecionar todos
helios
C贸digo: Selecionar todos
ssh-keygen -t rsa -b 4096 -f $env:USERPROFILE.ssh\id_rsa_VPS_2025-10-16 -C "Chave SSH para VPS"
C贸digo: Selecionar todos
type $env:USERPROFILE.ssh\id_rsa_VPS_2025-10-16.pub | ssh helios@192.168.91.130 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh"
C贸digo: Selecionar todos
ssh -i $env:USERPROFILE.ssh\id_rsa_VPS_2025-10-16 helios@192.168.91.130
Crie ou edite o arquivo de configura莽茫o:
C贸digo: Selecionar todos
notepad $env:USERPROFILE.ssh\config
C贸digo: Selecionar todos
Host 192.168.91.130
User helios
IdentityFile ~/.ssh/id_rsa_VPS_2025-10-16
C贸digo: Selecionar todos
ssh helios@192.168.91.130
No Ubuntu, edite o arquivo:
C贸digo: Selecionar todos
sudo nano /etc/ssh/sshd_config
C贸digo: Selecionar todos
PermitRootLogin no
PermitEmptyPasswords no
PasswordAuthentication no
ChallengeResponseAuthentication no
AuthenticationMethods publickey
PubkeyAuthentication yes
C贸digo: Selecionar todos
sudo systemctl restart ssh