Solution List

By admin

Copyrigth © Denis
*************************************************************************************
## Photo cropper \ resizer bash
for f in *.jpg; do convert "$f" -resize 533×357 -strip -quality 100 "$f"; done
*************************************************************************************
##Super rewrire rule for root direcotry
RewriteCond %{REQUEST_URI} !^/StartPageRebelScum/
RewriteRule ^(.*)$ /StartPageRebelScum/$1 [L,R=301]
*************************************************************************************
## Can't access to File Manager(Windows Server IIS)
1)Remove .securety file from /inetpub/vhost/dom_name
2)Run CMD
3)"%plesk_bin%\websrvmng" –remove-vhost –vhost-name=domainname
"%plesk_bin%\websrvmng" –install-vhost –vhost-name=domainname
or
"%plesk_bin%\websrvmng.exe" –reconfigure-vhost –vhost-name=domainname
or
[v] in chekbox of plesk => check persmissions on problems domain.

Check if ussue fixed
*************************************************************************************
## Viewing sign "????" instead of letters(WINDOWS SERVER)

1)Going to Conrol Panel
2)Region and Language
3)Change Administrative =>locaеtion to Hebrew Israel
Restarting Server
*************************************************************************************
## Enabling PHP Error's viewing

1)Creating .htaccess in htppdocs
2)Pasting — php_flag display_errors on
Saving file
*************************************************************************************
## Horde login failed
Edit php.ini(/etc/php5/apache2/php.ini)
; Initialize session on request startup.
session.auto_start = 0
restart httpd (/etc/init.d/httpd restart)
*************************************************************************************

##Error: Unable to remove client: mailmng failed: Some errors occured. See log for details

mkdir /root/back
cp -a /usr/local/psa/handlers/before-* /root/back/
cp -a /usr/local/psa/handlers/info /root/back/

@Then, delete all the email handlers:

