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.


3 Answers 3


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/* ./
  • 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, 2010 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, 2010 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.


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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