Linux (49)


Suspend / Unsuspend domain via command line Plesk

To suspend or unsuspend a domain on a Plesk server via the command line, we use the Plesk command line tools. Most are just one liners :) Suspend a Domain Suspend domain via command line Plesk [code]/usr/local/psa/bin/domain -u stuartsdomain.co.uk -status disabled[/code] Unsuspend a Domain Unsuspend domain via command line Plesk [code]/usr/local/psa/bin/domain -u stuartsdomain.co.uk -status enabled[/code]

Read more...



Block IP address from connecting to server using iptables

To block IP address from connecting to server, i use iptables. this morning, i noticed some idiot trying to log into my server over and over, and so a quick iptables line will kick them off (until they change their IP and try again of course). [code] /sbin/iptables -I INPUT -s 74.63.223.222 -j DROP [/code] […]

Read more...



search highlight in vi

  • October 22, 2012
  • vi

I was wondering how to turn off the search highlight in vi as it’s distracting when trying to code through yellow blobs of highlighting. [code]:nohlsearch[/code] and the highlighting disappears. Ideal.

Read more...



repairing a broken postfix on plesk 9

first, stop the mail manager: [code]/usr/local/psa/admin/sbin/mailmng –stop-service[/code] then locate all of the shitty mapped mailbox junk and delete it: [code]find /usr/local/psa/handlers/before-* -type f | while read h ; do [ ! -d /usr/local/psa/handlers/info/$(basename $h) ] && rm -f "$h"  ; done[/code] run mchk to rebuild all of the structure: [code]/usr/local/psa/admin/sbin/mchk –with-spam[/code] and restart the mail […]

Read more...



Get MySQL Passwords from Plesk (bash/command line)

Quick bash script to grep out MySQL passwords from Plesk’s PSA database. Script: [code language=”bash”]#!/bin/bash clear; echo "Searching MySQL user tables for: $1"; echo mysql psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = domains.id AND db_users.db_id = data_bases.id AND db_users.account_id = […]

Read more...



Get Protected Directory Logins from Plesk

Quick bash script to grep out protected directory logins from Plesk’s PSA database. Script: [code language=”bash”]#!/bin/bash clear; you=`who am i | cut -d’ ‘ -f1`; echo -e "Hello $you, looking in the protected dirs password list for \033[33;1m$1\033[0m eh?"; echo mysql psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘select pd.login, a.password, d.name, dirs.path from accounts a, pd_users […]

Read more...



see active connections

to see active connections (ip addresses) connected to port 80: [code] netstat -ntu | grep :80 | grep EST | awk ‘{print $5}’| sed ‘s/::ffff://’ | cut -d: -f1 | sort | uniq -c | sort -rn [/code] easy enough to amend if you need to see which services are being used. more examples to […]

Read more...



Get FTP Passwords from Plesk

Quick bash script to grep out ftp passwords from Plesk’s PSA database. Script: [code language=”bash”]#!/bin/bash clear; echo "Searching the FTP password list for: $1"; echo mysql psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘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’ | grep $1;[/code] Usage: [code gutter=”false”][root@mail bin]# grepftp […]

Read more...



copy files server to server using scp

How to copy files server to server, to copy files from one server to another, you can use scp. scp is secure copy. To copy files from the server you are on, to a remote server: [code] scp the/local/file user@otherserver:/the/path/copiedfile [/code] Or to copy files in from the other server, to your local server: [code] […]

Read more...