Taking backups of your website and databases using cPanel is vital for data security. In this guide, you will learn how to take backups step by step, focusing on the keyword "cpanel ssh backup".
As a first step, we need to activate SSH access on cPanel. You must perform this process to take backups via SSH. You can enable SSH access by following the steps below:
Once you have enabled SSH access, you are ready to connect to cPanel via SSH.
You need to follow some basic steps to connect to cPanel via SSH. These steps can be performed using a terminal or command prompt:
ssh username@server_address
ssh [email protected]
Now that you have connected to the cPanel server via SSH, you can start backing up.
You need to know some basic commands to take backups using SSH on cPanel. Here are the basic SSH commands you can use for backup:
tar
mysqldump
scp
You can backup your website's files and databases using these commands.
Follow these steps to create and download a backup file using SSH:
cd /home/username/public_html
tar -czvf backup.tar.gz .
mysqldump -u username -p database_name > database_backup.sql
scp username@server_address:/path/to/backup.tar.gz /local/directory
scp [email protected]:/home/username/public_html/backup.tar.gz /Users/username/Desktop
After you complete the backup process, it is important to perform security and control procedures:
Backing up with SSH offers a more secure and faster backup method. It also provides more flexibility and control because it provides direct access from the command line.
To restore a backup file, you can connect to your server via SSH and restore the relevant files and databases. For example, you can extract files with the tar command and restore databases with the mysql command.
mysql
You can create SSH keys via cPanel or termi nal. You can generate an SSH key pair using the ssh-keygen command in the terminal.
ssh-keygen
You can use the scp command to move a backup file to another server. This command allows you to securely copy files from one server to another.
If the backup file size is too large, you can split the file into parts or increase the compression level. You can also keep the size of the backup file under control by repeating the backup process at regular intervals.