Main Page: Difference between revisions
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
find 777 folders | find 777 folders | ||
<pre>find /home -perm 0777 -type d -print</pre> | <pre>find /home -perm 0777 -type d -print</pre> | ||
<h1>Disable root login</h1> | |||
useradd lwstaff | |||
passwd (assign a password) | |||
useradd -G wheel lwstaff | |||
vim /etc/ssh/sshd_config | |||
change PermitRootLogin to no and uncomment it. | |||
restart sshd and test your work. | |||
<h1> LIST</h1> | |||
[[User:Admin|Admin]]list by last mmodified | |||
ls -lt | |||
[[User:Admin|Admin]]list by Proc id | |||
lsof -p PID | |||
<h1>VI commands</h1> | |||
[[User:Admin|Admin]]add line numbers | |||
:set number | |||
[[User:Admin|Admin]]remove line numbers | |||
:set nonumber | |||
<h1>ModRewrite</h1> | |||
[[User:Admin|Admin]]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] | |||
<h1>MODSEC</h1> | |||
[[User:Admin|Admin]]Remove specified directory from modsec | |||
SecRule REQUEST_URI "URI goes here" phase:1,nolog,allow,ctl:ruleEngine=Off | |||
[[User:Admin|Admin]]add to this file and restart | |||
vi /usr/local/apache/conf/modsec2/whitelist.conf | |||
/etc/init.d/httpd restart | |||
/etc/init.d/apf restart | |||
[[User:Admin|Admin]]Remove a whole domain | |||
SecRule SERVER_NAME "handymanreality.com" phase:1,nolog,allow,ctl:ruleEngine=Off | |||
/wp-admin/post.php | |||
inventorymanagement.com | |||
<h1> RPM</h1> | |||
[[User:Admin|Admin]]Rpm src packages go here | |||
/usr/local/src/ | |||
[[User:Admin|Admin]]remove old kernal srcs | |||
rpm -qa | grep kernel-source | xargs rpm -e | |||
[[User:Admin|Admin]]Rpm remove installed packages | |||
rpm -e --nodeps {package name here} | |||
<h1>Email</h1> | |||
[[User:Admin|Admin]]horde mail update (nothing can be in account of will all get erased) | |||
/usr/local/cpanel/bin/update-horde --force | |||
[[User:Admin|Admin]]To determine mailserver type | |||
/scripts/setupmailserver --current | |||
[[User:Admin|Admin]]count mail in folder | |||
ls | wc -l | |||
[[User:Admin|Admin]]removing mass spam | |||
rm -Rf /home/(user here}/mail/cur* | |||
[[User:Admin|Admin]]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 | |||
<h1>SPAMD</h1> | |||
[[User:Admin|Admin]]SPAMD failing | |||
/scripts/perlinstaller Digest::SHA1 | |||
/scripts/perlinstaller --force Mail::SpamAssassin | |||
/etc/rc.d/init.d/exim restart | |||
/scripts/restartsrv spamd | |||
<h1>EXIM</h1> | |||
[[User:Admin|Admin]]number of msg in q | |||
exim -bpc | |||
[[User:Admin|Admin]]print msg q summary | |||
exim -bp | exiqsumm | |||
[[User:Admin|Admin]]start a full q run | |||
exim -q -v | |||
[[User:Admin|Admin]]start a local delivery q run | |||
exim -ql -v | |||
[[User:Admin|Admin]]flush exim queue | |||
exim -bpr | awk {'print $3'} | xargs exim -Mrm |
Revision as of 18:56, 29 March 2010
This is my wiki, containing all of my shortcuts.
System specs
tells the system bit
uname -a
What linux version and release
cat /etc/redhat-release
VPS parent sudo rights
sudo su
OwnerShip
Tell what group number owner is
cat /etc/passwd | grep nobody
Group
add user to group
useradd -G {group-name} username
Permissions
find 777 folders
find /home -perm 0777 -type d -print
Disable root login
useradd lwstaff passwd (assign a password) useradd -G wheel lwstaff vim /etc/ssh/sshd_config change PermitRootLogin to no and uncomment it. restart sshd and test your work.
LIST
Adminlist by last mmodified ls -lt
Adminlist by Proc id lsof -p PID
VI commands
Adminadd line numbers
- set number
Adminremove line numbers
- set nonumber
ModRewrite
Adminredirect 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]
MODSEC
AdminRemove specified directory from modsec SecRule REQUEST_URI "URI goes here" phase:1,nolog,allow,ctl:ruleEngine=Off Adminadd to this file and restart vi /usr/local/apache/conf/modsec2/whitelist.conf /etc/init.d/httpd restart /etc/init.d/apf restart
AdminRemove a whole domain SecRule SERVER_NAME "handymanreality.com" phase:1,nolog,allow,ctl:ruleEngine=Off
/wp-admin/post.php
inventorymanagement.com
RPM
AdminRpm src packages go here /usr/local/src/
Adminremove old kernal srcs rpm -qa | grep kernel-source | xargs rpm -e
AdminRpm remove installed packages rpm -e --nodeps {package name here}
Adminhorde mail update (nothing can be in account of will all get erased) /usr/local/cpanel/bin/update-horde --force
AdminTo determine mailserver type /scripts/setupmailserver --current
Admincount mail in folder ls | wc -l
Adminremoving mass spam rm -Rf /home/(user here}/mail/cur*
Adminspam 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
SPAMD
AdminSPAMD failing /scripts/perlinstaller Digest::SHA1 /scripts/perlinstaller --force Mail::SpamAssassin /etc/rc.d/init.d/exim restart /scripts/restartsrv spamd
EXIM
Adminnumber of msg in q exim -bpc
Adminprint msg q summary exim -bp | exiqsumm
Adminstart a full q run exim -q -v
Adminstart a local delivery q run exim -ql -v
Adminflush exim queue exim -bpr | awk {'print $3'} | xargs exim -Mrm