Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to copy a file that apparently is only accessible over SSH (http.conf). I am very ignorant in this area and have virtually no experience with using an SSH client, so my hours of trying have resulted in no progress.

I'm able to view the file using the "vi" command, but can't find a way to copy all of the lines in the file. I tried copying the file using the "scp" command, but could not get it to work.

What is the easiest way to copy a file over SSH?

share|improve this question
    
What was the exact command line you used with scp ? –  Ladadadada Oct 25 '12 at 17:05
    
@Ladadadada - scp ftpusername@mydomain.com:httpd.conf /pathtopublichtmlfolder/public_html. The response was "ssh: connect to host domain.com port 22: Connection refused. –  Nate Oct 25 '12 at 17:07
1  
Is ssh running on port 22 on your server or is it a non-standard port? –  Ladadadada Oct 25 '12 at 17:13
    
From where to where do you want to copy http.conf? –  Ansgar Wiechers Oct 25 '12 at 17:16
add comment

5 Answers

up vote 2 down vote accepted

Easiest way if you aren't familiar with SCP command is to download Tunnelier, when you connect with SSH to your server, you will automatically also get an file explorer window like this that you can use to copy files between server and your PC with an easy drag and drop method

share|improve this answer
1  
Wow, that was easy. After over an hour of trying with Putty, this was just drag & drop. THANK YOU!!!!! –  Nate Oct 25 '12 at 17:27
add comment

scp user@destinationhost:/path/to/file /path/to/file

share|improve this answer
    
Should "user" be "root" or any ftp username? When I remove ".com" from the website name, which is what I'm assuming you were implying by writing "destinationhost", it says "Name or service not known." –  Nate Oct 25 '12 at 17:11
    
@Nate You shouldn't remove ".com" as "host.com" is your full hostname –  xhochy Oct 25 '12 at 17:12
2  
Did you log in via SSH to invoke vi earlier? Use the same username and same destinationhost. –  dmourati Oct 25 '12 at 17:15
add comment

It sounds like the httpd.conf file is already on the server you've ssh'd to, and you want to get it OFF of there to your local computer? Since it's unlikely you're running an ssh server on your windows PC to send the file to, you'll need to use a windows SCP client, run in windows and connecting to the server, to transfer the file from the server to you. PuTTY has a commandline pscp.exe that you can use in a command prompt in windows, or you can use a graphical client like WinSCP.

share|improve this answer
add comment

SCP local to remote copy:

scp http.conf user@remoteserver:/pathtopublichtmlfolder/public_html

share|improve this answer
add comment

I don't understand transfering files over SSH has any involve in apache2 ? So I will ignore apache2 What is your Client Computer's OS ?

  1. Windows : Use WinScp , Enter Server's IP or domain , your username , your password ( or key )
  2. *Unix or MacOs : use commandline :

    • Transfer a file scp whatever.file yourusername@server:/path/to/somewhere/
    • Transfer a directory scp -r your_directory yourusername@server:/path/to/somewhere/
    • If you have a key, use scp -i /path/to/keyfile whatever.file yourusername@server:/path/to/somewhere/

Hope that helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.