A great linux stuff website

Monthly Archives: January 2013

If you get the following error sending emails in Squirrelmail:

SMTP Error Code:

Requested action not taken: mailbox unavailable
Server replied: 550 Verification failed for
Unrouteable address
Sender verify failed

It can be fix it simply by going into the OPTIONS -> Personal Information area and updating correct name and email address, it should be fix the issue.


Message not sent. Server replied: Connection refused 111 Can’t open SMTP stream.

This can be the solutions for the above error you are getting :
> Cpanel version of SquirrelMail does not work.

1) Check the config for Squirrelmail:

/usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

*—————————–*
I just changed:
$useSendmail = false;
*—————————–*

Changed To:

*—————————–*
$useSendmail = true;
*—————————–*

2)Enabling the SMTP tweak option:
It is likely related to an iptables rule used to deny connections from those other than exim, mailman and root. Turning the SMTP Tweak on and then off should recreate this rule correctly.
Quote:
Main >> Security Center >> SMTP Tweak
3) Editing the CSF conf:

# Block outgoing SMTP except for root, exim and mailman (forces scripts/users
# to use the exim/sendmail binary instead of sockets access). This replaces the
# protection as WHM > Tweak Settings > SMTP Tweaks. This will block hosting
# clients from using your server as an SMTP relay

SMTP_BLOCK = 1

# If SMTP_BLOCK is enabled but you want to allow local connections to port 25
# on the server (e.g. for web scripts) then enable this option too
SMTP_ALLOWLOCAL = 1
Out of these three , one will work for sure.


You can generate a csr through the shell using the following command:
root@mylinux[/]# /scripts/gencsr
NOTE: You must have a Dedicated Hosting, Cloud Hosting or Cheap VPS Hosting to go about making changes using SSH.
This will ask you all the information like email address, domain name, country code, City, Company etc; fill the values and it generates a csr certificate and a private key.Use the following steps to install an ssl certificate:

Please check the domain name for which the ssl certificate is issued means http://www.domainname.com or domainname.com. Suppose you have to install an ssl certificate for domainname.com. You already generate csr for the domainname.com. Check following steps.

1)
Go to directory /usr/share/ssl/certs

root@mylinux[/]# cd /usr/share/ssl/certs

Please check domainname.com.csr file is present already.

root@mylinux[/usr/share/ssl/certs]# ls –l | grep domainname.com.csr

Create the .crt file and paste the ssl certificate into a .crt file as per below

root@mylinux [/usr/share/ssl/certs]# vi domainname.com.crt

paste ssl certificate
save the file.

If cabundle is provided by the client then add it in the domainname.com.cabundle file under the directory /usr/share/ssl/certs

root@server1 [/usr/share/ssl/certs]# vi domainname.com.cabundle

paste the cabundle key and save the file.

2)

Go to directory /usr/share/ssl/private and check to see if the file domainname.com.key is already present.

root@mylinux[/]# cd /usr/share/ssl/private
root@mylinux[/usr/share/ssl/private]# ls –l | grep domainname.com.key

3)
Go to the file /etc/httpd/conf/httpd.conf and copy the virtual host entry for the domainname.com in notepad and add the following line above the end of the tag

SSLEnable
SSLCertificateFile /usr/share/ssl/certs/domainname.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/domainname.com.key
SSLCACertificateFile /usr/share/ssl/certs/domainname.com.cabundle
SSLLogFile /usr/local/apache/domlogs/shop.discdudes.com-ssl_data_log
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown

Add the following line above the virtual host entry.

add the following line at the end of the virtualhost tag.

Now your sslVH entry should look like as per below. Please check the sample sslVH entry.

ServerAlias domainname.com
ServerAdmin webmaster@domainname.com
DocumentRoot /home/username/public_html
BytesLog domlogs/domainname.com-bytes_log
ServerName domainname.com

User username
Group username

CustomLog /usr/local/apache/domlogs/domainname.com combined
ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/

SSLEnable
SSLCertificateFile /usr/share/ssl/certs/domainname.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/domainname.com.key
SSLCACertificateFile /usr/share/ssl/certs/domainname.com.cabundle
SSLLogFile /usr/local/apache/domlogs/shop.discdudes.com-ssl_data_log
SetEnvIf User-Agent “.*MSIE.*” nokeepalive ssl-unclean-shutdown

