Skip to main content

Solution to copy files from Linux client to Linux Server

  1. Check if sshd is running on your server using: ps aux | grep sshd

  2. If not install OpenSSH using sudo apt-get install openssh-server openssh-client https://www.tecmint.com/install-openssh-server-in-linux/

  3. Restart your server and verify that sshd is running using ps aux | grep sshd

  4. If you need you can configure your /etc/ssh/sshd_config file, but its not necessary for simple configurations

  5. verify that the ports are open using netcat nc -v -z 127.0.0.1 22

  6. To copy files from a Linux client to a Linux client use scp as follows scp ~/filename.md [email protected]:~/folder/filename.md

  7. To verify that file has been copied use ssh [email protected] and provide your password.

Solution to copy files from Linux client to `Windows

  1. There are multiple clients for running SSH servers on Windows such as:

    OpenSSH from MS

    MobaSSH

    Bitvise SSH server

  2. Install one of the above servers and make sure that port 22 is open using

    netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=UDP localport=22 netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=UDP localport=22 
    netsh advfirewall firewall add rule name="SSH Port 22" dir=in action=allow protocol=TCP localport=22 netsh advfirewall firewall add rule name="SSH Port 22" dir=out action=allow protocol=TCP localport=22 
    netsh advfirewall set allprofiles state off 
  3. Comparisons of these servers:

    Bitvise SSH server

    1. Provides almost close to native cmd prompt, powershell prompt, autocompletion

    2. Provides additional capabilities for customization, if you need advanced usage

    3. User customization for simple needs is 0. I got started on it within 2 mins, after having spent a lot of time trying to get MobaSSH and OpenSSH to work.

    4. To copy files using scp use: scp ~/filename.md [email protected]:/C/Users/username/filename.md

    5. Free for personal use, $99 for professional use. Because of so many features and great integration, the price is well worth the money

    MobaSSH:

    1. provides a linux shell on windows where simple linux commands such as ls, cp, find etc work, similar to MINGW64

    2. you can access cmd and powershell directly by typing cmd or powershell

    3. Unicode support is poor. Encoding is not correct. For example if you try to start Python interpretor, it will crash. You will need to change the encoding manually using (https://stackoverflow.com/a/12834315/4752883): chcp 65001 set PYTHONIOENCONDING=utf-8 and then startup Python prompt

    4. The great thing about MobaSSH is that it has a very simple user-interface, and scp and ssh and integrated well. So will work for simple use cases

    5. To copy files from a Linux client to a Windows server running MobaSSH: use scp ~/filename.md [email protected]:/cygdrive/c/Users/username/filename.md This is because MobaSSH is based on cygwin and its drives are mapped to the same way cygwin-s drives are mapped.

    Use VMs from Microsoft with OpenSSHv6.7 installed from https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/, OpenSSHv6.7 is already installed.

    1. Its very buggy, and you will need to heavily customize it.

    2. Command completion doesnt work

    3. It will leave blank spaces when you are moving cursor on the terminal

    4. Python doesn't work

    5. Later versions of OpenSSH, may have improved on it. Further MS seems to make OpenSSH available via Optional Features https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

alpha_989
  • 453
  • 5
  • 8