Why Is Backing Up Files Crucial?
Creating copies of your website files serves multiple critical purposes:
- Protection against data loss - Having a backup ensures you can restore files if they're accidentally deleted or corrupted
- Testing ground for changes - Make modifications to copies rather than original files to avoid disrupting your live website
- Version control - Maintain different versions of your files to track changes over time
- Website migration preparation - Create copies before transferring to another server
Understanding File Copying in Plesk vs. cPanel
Unlike cPanel's File Manager which allows you to copy and rename files in one operation, Plesk's File Manager has a limitation: the "Copy" function can only replace existing files.
This key difference requires Plesk users to use alternative approaches when creating file copies.
Methods for Copying Files in Plesk
Method 1: Using Plesk File Manager with a Backup Directory
- Create a backup directory:
- Log in to your Plesk Control Panel
- Navigate to "Files" or "File Manager"
- Click "New Folder" and name it something clear like "backups" or "file_copies"
- Copy files to your backup directory:
- Select the file you want to copy
- Click "Copy" in the toolbar
- Navigate to your backup directory
- Click "Paste" to complete the copy operation
- Rename the file if needed:
- In your backup directory, select the copied file
- Click "Rename" in the toolbar
- Enter a new name (e.g., "index.html.bak" or "index_2025-04-04.html")
Method 2: Using SSH Terminal (Recommended)
Terminal commands provide greater flexibility and are often faster for managing files on your server.
Prerequisites for SSH Access
- Check for existing SSH keys on your local machine:
ls -la ~/.ssh
Look for files named id_ed25519, id_ed25519.pub, id_rsa, or id_rsa.pub
- Generate new SSH keys if needed:
ssh-keygen -t ed25519 -C "your_email@example.com"
Or for older systems that don't support Ed25519:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Add your public key to the server:
- Copy your public key:
cat ~/.ssh/id_ed25519.pub
Or for RSA keys:
cat ~/.ssh/id_rsa.pub
- Connect to your server via SSH using your Plesk credentials:
ssh username@yourdomain.com
- Open or create the authorized_keys file:
mkdir -p ~/.ssh chmod 700 ~/.ssh vim ~/.ssh/authorized_keys
- Paste your public key, save and exit (press ESC, type :wq, press Enter)
- Set proper permissions:
chmod 600 ~/.ssh/authorized_keys
- Copy your public key:
The process above might not be needed as there must be an existing .ssh folder after your Plesk account has been created. So copy and to the authorized_keys file
Simplifying SSH Connections with SSH Config
Instead of typing the full SSH command each time, set up an SSH config file:
- On your local machine, create or edit ~/.ssh/config:
vim ~/.ssh/config
- Add your server configuration:
Host plesk-mysite HostName example_domain.com User username Port 22 IdentityFile ~/.ssh/id_ed25519
- Save and exit
- Now connect simply by using:
ssh plesk-mysite
Copying Files via SSH
Once connected to your server via SSH, use these commands to copy files:
- Create a backup copy of a file:
cp httpdocs/index.html httpdocs/index.html.bak
- Create a timestamped backup:
cp httpdocs/index.html httpdocs/index.html.$(date +%Y-%m-%d)
- Verify the copy was created:
ls -al httpdocs/
- Copy an entire directory and its contents:
cp -r httpdocs/images/ httpdocs/images_backup/
Best Practices for File Management
- Use descriptive filenames for your backups (include dates or version numbers)
- Create a regular backup schedule for critical website files
- Test your backup copies to ensure they function correctly before modifying originals
- Use version control systems like Git for more complex websites
- Consider server-level backups in addition to file-level backups
- Monitor disk space usage to ensure backup files don't consume excessive storage
Common Issues You Might Run Into and Solutions
Issue | Solution |
---|---|
Permission errors when copying files | Use chmod to set appropriate permissions or contact your server administrator |
Copy operation times out for large files | Use SSH for copying large files or compress the file before copying |
Unable to connect via SSH | Verify SSH is enabled in Plesk, check your credentials, and confirm firewall settings |
Files copied via SSH not visible in Plesk File Manager | Refresh the File Manager or check file ownership and permissions |