Plesk Tips and Tricks
From KoshWiki
From wiki.voidnet.us (gone) and Kneecapped.Org - Plesk-Wiki More Useful Tips at Racker Hacker
Server Wide Find & Replaces
If you have migrated and have issues or a symlink just wont work you can do some quick and easy server wide text replaces with the following
find -name 'vhost.conf' -print0 | xargs -0 perl -pi -e 's/home/var/g'
Plesk Logsweb
/usr/local/psa/admin/logs
mail/ftp xfer
/usr/local/psa/var/log/
Plesk FTP USER
I have included below the instructions for adding system FTP user account's. First you will need to add the user, to do so simply issue the following command(s) as root:
useradd -s /bin/false johndoe -d /home/johndoe
The -s /bin/false portion ensures this user can only ftp into the system and has no shell access. The -d /home/johndoe portion indicates that this users home directory should /home/johndoe. If you also want to restrict johndoe to his directory you should use the following command below instead:
useradd -s /bin/false -G psacln johndoe -d /home/johndoe
The -G psacln switch automatically add's the johndoe user to the psacln group, any user account's that are part of that group automatically get restricted to their home directory.
After adding the user you simply need to setup a password for them using the following command:
passwd johndoe
Qmail
qmail turn off reverse lookups.
-Rt0 flag the to the beginning of the server_args line in the /etc/xinet.d/smtp_psa
Install new Plesk license
download correct license from ftp.rackspace.com
# /etc/init.d/psa stop mysql -u admin -p'cat /etc/psa/.psa.shadow' psa mysql> truncate key_history; mysql> truncate key_history_params; mysql> exit # rpm -e --nodeps psa-key-custom # rpm -Uvh plesk7.5_100_spamassassin (or correct license) # /etc/init.d/psa start
Qmail voodoo
(where spamblackhole is the domain or subject)
/var/qmail/bin/qmail-qread | grep -B1 spamblackhole |grep GMT| awk '{print $6}' | sed s/^#/-d/ > /home/rack/delete
Plesk FrontPage fixup
(from httpdocs dir)disable frontpage in plesk
# find . -name .htaccess -type f | xargs rm -rf # find . -name '_vti*' -type d | xargs rm -rf # find . -name '_private' -type d | xargs rm -rf
enable and reset password in plesk
Change TTLs in Plesk
update the misc table to the value:
mysql> update misc set val='86400' where param='SOA_TTL';
update the zone records:
mysql -Ns -uadmin -p'cat /etc/psa/.psa.shadow' -D psa -e 'select name from domains' | \
awk '{print /usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh
Plesk user passwords
mysql> select domains.name,domains.id,mail.mail_name,accounts.password from domains,mail,accounts where domains.id=mail.dom_id and accounts.id=mail.account_id and accounts.password='password';
Plesk FTP users
mysql -uadmin -p'cat /etc/psa/.psa.shadow' psa -e "SELECT domains.name, sys_users.login, accounts.password FROM hosting, domains, sys_users, accounts WHERE hosting.dom_id = domains.id AND hosting.sys_user_id = sys_users.id AND sys_users.account_id = accounts.id ORDER BY domains.name;"
Upgrade to PHP5 on Plesk 8.1
# rpm -e 'rpm -qa | grep -i sitebuilder' # rpm -e php-sqlite2 sb-publish # rpm -e PPWSE # rpm -e --nodeps php-domxml # rpm -Uvh *.rpm # up2date --configure
Plesk mail mchk
# /usr/local/psa/admin/bin/mchk -v # /usr/local/psa/admin/bin/mchk -v --with-spam
Kill Qmail queue
#!/bin/sh
# remove everything - STOP QMAIL FIRST!
/sbin/service qmail stop
for i in bounce info intd local mess remote todo;
do find /var/qmail/queue/$i -type f -exec rm {} \;
done
/sbin/service qmail start
Plesk5 websrvmng
(sort of)
/usr/local/psa/admin/bin/my_apci_rst -v
Plesk UserDirs in 8+
Just create the file /etc/httpd/conf.d/userdir.conf and add in the following contents:
<VirtualHost the.primar.ip.address:80> ServerName default UseCanonicalName Off DocumentRoot /var/www/vhosts/default/htdocs serDir httpdocs ScriptAlias /cgi-bin/ "/var/www/vhosts/default/cgi-bin/" <Directory "/var/www/vhosts/"> <IfModule sapi_apache2.c> php_admin_flag engine on </IfModule> Options +Includes +ExecCGI </Directory> <Directory "/home/httpd/vhosts/"> <IfModule sapi_apache2.c> php_admin_flag engine on </IfModule> Options +Includes +ExecCGI </Directory> </VirtualHost>
More fun with qmail
/var/qmail/bin/qmail-qread | grep "somethin@yourdomain.com" | \
awk '{print $6}' | sed 's/^/-d/g' | sed 's/#//g' > /home/rack/rmspam.sh
then just:
qmHandle 'cat rmspam.sh'
Plesk SPAM
Add spell checking to Horde
You need to ADD the following line to /usr/share/psa-horde/imp/config/conf.php
$conf['utils']['spellchecker'] = 'aspell';
Lower TTLs in Plesk
insert into misc values ('soa_TTL','300');
mysql -Ns -uadmin -p'cat /etc/psa/.psa.shadow' -D psa -e 'select name from domains' |
awk '{print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh
