SCP (Secure Copy Protocol) is a secure method for transferring files between local and remote hosts, based on the SSH protocol. Here's a guide on using SCP, particularly in the context of cPanel:
Basic SCP Syntax
Copying file to a remote host:
scp sourcefile $user@host:directory/targetfile
Copying file from a remote host:
scp $user@host:directory/sourcefile targetfile
Copying a directory recursively:
scp -r $user@host:directory/sourcefolder targetfolder
Using a Non-Standard SSH Port
If the remote host uses a port other than the default 22, you can specify it with the -P option:
scp -P 2222 user@host:directory/sourcefile targetfile
SCP with cPanel
While SCP is not specific to cPanel, it can be used to transfer files to and from a cPanel server if SSH access is enabled:
- Ensure that SSH access is enabled for your cPanel account.
- Use your cPanel username and server hostname in the SCP commands.
- The default directory for cPanel users is typically
/home/username/
.
Example: Copying a file to your cPanel account's home directory
scp localfile.txt $user@server.hostname.com:/home/$user/
Example: Copying a file from your cPanel account to your local machine
scp $user@server.hostname.com:/home/$user/remotefile.txt ./
GUI Alternatives
For users more comfortable with graphical interfaces, there are GUI-based SCP clients available, such as FileZilla or WinSCP, which can provide a more user-friendly experience for file transfers.
Additional Resources
- SCP Manual Page
- Linux SCP Help
- Securely Copy Files Using SCP
- SCP Tutorial
- Copy files and directories with SCP
For more in-depth information, use the following commands in your terminal:
$ man scp
$ info scp