| Windows 11 | Linux (Debian) | |
|---|---|---|
| Install SSH Client | # # Install ssh client on Windows machine: # open "Start" menu, # search & open "optional features" and click "View features"; # select "OpenSSH Client", click "Next" and "Install"; # # Use ssh client on Windows machine: # execute commands in terminal on client Windows machine # use ssh where ssh ssh robert@192.168.0.108 |
# # ssh already installed on Linux Server machine: # ssh client is automatically installed on Debian; # # Open terminal on Linux client machine ssh roberLocal@192.168.0.108 |
| Install SSH Server | # # Install ssh server on Windows machine: # open "Start" menu, # select "Settings > Apps > Optional features" and click "View features"; # click "Add an optional feature", enter "openssh", # select "OpenSSH Server", click "Next" and "Install"; # wait until "OpenSSH Server" is installed; # open "Start" menu, # select "Computer Management" and open "Services and Applications"; # select "Services", find "OpenSSH SSH Server" & "OpenSSH Authentication Agent", and double-click to open properties; # change "Startup type" to "Automatic", click "Start", and click "OK" for both services; # execute the following commands in Command Prompt: ipconfig whoami net user rober netstat -an | find "22" # # Create a local user on Windows, to access OpenSSH server on Windows 11 machine: # execute the following commands as Administrator in Command Prompt: net user roberLocal XYZ /add # # Use ssh client on Linux machine: # ssh client is automatically installed on Debian; # Execute the following commands in bash terminal: ssh roberLocal@192.168.0.142 |
# # Install ssh server on Linux machine: # execute commands in terminal on server Linux machine ssh sudo apt install openssh-server -y sudo systemctl status ssh sudo systemctl enable ssh sudo systemctl start ssh sudo systemctl status ssh nano /etc/ssh/sshd_config # ... add line: PermitRootLogin yes service sshd restart ip a |
| Using SCP Client (via SSH connection) |
# # Use scp on Windows machine: # execute commands in terminal on client Windows machine scp /mnt/c/Data/testdata/testfile1.bin robert@192.168.0.108:/home/robert |
# # Use scp on Linux machine: # execute commands in bash terminal cd ls -al scp .bash* roberLocal@192.168.0.142:~/testdataWin |
| Using SFTP Client (via SSH connection) |
# # Use sftp on Windows machine: # execute commands in terminal on client Windows machine sftp robert@192.168.0.108 pwd cd testdata ls lpwd lcd /mnt/c/Data/ lls -al put -R testdata/* lls exit |
# Open GUI app "File Explorer", # type "sftp://roberLocal@192.168.0.142" in address bar, # and copy-and-paste between both machines --- OR --- # # Use sftp on Linux machine: # Execute the following commands in bash terminal: sftp roberLocal@192.168.0.142 pwd ls -al mkdir testdataWin cd testdataWin lpwd lcd .. lls -al put -R testdata/* ls -al rm testfile*.bin exit |
| Setup SSH Keys on Linux Server |
# # Create ssh client keys on Windows machine: # open "File Explorer" app, # type "%userprofile%" in address bar, # and check if subfolder ".ssh" exists with public and private keys; # execute commands in Command Prompt ssh-keygen -b 4096 # id_ed25519.pub and id_ed25519. are generated |
# # Create ssh server keys on Linux machine: # execute commands in terminal on client Windows machine scp C:\Users\rober.ssh\id_rsa.pub robert@192.168.0.108:~/.ssh/ ssh robert@192.168.0.108 cd .ssh ls -al cat id_ed25519.pub >> authorized_keys ls ~/.ssh chown robert:robert authorized_keys chmod 700 authorized_keys rm id_ed25519.pub ls ~/.ssh exit |
| Setup SSH Keys on Windows Server |
# # Prepare "ssh" folder on Windows Server machine: # open "File Explorer" app, # type "%programdata%" in address bar, and check if subfolder "ssh" exists; |
# # Prepare ".ssh" folder on Linux client machine: # Execute the following commands in bash terminal: ssh roberLocal@192.168.0.142 dir exit # # Generate ssh keys on Linux client machine: # Execute the following commands in bash terminal: cd .ssh ls -al ssh-keygen # id_ed25519.pub and id_ed25519. are generated ls -al # # Copy public ssh key to SSH Server on Windows machine: # (using ssh to administrator user "roberLocal" on Windows, # and ssh settings in "%programdata%/ssh" = "C:\ProgramData\ssh" folder) # Execute the following commands in bash terminal: scp id_ed25519.pub roberLocal@192.168.0.142:~ ssh roberLocal@192.168.0.142 move id_ed25519.pub %programdata%/ssh cd %programdata%/ssh type id_ed25519.pub >> administrators_authorized_keys icacls administrators_authorized_keys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F" exit # Open notepad as Administrator on Windows server machine, # open file "%programdata%/ssh/sshd_config", # uncomment line "#PubkeyAuthentication yes", # and change "#PasswordAuthentication yes" to "PasswordAuthentication no", # and click "Save"; # execute the following commands in Command Prompt as Administrator: net stop sshd net start sshd # # Verify ssh session is started without password prompt: # Execute the following commands in bash terminal on Linux client machine: ssh roberLocal@192.168.0.142 |
Setting key based authentication and disabling password authentication, is recommended.