Pages

Monday, October 2, 2017

List all cPanel users having Wildcard Remote Mysql Access

Remote MySQL option in cPanel allows other webservers to access the MySQL database on your server remotely.
Remote MySQL option can be very handy, if  you want  to allow applications like shopping carts or guestbooks on your other servers to access the databases.
But on the contrary, if the Remote MySQL option is not handled with  care  then  it can lead to database hacks.
So, If you want to find out all cPanel users having Wildcard Access enabled then  you can  use the below simple command :

root@server[#]mysql -N  mysql -e "Select User from user where Host='%'" | awk  -F _ '{print $1}' | uniq

Saturday, September 16, 2017

Encrypting MySQLDump

If  you are looking to Encrypt your MySQL database dump for security reasons than you can  use the ccrypt tool  to encrypt your dump.sql file.

Follow the below simple steps to  achieve the database dump encryption and decryption :

  1. Create a  encryption key file as /root/.backup_keyfile and add the password/key in  that file.
  2. This keyfile  will be used to  encrypt and decrypt the data [dump.sql file]
Now, that we have created the encryption  file we just need to  execute the below commands:

mysqldump --opt  opsview |  ccrypt  -k /root/.encryptkeyfile > opsview.sql

Can’t locate DateTime perl module

If you are getting below error while installing any application on linux then perl date time module is missing.

    Can’t locate DateTime.
    pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at gatherbot_en.pl line 13.
    BEGIN failed–compilation aborted at gatherbot_en.pl line 13.

You can use below command to install Datetime on server.

    yum install perl-DateTime-TimeZone

dd command to migrate VPS on linux platform

First create new vps with same configuration on another node. It doesn’t matter new vps is having os or not or you can choose any OS.

Once same configuration VPS setup done then use below command to migrate VPS.

    dd if=/dev/guestos/kvm2351_img | ssh 10.10.10.10 “dd of=/dev/guestos/kvm2520_img

Once migration is completed then try starting VPS on new node.

Saturday, September 17, 2016

cPanel performance tweaks, Memory Consumption

Every cpanel server should be need to optimize according to your server usages, I hope the following articles will help to improve your cpanel server performance.

Run your cron jobs at off peak hours.

Stopping SpamAssassin

Go to WHM > Server Configuration > Tweak Settings > Disable Spamd

And:

Go to WHM > Service Manager > Disable Spamd

Disable Anonymous FTP

Remove virtfs and Disable for users

VirtFS provides a jailed shell environment for users who connect to a server via SSH. The jailed shell acts as a container for the user, and does not allow the user to access other users’ home directories on the server. Unlike a normal shell environment, a jailed shell environment prevents access to data outside of the user’s home directory.

Consuming lot of disk space ?

Most of server got large disk space due to this virtfs. You can Disable VirtFS,Remove VirtFS and Unmount the bind mounts. CPanel provides a script to remove the virtfs mounts. Remove virtfs and Disable for users in your cpanel server

Do not delete /home/virtfs/username folder directly because its hard link with user account.