Operating System - HP-UX
1833175 Members
2723 Online
110051 Solutions
New Discussion

Re: how to transfer files via SSH ?

 
SOLVED
Go to solution
'chris'
Super Advisor

how to transfer files via SSH ?

hi

how to transfer files and folders
via SSH
using linux rescue CD ?

kind regards
chris

8 REPLIES 8
Rodney Hills
Honored Contributor

Re: how to transfer files via SSH ?

The command to transfer files is "scp", but if your booting up on a rescue disk, you won't have the necessary "validations" to use SSL.

You probabily will want to use something like "ftp", since that would be available on the rescue disk.

HTH

-- Rod Hills
There be dragons...
Steven E. Protter
Exalted Contributor
Solution

Re: how to transfer files via SSH ?

Lets say the the cd is mounted as /cdrom

scp -rp /cdrom/* targethost://targetdirectory

This command preserves permissions if possible and takes the entire contents of the cd and puts it in the target directory of the target host. -r stands for recursive.

Good Luck,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
rmueller58
Valued Contributor

Re: how to transfer files via SSH ?

sftp user@host
put filename

or

get filename

put *
or
get *

'chris'
Super Advisor

Re: how to transfer files via SSH ?

thanks everyone !

but how it works with sftp user@host ...
to transfer the whole /etc directory including all subfolders, files, etc. ?
Joseph Loo
Honored Contributor

Re: how to transfer files via SSH ?

hi chris,

for sftp, to use interactively, it is the same as ftp, instead of get (for a single file), u use mget.

# sftp user@otherhost
after login
sftp> cd dir
sftp> mget *
sftp> exit

regards.
what you do not see does not mean you should not believe
Abdul Rahiman
Esteemed Contributor

Re: how to transfer files via SSH ?

You can not trasfer dir. structure using sftp (if not using GUI based clients).
To transfer files without using scp or sftp is by using a combination of tar and ssh command like below.

tar cpf - local_dir| (ssh user@remote_host "cd remote_dir; tar xpf -")

This will tar up the whole dir. structure and untar it on the remote host.

HTH,
Abdul.
No unix, no fun
Marc Smith
Occasional Advisor

Re: how to transfer files via SSH ?

You could use scp with the -r switch.

From the man page:

-r Recursively copies entire directories. The targets of hard links
or soft links are copied. The links are not duplicated.

But I personally would prefer to tar and tranfer the tar file via sftp.
'chris'
Super Advisor

Re: how to transfer files via SSH ?

thanks

with

scp -r -p /etc/* user@remotehost:/home/save/etc

works excellent !

greetings
chris