Windows 10 SSH

Keepalive

in C:\Users\yourusername\.ssh make a newfile named config, and add lines below:

Host *
    ServerAliveInterval 40

CMD-file with connect options

ssh -p <SSH port> <user_name>@<server_IP>
pause

Auth with keys

1) edit sshd_config on server
sudo mc /etc/ssh/sshd_config

PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys  .ssh/authorized_keys
2) Gen keys on client

ssh-keygen -t rsa -b 2048 -C "Key for <your name>"

id_rsa.pub - server public key

id_rsa - user private key

3) Copy *pub key to server

~/.ssh/authorized_keys

4) restart sshd service

sudo service sshd restart

[BONUS] SSH port forwarding

ssh -R 4040:localhost:4040 (ssh-user)@(ssh-server-ip) -p (ssh-server-port) -t '(command, e.g htop)'

See also

KeepAlive SO
Key auth Debian 9
Наглядное руководство по SSH-туннелям: https://habr.com/en/company/flant/blog/691388/


Создано: 18/03/2022 08:46, Изменено: 13/12/2022 13:56, Просмотров: 39
Назад