LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2007, 01:56 PM   #1
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Rep: Reputation: 15
ssh - copying files


Hi,

I'm running CentOS 4.4 and want to copy a file from one of my CentOS machines to the other through ssh. I have done it before but it was a long time ago.

Any help would be much appreciated,

Thanks.
 
Old 05-25-2007, 01:58 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
You use scp e.g.
Code:
$scp somefile user@remote_host:some/dir/
If its a directory then its
Code:
$scp -r somedir user@remote_host:some/dir/

Last edited by reddazz; 05-25-2007 at 02:16 PM. Reason: clarify which host is being referred to when using the scp command
 
Old 05-25-2007, 02:03 PM   #3
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Original Poster
Rep: Reputation: 15
Hmm - that didnt work for me or maybe I just am putting it in wrong:

scp samba.schema root@localhost /root/etc/openldap/schema

I have never used that before so am I doing it right?

thanks.
 
Old 05-25-2007, 02:13 PM   #4
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Rep: Reputation: 32
you're almost right. There are two errors in the statement you're using, if you read reddazz's post carefully you'll be able to identify them yourself.

1) you're missing a small little semicolon after user@host
2) the host should be the remote host onto which you wish to copy the file (i.e. either it's name or i.p. address) and not the localhost, otherwise there's no use of using scp (it's across hosts, right?)

you're using
Code:
scp samba.schema root@localhost /root/etc/openldap/schema
while it should be
Code:
scp samba.schema root@remote_host:/root/etc/openldap/schema
regards,
koodoo
 
Old 05-25-2007, 02:14 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Usually you can't ssh as root. You can be root when you transfer but not ssh as root example....

Code:
scp samba.schema user@localhost:/some/dir
where localhost is the host (or ipaddress) of the machine you want to copy to....also remember to put the ":"

It dosen't matter how you transfer it...you can always change the permissions/ownership with chown/chmod/chgrp

Last edited by custangro; 05-25-2007 at 02:17 PM.
 
Old 05-25-2007, 02:16 PM   #6
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Original Poster
Rep: Reputation: 15
You are able to ssh as any user - usually its not smart to do so for security reasons - but the network im on is safe.

Ok I got past most of it but when I make the connection - I get a error saying:

not a regular file scp :S and it doesnt copy over
 
Old 05-25-2007, 02:20 PM   #7
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by wendea
You are able to ssh as any user
True you CAN ssh into root....but don't you have to "turn it on" in order to do it? Maybe I'm wrong....


Anyhoo....are you sure you are in the directory that the file is in? Try typeing the full path...
 
Old 05-25-2007, 02:24 PM   #8
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Original Poster
Rep: Reputation: 15
When I do that remote host I dont get any connection to my other computer - however when I use the IP I do and it automatically asks me for roots passwd - I type it in and I get that error - not a regular file. The code im using now is:

scp samba.schema ipaddress: /root

thanks for all your help just need a bit more
 
Old 05-25-2007, 02:25 PM   #9
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,708
Blog Entries: 5

Rep: Reputation: 168Reputation: 168
I don't know about CentOS, but Debian 4.0's openssh-server defaults to allowing root login. Whether or not root login is allowed by default will vary from distribution to distribution.
 
Old 05-25-2007, 02:30 PM   #10
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Original Poster
Rep: Reputation: 15
Im not really wondering about root logins via ssh right now cause I know you can do it - Im wondering about scp(see above posts for details :P)
 
Old 05-25-2007, 02:33 PM   #11
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by wendea
scp samba.schema ipaddress: /root
Try doing it without the space between the ":" and the "/root"

If that dosen't work try "scp"ing another file....maybe it's the file that's bad?
 
Old 05-25-2007, 02:39 PM   #12
wendea
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 81

Original Poster
Rep: Reputation: 15
THANK YOU very much it was the space - thanks all of you who helped :P
 
Old 05-25-2007, 02:56 PM   #13
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
No prob
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Copying files paddyjoy Linux - Newbie 10 10-25-2013 11:12 AM
copying files exelte Ubuntu 1 05-22-2007 12:04 PM
Copying files to local computer whilst in ssh tunnel Maverick1182 Linux - Newbie 4 10-07-2006 01:29 PM
Copying .ssh from one server to another xpucto Linux - Newbie 2 07-03-2006 04:52 AM
Copying in ssh albean Linux - Newbie 2 12-28-2004 05:17 PM


All times are GMT -5. The time now is 05:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration