Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Sasha http://nothing-less.net

« Newer Snippets
Older Snippets »
19 total  XML / RSS feed 

RARing files on Mac OSX 10.4

1) Download the application called RAR at

http://files3.rarlab.com/rar/rarosx-3.5.1.tar.gz

2) decompress that file and there'll be a folder called "rar".

3) in that folder there's a file called "rar" (with no quotes or extension)

4) In Finder, go to Go > Go To Folder, and type in "/bin".

5) drag the FILE called "rar" in to that bin folder. It will ask you for your password, so go type it in and continue.

6) open the terminal and go to the directory that has the file or files you want to rar.

7A) once in the folder housing the files you want to rar, type this:

rar a FileName.rar


7B) Alternatively, you can specify which file or folder inside the folder you're in, you want to rar:

rar a FileName.rar originalfilename.whatever


8) to make a multi file rar archive, type the following instead of the above and replace where you see "####" with the file size you want each part to be, in kilobytes (kb).

rar a -v#### FileName.rar originalfilename.whatever


Search for terms in Domlogs

for files in /usr/local/apache/domlogs/*; do grep "wget" $files; done;


-OR-

cd /usr/local/apache/domlogs
grep wget *
grep lynx *
grep curl *


Replace wget with other file names/terms you might want to search for.

If that takes too long, try doing it one by one:

grep wget a*
grep wget b*
grep wget c*
grep wget d*
grep wget e*
grep wget f*
grep wget g*
grep wget h*
grep wget i*
grep wget j*
grep wget k*
grep wget l*
grep wget m*
grep wget n*
grep wget o*
grep wget p*
grep wget q*
grep wget r*
grep wget s*
grep wget t*
grep wget v*
grep wget w*
grep wget x*
grep wget y*
grep wget z*


Alternatively, if you get an error like "Argument list too long":

for i in `ls /usr/local/apache/domlogs|grep -v 'bytes_log'`; do echo "checking on $i" && grep wget /usr/local/apache/domlogs/$i && grep lynx /usr/local/apache/domlogs/$i && grep curl /usr/local/apache/domlogs/$i; done > /root/grep-domlogs-results.txt
Then simply take a look at this file /root/grep-domlogs-results.txt

Looking up recent dictionary attacks

grep "dictionary attack" /var/log/exim_mainlog

Looking into DOS and DDOS Attacks

http://etechsupport.net/forum/showthread.php?t=434

top -d2
netstat -nap | grep SYN | wc -l
netstat -nap | less


If there are many httpd processes showing up after step 1, you might be under attack. If you get high numbers for the second one, you are almost definitely under attack. Use the third one to see the IP addresses, and then ban them from the server:

iptables -A INPUT -s ip.address -j DROP


Also try the following for fixing stuff:
cd /dev/shm
ls


And delete anything that's not supposed to be there.

locate bindz
locate botnet.txt
locate dc
locate ex0.pl
locate kaiten
locate r0nin
locate udp.pl
locate ...
lsof | grep .,
locate mybot

Ban IPs from a server

iptables -A INPUT -s ip.address -j DROP

How to tail logs

tail -200 /var/log/exim_mainlog
tail -200 /usr/local/apache/logs/error_log


To watch the log get updated in real time:
tail -f /var/log/messages 

Sims 2 File Limit Fix

sudo sysctl -w kern.maxfiles=22000
sudo sysctl -w kern.maxfilesperproc=20000


Type this into Terminal in Mac OSX to fix the file size limit for The Sims 2, allowing you to have more than 5000 downloads.

How To Manually Update Cpanel

/scripts/upcp

/scripts/upcp --force

How To Restart Services

Restart Apache:
service httpd restart


Restart Services:
service chkservd restart


Restart Cpanel:
/etc/init.d/cpanel restart


Restart Bind:
service named start


Run anything in /scripts:
./scriptname

How To Locate Files

lsof | grep searchterm

How To Fix Bandwidth Updating

If bandwidth stats aren't updating:

/scripts/runweblogs username
/scripts/runlogsnow

How To Fix 403 Errors for public_html

If all the public_html folders got their permissions wrong:

chmod 755 /home/*/public_html

