How to use ssh and scp in Windows
84 words
One minute
| Windows Server 2019
Run Powershell as an administator and generate private and public keys
1
|
ssh-keygen -trsa -b2048
|
Check that files exists
1
|
ls $env:USERPROFILE\.ssh
|
Add public key
1
|
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh root@192.168.131.10 "cat >> .ssh/authorized_keys"
|
Check connect without password
1
|
ssh root@192.168.131.10
|
Check that commands are runned
1
|
ssh root@192.168.131.10 "cat /etc/*release"
|
Put the file into /tmp
1
|
scp "$env:USERPROFILE\.ssh\id_rsa.pub" "root@192.168.131.10:/tmp/"
|
Put several files into /tmp
1
2
3
|
scp -r "C:\tmp" "root@192.168.131.10:/tmp/123"
ssh root@192.168.131.10 "ls /tmp/123/tmp"
scp -r "root@192.168.131.10:/tmp/" "C:\tmp"
|