4)
If cabundle is not given by the client then remove the following line from the sslVH entry

SSLCACertificateFile /usr/share/ssl/certs/domainname.com.cabundle

5)
Add the sslVH entry in httpd.conf file and restart the httpd service.

Now you are able to access site https://domainname.com

Please check the file paths are correctly specified for .crt, .key and .cabundle file. If the file paths are incorrect in the sslVH entry then the httpd service won’t started.


On a Linux VPS with cPanel you may be alerts along the lines of the following:

Time:
Account:
Resource: Virtual Memory Size
Exceeded: 418 > 200 (MB)
Executable: /usr/bin/php
Command Line: /usr/bin/php /home/your_site/public_html/index.php
PID:
Killed: No

This alert is an informational message. How you deal with these are a matter of personal preference and needs of your organization.

There is a daemon on your VPS, the lfd daemon, that will monitor processes and if a process’ memory usage exceeds a defined threshold (in this case of the example above, 200MB), it sends an alert. That is all that is happening here. The server has no way of knowing if this is expected behavior or not, so it just sends an alert so the owner can decide whether to investigate.

So, if the threshold is set to 200MB and a script or process uses more than 200MB memory, you will get an alert containing the name of the script, the time it occurred, and the amount of memory that it is consuming.

Here are some options you may want to consider for how to deal with these. This is not an exhaustive list but should give a good starting point.

The first option is to do nothing. When you get the alerts, glance at them and see what script or process is triggering the alert. If your VPS is running particularly sluggish and you are getting alerts about a PHP script consuming large amounts of RAM, you can consider killing the script to return the server to normal responsiveness. Likewise, if you write some script and start getting alerts about the amount of RAM it is consuming, that might be a heads up to you that your script has problems.
Increase the memory threshold for the alerts from 200MB to say 300MB. That will allow scripts and processes to consume more RAM before they trigger the alert. If you want to increase it much higher than 300MB, then you might be better off just turning this feature off alltogether (see the next option).
Turn off this feature entirely. If you are not interested in knowing when a process exceeds a defined threshold, then there is no need to get the alert and it can be turned off.

To change the threshold that LFD alerts on:

Log into WHM of your VPS at https://:2087 with the root account.
Go to ConfigServer Security&Firewall –> Firewall Configuration
Change the value for PT_USERMEM to the threshold you want to report on.

To turn off this feature, set the PT_USERMEM paramter to


Following are the commands to open TCP or UDP ports on the server.

To Verify the avalaible port on server use below command
# netstat -nap | grep : port no

E.g to open port 25

open TCP/UDP port 25
# iptables -A INPUT -p tcp –dport 25 -j ACCEPT
# iptables -A INPUT -p udp –sport 25 -j ACCEPT

# service iptables save

and for flushhing iptables us

# iptables -F

# iptables -A INPUT -s 111.xx.ss.111 -j DROP

o/p 111.xx.ss.111

# iptables -L

# service iptables save
# /etc/init.d/iptables save


Error: Unable to fetch the cPanel user file

If you getting the error “Unable to fetch the cPanel user file ” while modifying account through WHM >> Modify Account then in order to get this issue resolved follow the steps:

Log in to your server root (SSH) and check the following:

# cd /var/cpanel/users
# ls -lah username
-rw-r—– 1 root username 596 jan 8 14:03 username
# vi username

Here replace username with the cPanel username. The correct permissions on the file should look like the following

If the permissions are correct then check inside the file, the USER=username entry should have the username of that user. Some 3rd party plugins modify the username by appending .sometext to the end of the username. This can cause cPanel to be unable to read the user’s file.

Then run the cPanel command
# /script/updateuserdomain


While login to an account’s cpanel as reseller, there should be a drop down box to switch to the cpanel of various accounts under that reseller.
If it is not available there, you can check the following things.

1) Login In WHM -> Tweak Settings -> make sure the following option is not checked.

2) Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature.

3) Formerly, the problem can be with only one or two domains. All account’s cpanel may be chekcing the drop down, but when you enter into one the drop down just empty.

4) An instance, it could be a problem with cPanel account password. Try to resetting the password of that account and check if this resolve the issue.


In WHM/cpanel server the domain was suspended it was unsuspended again from the WHM>> Main >> Account Functions >> Suspend/Unsuspend
But while checking account/domain from browser still showing suspended page? (cleared browser cache and also checked from antoher machine/network)

