LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2002, 09:51 PM   #1
filsed
Member
 
Registered: Oct 2001
Location: Boise, ID, USA
Distribution: Fedora Core 4
Posts: 67

Rep: Reputation: 15
scp command in OpenSSH howto


Hi there, can someone help me please how to use scp command via the OpenSSH service to copy files from server to client. For example:

On server side there is file called "test.txt" in directory /home/user1 and I would like to copy that file to my directory /home/user2 on client PC

Thanks a lot.
 
Old 05-07-2002, 08:39 AM   #2
kill-hup
Member
 
Registered: Aug 2000
Location: NY - USA
Distribution: Slackware
Posts: 109

Rep: Reputation: 15
There are (most simply) two ways you can do it.

from server:
scp /home/user1/test.txt user@client:/home/user2/
(where "user" on the client machine has write access to /home/user2 and current working user on server machine has read access to /home/user1/test.txt)

from client:
scp user@server:/home/user1/test.txt /home/user2/
(where "user" on the server machine has read access to test.txt in /home/user1 and current working user on client machine has write access to /home/user2)
 
Old 05-07-2002, 09:30 AM   #3
c0rk3y
Member
 
Registered: Apr 2002
Location: NY USA
Distribution: Gentoo1.4/ FreeBSD4.x
Posts: 78

Rep: Reputation: 15
scd ....

here is a link that might help additional questions.
OBTW your question for some reason shed light on my understanding Thank you, THANK YOU. Im a happier person now.SSH tips and tricks
 
Old 05-08-2002, 11:02 AM   #4
filsed
Member
 
Registered: Oct 2001
Location: Boise, ID, USA
Distribution: Fedora Core 4
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks kil-hup for help, but I have one last question. Can I use IP address instead of client and server name? Thanks.
 
Old 05-08-2002, 12:28 PM   #5
kill-hup
Member
 
Registered: Aug 2000
Location: NY - USA
Distribution: Slackware
Posts: 109

Rep: Reputation: 15
Quote:
Originally posted by filsed
Can I use IP address instead of client and server name? Thanks.
Sure can, just substitute the IP for the hostname.
 
Old 05-30-2002, 10:13 AM   #6
filsed
Member
 
Registered: Oct 2001
Location: Boise, ID, USA
Distribution: Fedora Core 4
Posts: 67

Original Poster
Rep: Reputation: 15
scp problem

Please help me again. When I try to copy something from remote system to my local PC with scp command it says:

/usr/bin/ssh: No such file or directory

Thanks.
 
Old 05-30-2002, 11:05 AM   #7
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
you need ssh to be installed + have at least link in /usr/bin/ssh
alternatively you can use -S /usr/local/bin/ssh2

btw with you can copy dirs also, or use wildcards

scp -r user@host:/home/mydir name@host2:/home/test
 
Old 05-30-2002, 12:39 PM   #8
filsed
Member
 
Registered: Oct 2001
Location: Boise, ID, USA
Distribution: Fedora Core 4
Posts: 67

Original Poster
Rep: Reputation: 15
All openssh packages are installed. I can access and work on the remote system with ssh but the only problem is scp command to transfer files. Please help.
 
Old 05-30-2002, 01:13 PM   #9
kill-hup
Member
 
Registered: Aug 2000
Location: NY - USA
Distribution: Slackware
Posts: 109

Rep: Reputation: 15
Quote:
Originally posted by filsed
All openssh packages are installed. I can access and work on the remote system with ssh but the only problem is scp command to transfer files. Please help.
I think you missed Noerr's point. The scp program requires ssh (or an ssh-compatible program) to actually set up the secure connection. The path to ssh is hard-coded into the scp binary, usually "/usr/bin/ssh". You can check where scp thinks ssh lives by the command sequence: "strings scp | grep ssh".

If your ssh binary is not either located in the place scp expects it ("/usr/bin" or symbolically-linked in "/usr/bin"), scp cannot find it.

You can create a link to the ssh binary in /usr/bin or call scp like: "scp -S /path/to/ssh/binary other-options". The "-S" switch overrides the hard-coded ssh binary location with the one you specify.

If you are unsure as to where the ssh binary is installed, try "which ssh".
 
Old 05-31-2002, 09:24 AM   #10
filsed
Member
 
Registered: Oct 2001
Location: Boise, ID, USA
Distribution: Fedora Core 4
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks for help kill-hup. Problem solved, it was my stupid mistake - I had everything installed on my local machine but one package (openssh-clients) was missing on my server. But there is another problem. When I finally try to copy a file from server to local PC than it asks for remote user's password (that's allright) but after that it does nothing. You know, no transfering info or something like that. It looks like the command is running but that's all. I don't know where could be a problem. Please help again if you can.
 
Old 05-31-2002, 03:33 PM   #11
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
by default there should have been progress meter, unless you are using historical version
check it by
ssh -v
on both servers to check it out
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp command zchoyt Linux - General 10 04-02-2014 07:47 AM
scp command problem srnerkar1 Linux - Networking 7 11-16-2005 08:06 AM
command of scp Paxmaster Linux - General 4 01-06-2005 12:59 PM
Concepts/Security types/ Setup: OpenSSH/sshd/ssh/scp/sftp Caud Pong Linux - Security 5 09-23-2004 06:51 AM
error with scp command eduac Linux - Security 2 08-07-2003 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration