September 18, 2009 | Posted by
admin | Category: Linux Administration
How to Password Protect a Directory using .htaccess?
You may need to password protect a directory in order to limit the sharing of files under it OR may need to protect a private area. You can password protect a directory using a .htaccess file which has to be placed under a directory which needs to be protected.
Create a .htaccess file
vi /home/username/.htaccess
Once created, add the following lines to it:
AuthUserFile /home/username/.htpasswd
AuthName “Private Area”
AuthType Basic
require valid-user
where, ‘username’ is the actual username of your domain. Now, create a .htpasswd file under the /home/username/ directory.
vi /home/username/.htpasswd
In order to grant access to the directory for specific users, you need to place all the users along with their passwords in the below format:
username1:encryptedpassword
username2:encryptedpassword
There is no limit in adding users to this file, just make sure each user should be on a separate line and you can encrypt passwords using any available tool on the internet.
Comments Off on Howto: Password Protect a directory using .htaccess
September 18, 2009 | Posted by
admin | Category: Plesk Management
How to configure alternate SMTP port OR change the SMTP port on a Plesk server?
Sometimes some ISPs block port 25 for security reasons in which case, you need to open an alternate SMTP port on your server for your clients. Plesk do not offer a straight forward method of configuring an alternate SMTP port, instead you have to configure it manually.
SMTP on Plesk servers runs under xinetd service and the location of the file is /etc/xinetd.d/smtp_psa.
In order to configure an alternate port say for example 2525, follow the below steps:
1. Make a copy of file “smtp_psa” under the /etc/xinetd.d/ directory
# cp -p smtp_psa smtp_psa_new
2. Edit the smtp_psa_new file and replace the line
service smtp
with
service smtp_new
3. You now need to edit the /etc/services file and make sure the lines with port 2525 should look as follows:
smtp_new 2525/tcp #alternate SMTP port
smtp_new 2525/udp #alternate SMTP port
4. Save the file and restart the xinetd service.
# /etc/init.d/xinetd restart
SMTP service will now listen on port 2525 as well which you can verify using the ‘telnet’ command:
# telnet yourserverip 2525
Comments Off on HowTo: configure an alternate SMTP port in Plesk
September 17, 2009 | Posted by
admin | Category: cPanel Management
semget: [emerg] (28) No space left on device OR Apache: No space left on device: Couldn’t create accept lock
You may receive “No space left on device” message while starting the Apache service, however, it has nothing to do with the disk space. The reason behind the error message is Semaphores.
You will have to kill the active semaphore processes in order to start Apache service successfully. To list the PIDs of the active semaphore processes, execute:
# ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0x00000000 366673220 apache 600 1
0x00000000 366706589 apache 600 1
0x00000000 366732358 apache 600 1
0x00000000 366734353 apache 600 1
It will list all the PIDs which need to be killed:
# ipcrm -s PID
If you have a long list of processes, execute the following commands:
# ipcs -s | grep apache | awk ' { print $2 } ' | xargs ipcrm sem
Replace ”apache’ in the above command with the actual “owner” of the processes returned in the “ipcs -s” command. Apache will start successfully once these processes are killed.
What is a Semaphore?
Semaphores are use to communicate between active processes. Apache write down some information of such processes before the communication actually begins and if Apache fails to write the information, it results in the “No space left on device: Couldn’t create accept lock” error message.
Comments Off on Apache: [emerg] (28)No space left on device: Couldn’t create accept lock
September 15, 2009 | Posted by
admin | Category: cPanel Management
You suddenly realize that the emails on your server are not working and the mail logs shows the following messages:
1MnfEt-0007pQ-Tn == xyz@abc.com R=defer_router defer (-1): All deliveries are handled by MailScanner
1MnfBw-00037y-9h == abc@xyz.com R=defer_router defer (-1): All deliveries are handled by MailScanner
This mostly happens when Mailscanner is not working properly as all deliveries are handled by MailScanner. To fix the issue, restart your mail service first i.e.
service exim restart
then, start the Mailscanner executing the following command:
/usr/mailscanner/bin/check_mailscanner
If it displays any PIDs, kill them and execute the command again. This will start your MTA and MailScanner which will make sure your emails start working again.
Comments Off on defer_router defer (-1): All deliveries are handled by MailScanner
September 15, 2009 | Posted by
admin | Category: cPanel Management
You may receive a bounce back message saying “Message size exceeds maximum permitted” on sending an email greater than the size defined in the exim configuration. On a cPanel server, the message size limit is 50MB by default.
In order to raise the message size limit, you need to edit the exim configuration file either manually located at /etc/exim.conf OR from WHM >> Exim Configuration Editor > Advanced Mode and at the very start of the file, add the following line:
message_size_limit = 100
Save the file and restart the exim service.
# service exim restart
This will increase the message size to 100MB. You can verify the new size by executing the following command:
# exim -bP | grep message_size_limit
Comments Off on How to increase mail size in exim?