Disclaimer: Before making changes to your website files, always create a backup. Improper file operations can lead to website downtime or data loss. The instructions below are provided as general guidance for Plesk users on Linux servers. Always test procedures in a non-production environment first.

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

How to Copy a File in Plesk & Plesk SSH Setup

Method 1: Using Plesk File Manager with a Backup Directory

  1. Create a backup directory:
    1. Log in to your Plesk Control Panel
    2. Navigate to "Files" or "File Manager"
    3. Click "New Folder" and name it something clear like "backups" or "file_copies"
  2. Copy files to your backup directory:
    1. Select the file you want to copy
    2. Click "Copy" in the toolbar
    3. Navigate to your backup directory
    4. Click "Paste" to complete the copy operation
  3. Rename the file if needed:
    1. In your backup directory, select the copied file
    2. Click "Rename" in the toolbar
    3. 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

  1. 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

  2. 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"
  3. Add your public key to the server:
    1. Copy your public key:
      cat ~/.ssh/id_ed25519.pub

      Or for RSA keys:

      cat ~/.ssh/id_rsa.pub
    2. Connect to your server via SSH using your Plesk credentials:
      ssh username@yourdomain.com
    3. Open or create the authorized_keys file:
                      	mkdir -p ~/.ssh
      			chmod 700 ~/.ssh
      			vim ~/.ssh/authorized_keys
      				
    4. Paste your public key, save and exit (press ESC, type :wq, press Enter)
    5. Set proper permissions:
      chmod 600 ~/.ssh/authorized_keys

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:

  1. On your local machine, create or edit ~/.ssh/config:
    vim ~/.ssh/config
  2. Add your server configuration:
            	Host plesk-mysite
    		    HostName example_domain.com
    		    User username
    		    Port 22
    		    IdentityFile ~/.ssh/id_ed25519
    		
  3. Save and exit
  4. 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:

  1. Create a backup copy of a file:
    cp httpdocs/index.html httpdocs/index.html.bak
  2. Create a timestamped backup:
    cp httpdocs/index.html httpdocs/index.html.$(date +%Y-%m-%d)
  3. Verify the copy was created:
    ls -al httpdocs/
  4. 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
 
Important Note: Always test these procedures in a non-production environment before applying them to your live website. Server configurations may vary, and some commands might need adjustment for your specific setup. Regularly check the WebHostingM knowledge base for the most up-to-date documentation on Plesk file management.
Did this answer help? 0 People found this helpful (0 Votes)