rm -rf /usr/local/psa/handlers/before-*/*
rm -rf /usr/local/psa/handlers/info/*

@Run utility mchk to recreate mail handlers by the below command:

/usr/local/psa/admin/sbin/mchk –with-spam

@Then, Start the mail service after the reconfiguration is completed by the below command.

/usr/local/psa/admin/sbin/mailmng –start-service
*************************************************************************************
##Can't editing files via FTP

AllowOverwrite on

*************************************************************************************
##Turn off Display Errors PHP (Invisible for client)
/conf/vhost.conf

php_flag display_errors off

*************************************************************************************
##Change PTR Record
1)cd cd /var/named/reverse/
2)Choose accord IP
3)Change PTR(58 IN PTR mail.maxdeal.co.il.)
*************************************************************************************
##This command will allow you to reconfigure your vhost.conf file for a domain.
/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=domain.com
*************************************************************************************
##Delete blanks spaces
sed '/^$/d'
*************************************************************************************
##Recalculating Wrong Disk Space
1)run following: LINUX:
# /usr/local/psa/admin/plib/api-cli/maillist.php –update-service domain.tld -status enabled
# /usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=domain.tld
2)Windows:
cd %plesk_bin%
statistics.exe –http-web-statistics –process-domains=domain.tld
*************************************************************************************
##Prefix WWW,if restoring defaults doesn't help
/usr/local/psa/admin/sbin/httpdmng –reconfigure-domain domain.com
*************************************************************************************
##Change TTL for domain
ssh root@80.244.162.30
/var/named/zone/…domain…
*************************************************************************************
##Unable to delete logrotate config: logrot_mng failed: Execute websrvmng –update-log-rotation(Cannot remove domain)
1)cmd=>"%plesk_bin%\dbclient.exe" –direct-sql –sql="select * from domains"
2)"%plesk_bin%\dbclient.exe" –direct-sql –sql="DELETE FROM domains where id=XX"
3)Check Mail Enable PostOffice stat
*************************************************************************************
##TCFFLOW uses
tcpflow -c -s -i eth1| grep Host:
*************************************************************************************
##Find email password Linux Plesk
1)/usr/local/psa/admin/sbin/mail_auth_view
2)mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -e"select m.mail_name, d.name, a.type, a.password from domains d, mail m, accounts a where m.dom_id = d.id and m.account_id = a.id"
*************************************************************************************
##Agressive nmap scanning
sudo nmap -sS -p- -PS80,22 -n -T4 -vvv –reason
*************************************************************************************
##Windows reconfigure domain
"%plesk_bin%\websrvmng.exe" –reconfigure-vhost –vhost-name=

repair.exe –reconfigure-web-site -web-site-name   – Plesk 11>
*************************************************************************************
##View all FTP && Accounts passwords
SELECT REPLACE(sys_users.home,'/home/httpd/vhosts/','') AS domain, sys_users.login,accounts.password FROM sys_users LEFT JOIN accounts on sys_users.account_id=accounts.id ORDER BY sys_users.home ASC;
*************************************************************************************
## Cpanel check brutforced IP
mysql
mysql> use cphulkd;
mysql>BACKUP TABLE `brutes` TO '/path/to/backup/directory';
mysql> SELECT * FROM `brutes` WHERE `IP`='xxx.xxx.xxx.xxx';
mysql> DELETE FROM `brutes` WHERE `IP`='xxx.xxx.xxx.xxx';
mysql>quit
*************************************************************************************
## FTP error :530 User xxxxx cannot log in, home directory inaccessible.
"%plesk_bin%\ftpmng.exe" –remove-vhost –vhost-name=yourdomain.com
"%plesk_bin%\ftpmng.exe" –reconfigure-vhost –vhost-name=yourdomain.com
*************************************************************************************
## Total cleaning all messages in queue
/var/qmail/qmHandle -D
find /var/qmail/queue/mess -type f -exec rm {} \;
/var/qmail/bin/qmail-qread
/var/qmail/bin/qmail-qstat
*************************************************************************************
Snort ssh
ssh root@10.0.0.243
*************************************************************************************
ps axf | grep apache2
17832 ? Ss 0:07 /usr/sbin/apache2 -k start

ls /proc/17832/fd/ |wc -l
1041

mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "replace into misc (param,val) values ('apache_pipelog', 'true');"
/usr/local/psa/admin/sbin/websrvmng -v -a

ps axf | grep apache2
5856 ? Ss 0:00 /usr/sbin/apache2 -k start

ls /proc/5856/fd/ |wc -l
386
*************************************************************************************
Find specify string into file and show full path to file:
find /var/www/vhosts/* | xargs grep 'string' -sl
*************************************************************************************
Find specify string into file and remove it by replacing
for a in $(cat htal); do grep -v "STRING" $a > temp && mv temp $a; done
*************************************************************************************
Bad postoffice email
Windows plesk "%plesk_bin%\mchk.exe" –domain –domain-name=domain.tld
Linux plesk /usr/local/psa/admin/sbin/mchk –with-spam
*************************************************************************************
Clear Mail Queue
/usr/local/psa/admin/sbin/mailqueuemng –help
*************************************************************************************
Restroe DB MYSQL
zcat DB_dbname.gz|mysql -uadmin -p dbname
*************************************************************************************
Mysql dump insert
cat dbbackup | mysql -uadmin -p`cat /etc/psa/.psa.shadow` dbname

*************************************************************************************
Mysql dump insert Windows
C:\Parallels\Plesk\MySQL\bin>mysql -uadmin -p dbname < c:\dump.sql
*************************************************************************************
Calculate disk usage for each mail box in domain
du -sk /var/qmail/mailnames/domainame.com/* | sort -nr | awk '{ print $2 }' | while read f ; do du -sh "$f" | awk -F /var/qmail/mailnames/domainame.com/ '{ print $1, "\t", $2 }' ; done

*************************************************************************************

tcpflow listen to Mail Traffic && HTTP requests

tcpflow -c -s -i eth1 port 25

tcpflow -p -c -i venet0:0 port 80 | grep -oE '(GET|POST|HEAD) .* HTTP/1.[01]|Host: .*'

*************************************************************************************

Add route

sudo route add -net 10.10.10.0/24 gw 10.0.0.168
*************************************************************************************

Find the most recently modified file

find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort
*************************************************************************************

Remove a pattern from the string

echo log.log.ss | sed -e 's/[“.ss”]*$//g'   =>> log.log

*************************************************************************************

 

*