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

If the use the following scp command then I get an error:

scp -P 22 username@xxx.xxx.xxx.xxx: /home/username/public_html/* ./

The error I get is:

stdin: is not a tty scp: .: not a regular file

What am I doing wrong?

Thanks for help.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You don't need the space after the IP address of the remote machine:

scp -P 22 username@xxx.xxx.xxx.xxx:/home/username/public_html/* ./
share|improve this answer
    
Just to calrify, I only want to copy everything in public_html folder including all sub-directories and files. Is this the right command for it? –  April Apr 3 '10 at 12:07
    
I am getting the error "stdin: is not a tty" and then it copies some files from public_html folder and then stops.It does not copy any sub-folders. What am I doing wrong? –  April Apr 3 '10 at 12:28

If you want to copy everything under public_html, this would be correct way to do it:

scp -r -P 22 username@xxx.xxx.xxx.xxx:/home/username/public_html .

-r recurses through the subdirectories.

share|improve this answer
    
ok I shall try. Thanks. –  April Apr 3 '10 at 12:31

Think of scp the same way you think of cp. cp can't copy directions unless you specify some recursion for it to grab every folder and file within the said folder. If you want to copy a folder, you'd run cp -r folder/ destination/. scp is the same. You'll need to run scp -r user@host:/path/to/folder destination/

As a note, when using the default port for SSH (22) you don't need to specify it in the scp command.

share|improve this answer
    
Thanks. The command works fine. –  April Apr 5 '10 at 3:55

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.