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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?
cranium2003Author Commented:
i have both pcs with redhat 9 with both root passwords.
how can i setup NFS please give me steps
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
> 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.
# scp <files> PC2:/<path2>
# scp <files> PC1:/<path1>

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.