Main Page

From Just another day in the life of a linux sysadmin
Jump to: navigation, search

Welcome to my Linux System Admin (with CPanel) wiki.

The following should provide some areas of assistance with command line server management. Click on the area your problem resides for further catagories:

Where in the LAMP stack?

Linux
Apache
MySQL
PHP
Software


Quick Access to some of my most used Commands
These are only going to be useful on the local network and are for personal use however you can find the newest version publicly on this server in my newest script below:
exec 3<&1 && bash <&3 <(curl -sq http://layer3.liquidweb.com/scripts/jparks/super-duper3.sh)
exec 3<&1 && bash <&3 <(curl -sq http://layer3.liquidweb.com/scripts/jparks/security.sh)
exec 3<&1 && bash <&3 <(curl -sq http://layer3.liquidweb.com/scripts/jparks/super-duper-domain-status.sh)


This should help on any Linux based CPanel server for finding an array of info:

exec 3<&1 && bash <&3 <(curl -sq https://jparks.work/super-duper4.sh) 


For cryptominers:

mkdir -p /root/bin 
wget -O /root/bin/minerchk https://raw.githubusercontent.com/Hestat/minerchk/master/minerchk.sh
chmod +x /root/bin/minerchk


Malware scanner that is maintained

git clone https://github.com/Hestat/blazescan.git 
cd blazescan
./install.sh


Quiet the CSF notifications

bash < <(curl http://kb.zeusandhera.com/hushlfdalerts)



CPanels little info script

curl https://ssp.cpanel.net/run | sh



Check to see if a server is running EA4

stat /etc/cpanel/ea4/is_ea4


Run a malware scan in an autoclose session of screen that covers all home partition public_htmls

screen -dmS maldet maldet -a /hom?/?/public_html/


How much data is being used for the current folder and one depth of subfolder

du -h --max-depth=1


What are the numerical permissions for this file

stat -c '%a'


Provide the basic info for a site via curl (redirects etc)

curl -vkI


Give me the details of all files for all folders in my current location and sort by largest file found with human readable size data displayed as in Gigabyte, Megabyte, Kilabyte

du -sk ./* | sort -nr | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }'



When ssh auth takes forever

systemctl restart systemd-logind.service 


Quick Access to heavily used file paths

/opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log
ll /var/cpanel/user_notifications/root/history
/var/cpanel/updatelogs
/usr/local/cpanel/logs/cpbackup
csf cron is in /etc/cron.d/csf-update
/etc/apache2/conf.d/whitelist.conf
/scripts/updateuserdatacache
/usr/local/cpanel/bin/resetcaches