Archive for July 2013

We would like to outline a list of techniques and commands by which one can easily transfer files securely over the network between PCs connected on the same network. This need came out of our experiments to find the fastest method to transfer files between linux and windows via the Network.
Let us first clearly define some of the terms that would govern this  post:
HostPC - The local PC from which the transfers would be made
RemotetPC
- This is a PC connected on the same network as the HostPC, to which the transfer needs to be made.
RemoteUser - This is the username used to log in into the remote PC

First lets prepare the PCs:

For Windows PC:
    Install the Putty Software from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

For Linux PC:
    Install the SSH server (Comes along with SFTP as well as SCP)
    We are trying it out on Ubuntu 13.04 so the command would be
    sudo apt-get install ssh


File Transfers

Now lets look at cases of the transfer.
There can be two types of transfers:
    1. Single file Transfer
    2. Directory Transfer
We would be looking at commands to do both. This would require the RemotePC  logon information and its IP address to be available.

Important point to note here is due to limitation on Windows side transfers can be only initiated from the Windows machine to a Linux machine. The vise versa is not possible. There are software to circumvent this limitation, however that would be discussed some other time.
Also the file or directroy Path used in the 'psftp', 'pscp', 'scp' and 'sftp' commands is a linux style path.

Here is a list of Use cases in terms of the type of OS on the PCs and transfers:

Between HostPC windows and RemotePC Linux

Using SCP technique (Slow)

From HostPC windows to RemotePC Linux
For Single File Transfer
cd {filepath}
pscp {filename} {RemoteUser}@{RemotePC IP}:{Remote PC path for the HostPC file}

For Directory File Transfer
cd {directorypath}
pscp -r {dirname} {RemoteUser}@{RemotePC IP}:{RemotePC path for HostPC directory}


Using SCP technique (Slow)

From RemotePC Linux to HostPC Windows

For Single File Transfer
cd {HostPC path for RemotePC file}
pscp {RemoteUser}@{RemotePC IP}:{Remote PC  file} .


For Directory File Transfer
cd  {HostPC path for RemotePC directory}
pscp -r {RemoteUser}@{RemotePC IP}:{Remote PC  directory} .



Using SFTP technique(Fast)

From HostPC windows to RemotePC Linux

For Single File Transfer
cd {filepath on HostPC}
psftp {RemoteUser}@{RemotePC IP}

Now in the 'psftp prompt' use the following set of commands:
cd {Path on Remote PC for the HostPC file}
put {file name}

Here {filename} is the HostPC file that needs to be copied

For Directory File Transfer
cd {path of the directory in HostPC}
psftp {RemoteUser}@{RemotePC IP}

Now in the 'psftp prompt' use the following set of commands:
cd {Path on Remote PC for the HostPC directory}
mkdir {dirname}
put -r {dirname}

Here the {dirname} is the directory on the HostPC that needs to be copied

Using SFTP technique(Fast)

From RemotePC Linux to HostPC Windows

For Single File Transfer
cd {HostPC path for RemotePC file}
psftp {RemoteUser}@{RemotePC IP}

Now in the 'psftp prompt' use the following set of commands:
cd {Path to Remote PC file}
get {file name}

Here {filename} is the RemotePC file that needs to be copied

For Directory File Transfer
cd {HostPC path for RemotePC directory}
psftp {RemoteUser}@{RemotePC IP}

Now in the 'psftp prompt' use the following set of commands:
cd {Path to Remote PC directory}
lmkdir {dirname}
get -r {dirname}

Here the {dirname} is the directory on the RemotePC that needs to be copied

Between HostPC Linux and RemotePC Linux

SCP technique (Slow)

From HostPC linux to RemotePC Linux

For Single File Transfer
scp {filename+path} {RemoteUser}@{RemotePC IP}:{Path on Remote PC for the HostPC file}

For Directory File Transfer
scp -r {dirname+path} {RemoteUser}@{RemotePC IP}:{Path on Remote PC for the HostPC directory}

SCP technique (Slow)

From RemotePC Linux to HostPC Linux

For Single File Transfer
scp {RemoteUser}@{RemotePC IP}:{Remote PC  file} {HostPC path for RemotePC file}

For Directory File Transfer
scp -r {RemoteUser}@{RemotePC IP}:{Remote PC  directory} {HostPC path for RemotePC directory}

SFTP technique(Fast)

From HostPC Linux to RemotePC Linux

For Single File Transfer
sftp {RemoteUser}@{RemotePC IP}
Now in the 'sftp prompt' use the following set of commands:
cd {Path on Remote PC for the HostPC file}
put {filepath on HostPC}


For Directory File Transfer
cd {path of the directroy HostPC}
sftp {RemoteUser}@{RemotePC IP}

Now in the 'sftp prompt' use the following set of commands:
cd {Path on Remote PC for the HostPC directory}
mkdir {dirname}
put -r {dirname}

Here the {dirname} is the directory on the HostPC that needs to be copied

SFTP technique(Fast)

From RemotePC Linux to HostPC Linux

For Single File Transfer
sftp {RemoteUser}@{RemotePC IP}
Now in the 'sftp prompt' use the following set of commands:
lcd {HostPC path for RemotePC file}
get {Path to Remote PC file name}


For Directory File Transfer
sftp {RemoteUser}@{RemotePC IP}
Now in the 'sftp prompt' use the following set of commands:
lcd {HostPC path for RemotePC directory}
lmkdir {dirname}
get -r {Path to Remote PC directory}

Here the {dirname} is the directory on the RemotePC that needs to be copied

These techniques are also valid for PC connected over the internet, provided your ISP allow SCP&SFTP and one is aware of the IP address the PC is connected to.

Welcome to Boseji's Blog

Popular Post

Blogger templates

Welcome

Creation by Electronics Hobbyists from Bharat(India) to encourage & help people. This blog hosts the numerous innovations, discoveries and projects we provide.
Our Research Wing Adhar Labs
Contact Form | Email Address
We Support Open Source Hardware Definition v1.0
Creative Commons License
All works on this blog are licensed under a
Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at forbharat.wordpress.com and m8051.blogspot.com.

Permissions beyond the scope of this license may be available at http://forbharat.wordpress.com/permissions/.
Thank you for all your support.

© A.D.H.A.R Labs Research 2008-2013 . Powered by Blogger.

Follow by Email

Followers

PCB Unit Converter

mils
mm

- Copyright © Electronics for Bharat -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -