Main Page
This is my wiki, containing all of my shortcuts.
Also I would like to note that...
Addon domain issues
If you come across this error:
" Error from park wrapper: Using nameservers with the following IPs: 174.132.129.99,174.132.129.98 Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on that remote nameserver. "
go to tweak settings an check the option to:
Allow Creation of Parked/Addon Domains that resolve to other servers (i.e. domain transfers)
APF
Apf un block
vi /etc/apf/deny_hosts.rules /etc/init.d/apf restart
- of attemps
vi /usr/local/bfd/conf.bfd
Starting APF:Unable to load iptables module (ipt_state), aborting.
vi /etc/apf/conf.apf SET_MONOKERN change to 1 /etc/init.d/apf restart
ChkServd
enable chkservd
/usr/local/cpanel/bin/tailwatchd --enable=Cpanel::TailWatch::ChkServd
Disable chkservd
/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::ChkServd
Coremanaged phpmyadmin
Please view this wiki
http://shooltz.net/w/index.php?title=Phpmyadmin_-_CORE_MANAGED
CPANEL
Cpanel gives this error [a fatal error or timeout occurred while processing this directive] mv /home/(username)/.cpanel/*cache different location and or check permissions on the /home/(username)/.cpanel folder should be user:user
error when accessing http://ipaddress/~username/ Warning: Unknown: open_basedir restriction in effect. File(/home/hilariou/public_html/index.php) is not within the allowed path(s): (/usr/local/lp:/proc:/usr/lib/php:/usr/local/lib/php:/tmp) in Unknown on line 0
Move this line to the post section of the httpd.conf
vim /usr/local/apache/conf/httpd.conf
Include "/usr/local/lp/configs/httpd/vhost.conf
Crond
For help with crond entries go to this url
http://www.linuxhelp.net/guides/cron/
Location of the main cron
vim /var/spool/cron/root
Location of the specific crons, daily weekly monthly...etc
vim /etc/cron.
Tab complete to see all of the options
Add this to the main cron to make all mail in the .sent/cur directory erase after being 15 days old.
0 3 * * * find /home*/*/mail/*/*/cur /home*/*/mail/*/*/.Sent/cur -type f -mtime +30 -exec rm {} \;
Also another nice cron for those of us who forget to clock out or in. This will open the
time clock in a new window to remind you to clock out. Use the link above to set your own time.
55 08 * * 1-5 art env DISPLAY=:0.0 firefox --new-window https://tc.int.liquidweb.com/content/index.html
Disable root login
useradd lwstaff passwd (assign a password) usermod -G wheel lwstaff vim /etc/ssh/sshd_config
change PermitRootLogin = yes to no and un-comment it. restart sshd and test your work.
Email
horde mail update (nothing can be in account of will all get erased)
/usr/local/cpanel/bin/update-horde --force
To determine mailserver type
/scripts/setupmailserver --current
Count mail in folder
ls | wc -l
removing mass spam
rm -Rf /home/(user here}/mail/cur*
spam removel script
for i in $(find . | xargs grep -m 1 -s -i "Mailer-Daemon" | sed -e 's/\.\/[A-Z0-9a-z]\/\([A-Z0-9a-z\-]\{16\}\)\-[HDJ].*/\1/'); do exim -Mrm $i;done
Empty files
To create a empty file that takes so much spce for testing uploads.
dd if=/dev/zero of=file1G.tmp bs=1G count=1
EXIM
number of msg in q
exim -bpc
print msg q summary
exim -bp | exiqsumm
Start a full q run
exim -q -v
Start a local delivery q run
exim -ql -v
Flush exim queue
exim -bpr | awk {'print $3'} | xargs exim -Mrm
Do a traceroute on the email path to the mx hosts
exim -bt Email address here
Fantastico
add the Fantastico installer plugin
cd /usr/local/cpanel/whostmgr/docroot/cgi wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz tar -xzpf fantastico_whm_admin.tgz rm -rf fantastico_whm_admin.tgz
For loops and other loops
ALWAYS RUN THIS FIRST!!!!!
unalias ls
package all cpanel accounts
for user in `ls -A /var/cpanel/users`; do /scripts/pkgacct $user;done
looping a command
while x=0; do killall -9 php5; sleep .1; done
History Removal commands
If the customer would like their history cleared.
echo "" > /var/log/messages && echo "" /var/log/secure echo "" > /var/log/wtmp && echo "" > /var/log/lastlog && history -r
HTOP
Source Install: (for other methods to install please see https://wiki.int.liquidweb.com/articles/Htop)
cd /usr/local/src/ wget http://www.sfr-fresh.com/linux/misc/htop-0.8.3.tar.gz tar zxf htop-0.8.3.tar.gz cd htop-0.8.3 ./configure ; make ; make install
HTTPD and APACHE
to distill changes to the httpd.conf
/usr/local/cpanel/bin/apache_conf_distiller --update apache uptime <pre>/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status
Index blocking
Add this to the .htaccess, Blocks the index of / from being seen. Comment out to make visible again.
Options -Indexes OR Options +Indexes +a-
IPTABLES
Block temp with IPtables
iptables -I INPUT 1 -s ipaddress -j DROP
Block permanently with APF
/etc/apf/deny_hosts.rules
LIST
list by last modified
ls -lt
list by Proc id
lsof -p PID
Load checking
Listening on port
lsof -i :25
Total connections on port 80
netstat -nap |grep -c :80
rough per sec hits
/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $12}' | sort | uniq -c | sort -rn | head
Tells how many are using port 80
netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -f1 -d: | sort | uniq -c | sort -rn | head
mbstring
Check if it is installed with the following
php -i | grep --color mbstring
if that come back with this it is installed but not enabled:
mbstring mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1. mbstring.detect_order => no value => no value mbstring.encoding_translation => Off => Off mbstring.func_overload => 0 => 0 mbstring.http_input => pass => pass mbstring.http_output => pass => pass mbstring.internal_encoding => no value => no value mbstring.language => neutral => neutral mbstring.strict_detection => Off => Off mbstring.substitute_character => no value => no value
Go into the php.ini and un-comment these lines.
vim /usr/local/lib/php.ini
and un-comment these lines.
extension=php_mbstring.dll extension=php_mcrypt.dll
Then
/etc/init.d/httpd stop /etc/init.d/httpd startssl
MODSEC
Remove specified directory from modsec
SecRule REQUEST_URI "URI goes here" phase:1,nolog,allow,ctl:ruleEngine=Off
Add to this file and restart
vi /usr/local/apache/conf/modsec2/whitelist.conf /etc/init.d/httpd restart /etc/init.d/apf restart
Remove a whole domain
SecRule SERVER_NAME "handymanreality.com" phase:1,nolog,allow,ctl:ruleEngine=Off
Common modsec uri's
/wp-admin/post.php /wp-admin/admin-ajax.php /wp-admin/page.php
ModRewrite
www redirect Make sure mod_rewrite is on in the httpd.conf
Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
MTR <enhanced traceroute>
To install:
yum install mtr
If it fails to find the package you will need to add rpmforge to your repo's
MYSQL
To backup all databases to remote location
mkdir /home/sqlbackup for db in `mysql -s -B -e "show databases"`;do mysqldump $db > /home/sqlbackup/$db.sql.(version number here);done
repair a crashed MYISAM table stop chkservd and mysql
/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::ChkServd /etc/init.d/mysql stop
then do
myisamchk -r /var/lib/mysql/(databasename)/(tablename) /etc/init.d/mysql start /usr/local/cpanel/bin/tailwatchd --enable=Cpanel::TailWatch::ChkServd
"MySQL server has gone away" fix
increase wait_timeout and max_allowed_packet in
vim /etc/my.cnf
/etc/init.d/mysql stop /etc/init.d/mysql start
Correct way to upgrade mysql in cpanel box
vim /var/cpanel/cpanel.config
mysql=version you want
/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings mkdir /home/sqlbackup for db in `mysql -s -B -e "show databases"`;do mysqldump $db > /home/sqlbackup/$db.sql.(old mysql version number here);done /scripts/mysqlup mysqladmin version /scripts/easyapache
Myqsl packages are installed
rpm -qa | grep SQL | grep -vi perl
Force perl update
/scripts/perlinstaller --force Bundle::DBD::mysql
what mysql version
mysqladmin version
Mysql database location
cd /var/lib/mysql
imports a dumped file
mysql database < db-dump-file.sql
Mysqldump
mysqldump dbname > dbname.sql
NGINX
To add a vhost you must go to:
cd /etc/nginx/vhosts/
The copy an already existing domain vhost file over to the name that you need.
cp -Rp Existing.com newdomain.com vim newdomain.com
Change the document root over to the new users document root, also change all references of the existingdomain to the new domain then save and exit the file. restart nginx
/etc/init.d/nginx restart
MR Radar
Install mr radar
lpyum install mm3k-client-pull
OwnerShip & Groups
Tell what group number owner is
cat /etc/passwd | grep nobody
Add user to group
useradd -G {group-name} username
Permissions
Find 777 folders
find /home -perm 0777 -type d -print
Plesk
Location of the vhost in plesk /var/www/vhosts/HoudiniESQ.com/conf
PHP
PHP info
<?php phpinfo(); ?>
PHP version
/usr/local/cpanel/bin/rebuild_phpconf --current
PHP 4 module check
/usr/local/php4/bin/php
enable/disable monitoring script ---
wget http://scripts.ssullivan.org/apiCalls/confMonitoring perl confMonitoring
PhP mem limit on a shared with dso goes into the public_html in the .htaccess
php_value memory_limit 64M
veiw availiable php upgrades
/scripts/phpextensionmgr list
install php upgrade
/scripts/phpextensionmgr install (name here)
Ports
Bindings
netstat -lnc
Premigrations
Lower ttls and serial changes
wget http://layer3.liquidweb.com/migrations/premigrate.sh bash premigrate.sh
Python
find python version
python -V
Rdesktop
rdesktop (servername here) -u mshooltz -p (passhere) &
ROBOTS.TXT
To make a file that prevents indexing of certain folders.
touch robots.txt
change the permissions to user.user and the edit the file and add these lines to it.
User-agent: * Disallow: /
You can specify othe directorys that you wish to be blocked by adding the path, and for this file "/" = public_html.
RPM
Rpm src packages go here
/usr/local/src/
remove old kernal srcs
rpm -qa | grep kernel-source | xargs rpm -e
Rpm remove installed packages
rpm -e --nodeps {package name here}
Rsync
For restoring a shared account
/scripts/pkgacct (username)
Now empty out their public_html
rm -rf /home/(username)/public_html/* rsync -avHl /backup/_bacckup-/home/(username)/public_html/ /home/(username)/public_html/
SCP
scp {file} root@(servers ip here):/home/
SED
replace this with THIS
sed -i 's/(this)/(THIS)/g' path/filename
SPAMD
SPAMD failing
/scripts/perlinstaller Digest::SHA1 /scripts/perlinstaller --force Mail::SpamAssassin /etc/rc.d/init.d/exim restart /scripts/restartsrv spamd
SSl locations
/usr/share/ssl /etc/ssl/certs
Stats
update all stats
for user in `ls -A /var/cpanel/users`; do /scripts/runweblogs $user ;done
SuPHP
Suphp permission fix by ssullivan
wget -O /scripts/suphpfix.pl http://layer3.liquidweb.com/scripts/suphpfix.pl chmod +x /scripts/suphpfix.pl /scripts/suphpfix.pl
System specs
tells the system bit
uname -a
What linux version and release
cat /etc/redhat-release
Top
sort by memory
shift - m
sort by processor usage
shift - p
VI commands
Add line numbers
:set number
Remove line numbers
:set nonumber
VPS
Get root fight when logged in using LDAP
sudo su
VPS is locked when some operation (backup, migration, start / stop, etc.) with this VPS is in progress. You can determine which process is holding VPS #101 using the following command on the hardware node:
# cat /vz/lock/101.lck
You can kill that process if needed. Make sure that the process is really killed. If there is no process with that PID on the node, just remove the lockfile.
http://shooltz.net/w/index.php?title=Phpmyadmin_-_CORE_MANAGED