how can i secure file copy from pc to pc

Posted on 2004-11-16
Last Modified: 2008-01-09
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?
Question by:cranium2003
    LVL 2

    Expert Comment

    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?

    Author Comment

    i have both pcs with redhat 9 with both root passwords.
    how can i setup NFS please give me steps
    LVL 2

    Accepted Solution

    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
    LVL 38

    Expert Comment

    > 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>


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now