Showing posts with label Cpanel. Show all posts
Showing posts with label Cpanel. Show all posts

June 23, 2015

How to Backup and Restore cPanel Accounts via SSH

Log-in to the SSH as Root user.
Run on source server:

Method 1:

/scripts/pkgacct $user
mv cpmove-$user.tar.gz /home/$user/public_html
chmod 644 /home/$user/public_html/cpmove-$user.tar.gz

Run on destination server:

cd /home
wget http://$userdomain/cpmove-$user.tar.gz
/scripts/restorepkg $user

After successfull migration run on source server

/scripts/killacct $user

Replace $user with your user account name and $userdomain with user domain name

Method 2 (Recommend): It is faster and easier to simply scp the backup to the new machine.

/scripts/pkgacct $user
scp /home/cpmove-$user.tar.gz root@destinationIP:/home/

You'd replace $user with the cPanel username, destinationIP with the IP number for the new machine. After running the second command, you would be prompted for the password for the destination server.

Now, if you end up having SSH running on an alternate port on the destination machine rather than port 22, you'd simply add this section:

/scripts/pkgacct $user
scp -P port# /home/cpmove-$user.tar.gz root@destinationIP:/home/

Replace port# with the alternate port on the destination machine.

If you have root user locked down where you cannot SSh as that user, simply scp to a sudo user's home that has shell access:

/scripts/pkgacct $user
scp -P port# /home/cpmove-$user.tar.gz sudousername@destinationIP:./

At that point, you'd replace sudousername with the sudo user that has shell access. This would save a copy of the cpmove-$user.tar.gz file to /home/subousername location. You'd then log into the destination machine, sudo su - to root and move the file from /home/sudousername to /home instead:

mv /home/sudousername/cpmove-$user.tar.gz /home

After you have the account on the destination machine, then you can run "/scripts/restorepkg $user" at that point.

https://forums.cpanel.net/threads/how-to-manually-terminal-command-line-backup-migrate-restore-single-user-account.204311/

June 20, 2015

June 9, 2015

How To Fix cPanel Error “IP Address Has Changed!”

There are two possibilities why you would receive an error message “IP address has change” from cPanel.
cpanel
1) Your Internet Service Provider (ISP) has a short DHCP lease time, causing your IP address to be renewed/released and reassigned while you are logged into cPanel.
2) You are attempting to login into cPanel using the same account from two different devices concurrently.
There are two ways to resolve the error message.
The first method is to relogin into cPanel. This usually works.
However, if method #1 doesn’t work, you may attempt method #2, by configuring your cookie IP validation settings. Method #2 is only applicable for accounts with cPanel and WHM version 11.28 and above.
Note: You must have a Cloud Hosting Reseller Account or higher.
Step 1 – Login into cPanel and WHM.
Step 2 – Click on “Main” -> “Server Configuration” -> “Tweak Settings” -> “Security Tab”.
Step 3 – Look for “Cookie IP Validation”. For more information, you may click on the “?” sign. It reads: Validate the IP addresses used in all cookie based logins. This will limit the ability of attackers who capture cPanel session cookies to use them in an exploit of the cPanel or WebHost Manager interfaces. For this setting to have maximum effectiveness, proxy domains should also be disabled.
Step 4 – Change the settings to “Loose” and the frequency of re-authentication will be lowered. You can also disabled it entirely.
Step 5 – Disable proxy domains. If you do not perform this step, you have to utilize a proxy server with a static IP address to establish and maintain your connection.
Step 6 – Clear your web browser’s cache and login into cPanel like normal.

Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file

Apache  service on a Server stops while restart it shows following messages in error_logs
[Sun Dec 28 08:20:20 2014] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
Configuration Failed
Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.
Using the below command you can semaphores list.
root@server04 [~]# ipcs -s | grep nobody
So, In-order to clear the semaphores list. We have execute the following command.
root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem
After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.
Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.
# Increases the semaphore limits & extend Apache’s uptime.
kernel.msgmni = 512
kernel.sem = 250 128000 32 512
Then load the new settings into the kernel using the command.
root@server04 [~]# sysctl -p
Now you are in safe zone. :)