How To Empty /var

If /var is too full:

cd /var
du -sh *


If the log directory is the problem:

rm -f /var/log/*.1
rm -f /var/log/*.2
rm -f /var/log/*.3
rm -f /var/log/*.4


(The /var/log directory contains archived files that always end with a number: exim_mainlog.1. Any file ending with a number can be safely deleted.)

If the problem is with the exim_mainlog being too large, try rotating the logs:

/usr/sbin/logrotate -vf /etc/logrotate.conf


If you get an error about a duplicate log entry:

cd /etc/logrotate.d
rm -rf httpd.rpmorig.log


And try the rotate again.

If the problem is in spool:

cd /var/spool/exim/msglog
rm -rf *

How To Empty /usr

cd /usr/local/apache/domlogs/
rm -rf *.*
/scripts/restartsrv httpd

How To Empty /backup

If /backup/ is too full:

cd /backup/cpbackup/monthly/
rm -f *.gz
/scripts/restartsrv httpd


Check the space after this, and it should be fine.

How To Fix Incorrect Disk Space

/scripts/fixquotas
/scripts/updatemysqlquota

How To Turn Off/On Stats For One Account

http://forums.cpanel.net/showthread.php?t=15967&highlight=urchin

You can edit the:

pico /var/cpane/users/accountname


file and add settings for the stats packages.

skipanalog=1
skipawstats=1
skipwebalizer=1


That will turn them off and override the server setttings.

To update the stats now:

/scripts/runweblogs username
/scripts/runlogsnow

How To Fix Fantastico SourceGuardian Error

http://netenberg.com/forum/viewtopic.php?t=1937
http://www.netenberg.com/forum/viewtopic.php?t=2480

Please make sure to select "Sourceguardian" in WHM -> Tweak Settings (section "Software"). If that doesn't work:

pico /usr/local/cpanel/3rdparty/etc/php.ini


change:
extension_dir = ./ ;

to
extension_dir = ;


and
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

to
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
extension="/usr/local/cpanel/3rdparty/etc/ixed/ixed.lin.4.3.10.pxp"
;;;;;;;;;;;;;;;;;;;;;; 

How To Fix MySQL Error 28

MySQL: 1030: got error 28 from server handler

cd /tmp
df -i /tmp
df -h /tmp


Delete anything that�s not supposed to be there.
Stop all databases:

/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/mysql stop


Then fix tables:

cd /var/lib/mysql


Check each letter for errors:

myisamchk -cs a*/*.MYI


Repair where necessary:

myisamchk -r a*/*.MYI
myisamchk -r b*/*.MYI
myisamchk -r c*/*.MYI
myisamchk -r d*/*.MYI
myisamchk -r e*/*.MYI
myisamchk -r f*/*.MYI
myisamchk -r g*/*.MYI
myisamchk -r h*/*.MYI
myisamchk -r i*/*.MYI
myisamchk -r j*/*.MYI
myisamchk -r k*/*.MYI
myisamchk -r l*/*.MYI
myisamchk -r m*/*.MYI
myisamchk -r n*/*.MYI
myisamchk -r o*/*.MYI
myisamchk -r p*/*.MYI
myisamchk -r q*/*.MYI
myisamchk -r r*/*.MYI
myisamchk -r s*/*.MYI
myisamchk -r t*/*.MYI
myisamchk -r u*/*.MYI
myisamchk -r v*/*.MYI
myisamchk -r w*/*.MYI
myisamchk -r x*/*.MYI
myisamchk -r y*/*.MYI
myisamchk -r z*/*.MYI


Turn everything back on:

/etc/rc.d/init.d/chkservd start
/etc/rc.d/init.d/mysql start
« Newer Snippets
Older Snippets »
19 total  XML / RSS feed