Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-17-2004, 12:10 PM
|
#1
|
|
Member
Registered: Nov 2004
Location: india
Distribution: Fedora core 1
Posts: 67
Rep:
|
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?
|
|
|
|
11-18-2004, 03:48 AM
|
#2
|
|
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990
Rep:
|
Yes (assuming there's a suitable network, and network services, between the two).
Yes. Like this:
Code:
system("scp user1@pc1:/path1/to1/file user2@pc2:/path2/to2/file");
You could use a socket program to send the file. Don't do that, as there are dozens of standards you could use, and you're more likely to make it less secure by using a custom program (fewer users => more bugs; security through obscurity doesn't work).
Last edited by rjlee; 11-18-2004 at 03:49 AM.
|
|
|
|
11-18-2004, 08:28 AM
|
#3
|
|
Member
Registered: May 2004
Location: At Keyboard
Distribution: Mandrake 10.0, SuSE 9.0
Posts: 114
Rep:
|
Code:
system("scp user1@pc1:/path1/to1/file user2@pc2:/path2/to2/file");
How is authentication handled in this situation?
|
|
|
|
11-18-2004, 11:59 PM
|
#4
|
|
Member
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107
Rep:
|
hi
scp authenticates by asking for the user2 password when you press enter to execute the command
to send a file from here to there, if here is pc1 & there is pc2
scp /path/to/file user@pc2:destination/path <enter>
you will be promted for user@pc2 password.
to get a file from there to here
scp user@pc2:source/path destination/path <enter>
so
scp silly.txt john@dadspc:.
will copy silly.txt from the pwd of the local pc and copy it in the home directory of john on the pc who's hostname is dadspc. dadspc can be replaced with the ip address. 192.168.1.3 etc.
scp john@dadspc:silly.txt .
will copy silly.txt from the home directory of john on dadspc and place it in the pwd directory of the local user. notice the period (.) this represents here (pwd) as in the folder/directory you are in when you issue the command.
all files are encrypted. sshd must be running on the remote machine for this to work.
hope this helps
regards
GT
|
|
|
|
11-19-2004, 03:47 AM
|
#5
|
|
Member
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223
Rep:
|
Hi globeTrotter,
i did as you said but i am getting followinf error in both cases you given after entering password for there pc
scp: /root/ppp: Permission denied
i check files ppp permissions and it is like
-rw-r--r-- 1 root root 251 Oct 26 11:06 ppp
|
|
|
|
11-19-2004, 03:49 AM
|
#6
|
|
Member
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223
Rep:
|
one more thing both pcs are running sshd i also check that on both pcs
does scp require login as root to execute it? i am doing as root also but fail to transfer file
|
|
|
|
11-19-2004, 04:25 AM
|
#7
|
|
Member
Registered: Oct 2003
Location: Oslo, Norway
Distribution: RedHat 9.0, Fedora Core 1/2/3, Debian 3.0, Smoothwall
Posts: 110
Rep:
|
Are you trying to copy the file to /root/ppp on the other machine?
Past the whole command you used here.
Last edited by atlesn; 11-19-2004 at 10:27 AM.
|
|
|
|
11-19-2004, 04:12 PM
|
#8
|
|
Member
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107
Rep:
|
hi
check in your /etc/ssh/sshd_config file for the following
PermitRootLogin no
if it's uncommented, as it should be for security, this then means root can not log in. also check for the comment in the /etc/ssh/ssh_config file. on my system i had to remove it from the ssh_config file for things to work.
sshd_config - is for the server side
ssh_config - is for client side
as a rule don't do anything as root. if you have root priviiliges on the other machine. it's safer to make a copy of files into a user directory and change owner & group. then scp as user. also make shure the sshd service is running on the remote system. obviously if the server is not running it can't serve!.
regards
GT
|
|
|
|
11-20-2004, 03:56 PM
|
#9
|
|
Member
Registered: Feb 2004
Location: Townsville, Queensland, Oz
Distribution: Red Hat 9
Posts: 107
Rep:
|
PS
if you can ssh in as root, you should be able to scp as root!!! if you can ssh in as root and not scp, then it's probably a syntax error in your scp command. post the exact scp syntax if this is the case.
regards
GT
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:42 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|