Note: account is not listed with suspended accounts in WHM so I suspend it again and unsuspend it but the same issue.
To activate this account manually?
1. Please check the .htaccess file under your public_html directory and remove the first line redirecting to the suspended page file.

2. # /scripts/unsuspendacct username


From webmail Message not sent. Server replied:

Requested action aborted: error in processing
451 Temporary local problem – please try later

1. Login your server with SSH
# vi /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

in this configuration file search $useSendmail = false; and replace false to true

Then restart exim and courier-imap
#/etc/init.d/exim restart
#/etc/init.d/courier-imap restart


Apache >> /usr/local/apache
1) bin- apache binaries are stored here – httpd, apachectl, apxs
2) conf – configuration files – httpd.conf
3) cgi-bin
4) domlogs – domain log files are stored here
5) htdocs
7) include – header files
8) libexec – shared object (.so) files are stored here – libphp4.so,mod_rewrite.so
9) logs – apache logs – access_log, error_log, suexec_log
10) man – apache manual pages
11) proxy –
12) icons –
# /etc/rc.d/init.d/httpd >> apache start script, Init Script :
# /scripts/restartsrv_httpd >> Cpanel script to restart apache –

Exim
# /etc/exim.conf >> exim main configuration file
# /etc/localdomains >>list of domains allowed to relay mail
# /var/log/exim_mainlog >> incoming/outgoing mails are logged here
# /var/log/exim_rejectlog >>exim rejected mails are reported here
# /exim_errors are logged here
# /var/spool/exim/input >> Mail queue:
# /scripts/restartsrv_exim >> Cpanel script to restart exim –
# /etc/valiases/domainname.com >> Email forwarders and catchall address file –
# /etc/vfilters/domainname.com >> Email filters file –
# /home/username/etc/domainname/passwd >> POP user authentication file –
# /home/username/mail/inbox >> catchall inbox
# /home/username/mail/domainname/popusername/inbox >> POP user inbox –
# /home/username/mail/domainname/popusername/spam >> POP user spambox –
# /usr/sbin/exim (suid – -rwsr-xr-x 1 root root ) Program :
# /etc/rc.d/init.d/exim >> Init Script:

ProFTPD >> /usr/sbin/proftpd >> program to installed
# /etc/rc.d/init.d/proftpd >> Init Script
# /etc/proftpd.conf >> Configuraiton file
# /var/log/messages, /var/log/xferlog >> Log file for proftpd
# /etc/proftpd/username >> FTP accounts file >> all ftp accounts for the domain are listed here

Pure-FTPD >> programm >> /usr/sbin/pure-ftpd
# /etc/rc.d/init.d/pure-ftpd >> Init Script
# /etc/pure-ftpd.conf >> Configuraiton file
# /etc/pure-ftpd/ip-address >> Anonymous ftp document root location

Frontpage Extensions >> /usr/local/frontpage/version5.0/bin/owsadm.exe >> Program-Install
Uninstall and then install for re-installations
# _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html >> FP files are found as

Mysql : Program >> /usr/bin/mysql
# /etc/rc.d/init.d/mysql >> Init script
# /etc/my.cnf, /root/.my.cnf >> Configuraiton file
# /var/lib/mysql > Data directory >> Where all databases are stored
# username_dbname >> Database naming convention starting with cPanel username prefix
# – drwx 2 mysql mysql >> Permissions on databases
# /var/lib/mysql/mysql.sock, /tmp/ mysql.sock >> Mysql socket file

SSHD > Program :/usr/local/sbin/sshd
# /etc/rc.d/init.d/sshd >> Init script
# /etc/ssh/sshd_config >> Configuraiton file
# /var/log/messages >> Log files

Perl >> Program :/usr/bin/perl
Directory Location > /usr/lib/perl5/5.6.1/

PHP >> Program location :/usr/local/bin/php, /usr/bin/php
# /usr/local/lib/php.ini – php.ini file >> apache must be restarted after any change to this file
# /scripts/easyapache >> php can be recomplied using

Named(BIND) >> Program: /usr/sbin/named
# /etc/rc.d/init.d/named >> Init Script:
# /etc/named.conf >> Configuraiton file
# /var/named/ >> db records for the domain
# /var/log/messages >> Log files