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.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityYou 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/* ./
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.