We help IT Professionals succeed at work.

Copy a folder from Linux server over SSH

Sergey_Nesterenko
Sergey_Nesterenko asked
on
Hello,

I'm running Windows 7 Pro, I have connected via SSH to a remote Linux server that host a website.
I need to copy a folder that has all the website files to my computer, what is the command to do so?
Also this website is using Apache Tomcat for DB and I need to copy it also, is there a special steps I need to take to copy the DB or just copy the folder were DB is located?

Thank you,

Sergey
Comment
Watch Question

Since you have SSH credentials to the linux machine you can use SCP protocol to copy the files from the Linux machine over to your Windows 7 machine.

In linux the SCP tool is built in which lets you easily transfer files from one linux computer to another.

Windows doesn't have such a tool by default, but you can download and install WinSCP to do this:

http://winscp.net/eng/index.php

Putty also has a command line version of this tool if you are more comfortable with that:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html  (see the PSCP tool)
You will probably want to take a SQL dump backup of your database and then restore the backup to your database server running on your windows machine - the raw data files on a linux machine may not be compatible with a Windows installation.

Author

Commented:
Heaving problems, getting a message that sftp server is not responding or down when connecting through WinSCP. Can you give me an example of the command I can enter on linux server that transfers folders to a remote PC?

Thank you,

Sergey
It will be easier to pull the files from the linux server instead of trying to push them to your windows box. Your windows machine isn't running any services which can be easily accessed from the linux machine without setting up firewall exceptions, permissions etc.

Since you already have SSH access to the linux machine you can use WinSCP to easily pull the files off the server.

When using WinSCP, make sure that you use SSH/SCP as the file protocol, and not SFTP.

Author

Commented:
Thank you, it worked!