• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 994
  • Last Modified:

how can i secure file copy from pc to pc

Is it possible to use ftp to transfer a file from pc1 to pc2 with fix source location on pc1 and fix loaction on pc2 where it is to be copied/overwritten using any shell script or C program?
can scp is used for same purpose? how can i use that command in C program?
one more thing how a socket program can help in my condition?
0
cranium2003
Asked:
cranium2003
  • 2
1 Solution
 
PaulS_IIICommented:
I will assume you are using some flavor of Unix/Linux. If so, do you have admin (root) priviledges on both machines? Or possible know someone who does?

The easiest way to do this, assuming you have control over both machines, whould be to setup an NFS share between the 2 pc's and use a cp in a shell script to copy your file to the mounted filesystem of the other PC.

However, if you don't have control of the second pc then it might get a bit trickier.

Can you provide some more detail as to your situation?
0
 
cranium2003Author Commented:
i have both pcs with redhat 9 with both root passwords.
how can i setup NFS please give me steps
0
 
PaulS_IIICommented:
OK we will call the pc you want to copy to client_pc and the pc you want to copy from host_pc.

Here we go,

log in as root user on client_pc.
cd into the /etc directory
open the file named exports in some editor (I use vi so vi exports)
add a line that looks like this:
/path/and/name/of/directory/to/export   IP address to host_pc(rw,insecure,no_root_squash,sync)

side bar, this line takes a bit of explaining the /path/and/name/of/directory/to/export is the full path to either the exact directory you want to make available or to one of its parents. The IP address to host_pc is just that, unless of course your host_pc has a fully qualified domain name, then you can use that.

save and close the exports file
back at the command prompt issue this command: exportfs -ra This will clear all exported files systems and then re-export everything in the exports file.

Now that takes care of the client_pc. Now go ahead and log out of the client_pc

Turning our attention to the host_pc log in as root

Now this is what I like to do because I then have one place for all my mounted file systems
somewhere on the root file system there should be a directory named mnt (cd / then ls -l and look for a directory named mnt)
If there is one the cd /mnt otherwise make one (mkdir /mnt then cd /mnt)
Inside the mnt directory I like to make a directory named after the client_pc I am going to mount so mkdir /client_pc

at this point you can now mount the remote file system mount client_pc:/path/and/name/of/directory/exported

The /path/and/name/of/directory/exported is exactly as you specified it in the exports file on the client_pc.

Assuming everything went ok (no errors) the remote file system is now mounted and you now have access to it.

Now you simple cp /some/file/name /to/the/mounted/file/system

And away you go
0
 
wesly_chenCommented:
> can scp is used for same purpose?
> i have both pcs with redhat 9 with both root passwords.
Yes, scp serves well for your purpose.
PC1:
# scp <files> PC2:/<path2>
PC2:
# scp <files> PC1:/<path1>

Wesly
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now