Pages

Welcome to My Blog

This is to share my IT experience with friends all around the world.
I have been working in Linux Fedora Systems for more than 8 years. Its fun to share knowledge and learn..
As everyone knows when a problem arises in your systems "googling" is the way that many depend on..

All the posts here are my working experiences during my working life.. So you can count on it..

I have added the references where I got help in solving IT issues


Sunday, August 23, 2020

Verifying BIND releases with isc.org pgpkeys

 When it is required to verify latest releases of bind name server applications, it is required to download the isc.org latest pgp keys from https://ftp.isc.org/isc/pgpkeys/


Then follow the given procedure to verify the integrity of an ISC download using PGP.

 

1. Download the pgp key from the above given location and name the key file as 'KEYS' (Or whatever you want)

2. Download the tar.gz and Signatures file as required

3. Change the directory to the location where all public key, signature key file and tar.gz files are stored.

4. Import the public key using the PGP or GPG import option, e.g.:  gpg --import KEYS

 - Here 'KEYS' is the file which contains the public key downloaded from the key repository 

gpg --import KEYS
gpg: key 4CBB3D38: "Internet Systems Consortium, Inc. (Signing key, 2019-2020) <codesign@isc.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

 

5.   Check the integrity with gpg --verify command 

Ex. 

gpg --verify bind-9.11.22.tar.gz.asc bind-9.11.22.tar.gz
gpg: Signature made 2020-08-12 01:47:02 +0530 +0530 using RSA key ID 5DACE918
gpg: Good signature from "Internet Systems Consortium, Inc. (Signing key, 2019-2020) <codesign@isc.org>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: AE3F AC79 6711 EC59 FC00  7AA4 74BB 6B9A 4CBB 3D38
     Subkey fingerprint: 95CE DA25 6B1C A0A1 5F30  2FB5 9521 A7ED 5DAC E918


Good Reference:

https://kb.isc.org/docs/aa-01225

Monday, July 13, 2020

Getting the table list with sizes in MySQL




We may need to get the table sizes of the tables in a mysql database from the mysql command prompt.

SELECT   TABLE_NAME AS `Table`,   ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 ) AS `Size (KB)` FROM   information_schema.TABLES WHERE   TABLE_SCHEMA = "<database_name>" ORDER BY   (DATA_LENGTH + INDEX_LENGTH) DESC;

Here <database_name> needs to be changed to your database name. Also you can get the sizes in MB or GB by adding /1024 required times. For example, to get the size in MB the code has to be changed as follows;

SELECT   TABLE_NAME AS `Table`,   ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024/1024) AS `Size (MB)` FROM   information_schema.TABLES WHERE   TABLE_SCHEMA = "<database_name>" ORDER BY   (DATA_LENGTH + INDEX_LENGTH) DESC

Good Reference:

https://chartio.com/resources/tutorials/how-to-get-the-size-of-a-table-in-mysql/
 

Monday, August 5, 2019

Dovecot issue in InBOX - CentOS7 Dovecot



I was configuring a mail server in CentOS7 environment with Postfix and Dovecot. When configuring Dovecot to deliver mails to the users, I noticed the following error in the mail log and user was not able to get mails in the INBOX.

dovecot: pop3(<user>@<domain>): namespace configuration error: inbox=yes namespace missing top=0/0, retr=0/0, del=0/0, size=0

According to the reviews, the error was with the name space definitions in /etc/dovecot/conf.d/15-mailboxes.conf where inbox was not enabled. I have added inbox=yes under the namespace inbox{ definition.

Please find the added line in the below content

namespace inbox {
  inbox=yes #This line was added
  # These mailboxes are widely used and could perhaps be created automatically:
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Trash {
    special_use = \Trash
  }


 Good Reference:

https://dwaves.org/2018/08/14/centos7-dovecot-exim-error-user-userdomain-com-initialization-failed-namespace-configuration-error-inboxyes-namespace-missing-error-invalid-user-settings/

Tuesday, December 18, 2018

Mail Status Report for Postfix Mail Service in CentOS7

This is a direct and simple task. We really want to see the details of mail service by analysing the maillog daily. It gives a clear picture of what happened during the time period. The system ppl and marketing ppl may use it for customer clarifications.
We have enabled mail log statistics reporting tools in CentOS 6/7 servers which run Postfix as the mail agent.
Please follow the steps here:

1. Installing mail log analyser

yum install  postfix-perl-scripts

This will install required script with perl modules. Just verify the proper work of it by running the command

perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog

which gives the details of the mail delivery of yesterday.

2. Enable automated reporting
You need to install 'nail' tool to send automated emails. Use this tool to send the output of the above command to required recipients.

e.g
/usr/bin/perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog | /usr/bin/nail -s "Mail status - company mail service `date --date="yesterday" +%d\ %B\ %Y`" -c systems@company.lk manager@company.lk

According to above example, a mail with yesterday mail status will be received by systems@company.lk and manager@company.lk

You can include the above command in a file located in where ever you prefer and change the mode to 770 for the script file enable executable mode.

 e.g. chmod 770  /home/<your_home_directory/mail_stats

In root crontab, include an entry to execute the script file at a preferred time

crontab -e

E.g.

30 12 * * * /home/your_home_directory/scripts/mail_stats

Wednesday, November 14, 2018

Open LDAP 2.4 - Adding mailing lists for Postfix MTA

When managing mailing list in Postfix with LDAP, it is required to have new alias objects created in the LDAP tree. You may need to enable attributes such as rfc822MailMember mailRoutingAddress attributes defined under nisMailAlias and inetLocalMailRecipient Object classes. These object classes are not enabled by default. You need to enable them by adding the misc.ldif

ldapadd -Q -Y EXTERNAL -H ldapi:/// -f misc.ldif 

After adding the schema, you are allowed to create mailaliases in LDAP with above mentioned attributes. These attributes are used by Postfix to identify the mail recipients for a given mail address.

Below given example includes the ldif file to add  staff@mycompany.com to the LDAP attribute

dn: cn=staff,ou=mailAliases,dc=mycompany,dc=com
objectClass: nisMailAlias
objectClass: inetLocalMailRecipient
objectClass: top
mailRoutingAddress: staff@mycompany.com
rfc822MailMember: chamara@mycompany.com
rfc822MailMember:ceo@mycompany.com
rfc822MailMember: ruwan@mycompany.com


After adding the staff mail aliases, postfix should configured to read the mail aliases from LDAP at main.cf

virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf

Contents in the ldap-aliases.cf

server_host = [serverIP]
server_port = <port normally 389>
version = 3
search_base = dc=mycompany,dc=com
bind = yes
bind_dn = cn=ldapadmin,dc=mycompany,dc=com
bind_pw = <password>
scope = sub
query_filter = (mailRoutingAddress=%s)
result_attribute = rfc822MailMember
result_format = %u@%d
lookup_wildcards = no

Friday, November 2, 2018

Open LDAP 2.4 - Adding new schema and enabling existing schema



By default OpenLDAP having the core schema only. When adding entities to the LDAP database following structural schemas are very important and required. These schemas and related ldif files are already available at /etc/openldap/schema folder but may not be enabled. Following commands can be used to enable required schemas

ldapadd -Q -Y EXTERNAL -H ldapi:/// -f cosine.ldif 
ldapadd -Q -Y EXTERNAL -H ldapi:/// -f nis.ldif

When LDAP is used as the authentication method of postfix or Dovecot, postfix schema is required (http://www.postfix.org/LDAP_README.html) but that is not shipped with OpenLDAP by default. You may need to download the schema from following URI (https://github.com/credativ/postfix-ldap-schema)

In any case if the URL is not available, I have given the data in the postfix schema

attributetype (
1.3.6.1.4.1.4203.666.1.200
NAME 'mailacceptinggeneralid'
DESC 'Postfix mail local address alias attribute'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024}
)
attributetype (
1.3.6.1.4.1.4203.666.1.201
NAME 'maildrop'
DESC 'Postfix mail final destination attribute'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024}
)
objectclass (
1.3.6.1.4.1.4203.666.1.100
NAME 'postfixUser'
DESC 'Postfix mail user class'
SUP top
AUXILIARY
MAY (
mailacceptinggeneralid $ maildrop
)
)
# Schema as required by Postfix: http://www.postfix.org/LDAP_README.html
You need to download this schema and place it in /tmp folder as you need to create the ldif file to integrate to the LDAP server. Good tutorial is available at https://www.youtube.com/watch?v=qAedVMMunk8 which describes how to enable a new schema for LDAP 2.4 

References:
https://www.youtube.com/watch?v=qAedVMMunk8 - tutorial video
https://github.com/credativ/postfix-ldap-schema - Github postfix schema

Sunday, September 16, 2018

LDAP and phpldapadmin


LDAP and Commands


I wanted to configure an openldap with phpldapadmin in CentOS 7. Earlier I used command line to create sub dcs for the ldap database and fed up with commands.On the other hand the GUI can be used to verify the commands which I have used to create/modify entries.

Commands I used:
To add entries
ldapadd -x -W -D "cn=youradmin,dc=yourdc" -f yourfile.ldif
To search components
apsearch -x 'uid=*' -b "dc=yourdomain"

phpldapadmin

It was very easy to install phpldapadmin by just adding the repo  'epel-release'

yum -y install epel-release

During the configuration, I has few minor issues due to firewall settings and SELinux but those were able to fix referring early experiences.

I suggest you to read the following reference to begin with the php LDAP administrator GUI.

Reference:
https://www.itzgeek.com/how-tos/linux/centos-how-tos/install-configure-phpldapadmin-centos-7-ubuntu-16-04.html

This reference is also very valuable but still I did not completely followed.
  https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-openldap-and-phpldapadmin-on-an-ubuntu-14-04-server

Wednesday, June 20, 2018

Cleaning the /boot partition in Ubuntu



Eventually, the boot sector space filled with the downloaded  images which creates system issues. Following commands are useful in identifying old images in the /boot partition and purge them from the system.

Initially, use df -h command and get the information about the space of the partitions

#df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         3.9G     0  3.9G   0% /dev
tmpfs                        787M  9.4M  778M   2% /run
/dev/mapper/ubuntu--vg-root  909G  255G  608G  30% /
tmpfs                        3.9G  348K  3.9G   1% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
tmpfs                        3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                    472M  468M     0 100% /boot
tmpfs                        787M   64K  787M   1% /run/user/1000

This provides the space availability of each partition and clearly shows the /boot partition is fully filled.

Go to /boot and type following command to identify the installed images in the system

#cd /boot
#dpkg -l linux-image-\* | grep ^ii
ii  linux-image-4.4.0-108-generic       4.4.0-108.131 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-109-generic       4.4.0-109.132 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-112-generic       4.4.0-112.135 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-116-generic       4.4.0-116.140 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-121-generic       4.4.0-121.145 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-127-generic       4.4.0-127.153 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-128-generic       4.4.0-128.154 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP


Use uname command to check the current image version of the system

# uname -a 
Linux chamara-X556UAK 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Use apt-get purge command to remove older versions of the images.
#  sudo apt-get purge linux-image-4.4.0-108
Reading package lists... Done
Building dependency tree      
Reading state information... Done

...
..
..
..
done
Purging configuration files for linux-image-4.4.0-108-generic (4.4.0-108.131) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-108-generic /boot/vmlinuz-4.4.0-108-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-108-generic /boot/vmlinuz-4.4.0-108-generic


Now you will see the space available has increased in the /boot partition




Wednesday, September 14, 2016

Deleting active mails in the mailq in Postfix

There are several scripts to do that, but I found most of them are not clearing the active queued messages as the mail ids contain '*' at the end of the ID field. I have used cut -n to get the exact mail ID and delete them.

Following given command will delete mails from/to 'testuser@test.com' from the queue:

postqueue -p | grep "testuser@test.com" | cut -f 1 -d ' ' | cut -c-10 | xargs -n 1 postsuper -d








Following referrences are worth to read:

http://www.postfix.org/postsuper.1.html



http://www.bstar.de/2014/07/08/how-delete-single-mails-from-the-mail-queue-of-postfix-plesk/

Monday, March 21, 2016

Linux Performance Observability Tools

I found this image from Facebook (It seems facebook is not providing gossips only :-) which is very useful for Linux system administrators in finding issues in the systems.



I have downloaded the image from its original site (Site owner Brendan D. Gregg) and the original site http://www.brendangregg.com/linuxperf.html


A big thank to Brendan D. Gregg for publishing this.

Thursday, March 10, 2016

iptables Issue in CentOS7

I had issues in enabling iptables in CentOS7. After following the post (link given below) I was able to resolve the issue I had with enabling iptables.

Error I got when I tried to enable iptables

server1#systemctl restart iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory


Following is the screen shot of the answer received through the post http://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7


Wednesday, December 9, 2015

Remove Unwanted Mails from mailq in postfix Server

We had an issue in a development server which sends thousands of mail messages to the system administrator. Those mails were queued in the out going mail server which affected the normal mail delivery process in the out going mail server.

I used following command to remove unwanted mails from the mailq.

mailq |fgrep apache@testdomain.nic.lk|sed 's/\*.*//'| postsuper -d -

Here apache@testdomain.nic.lk is the mail sending user and I did not use the recipient address to filter the mails as he might delete required mails also.

When I wanted to delete the mails received to a mail user (i.e. rcpt to:someone@yourdomain.lk) I used the following command to delete them:

mailq | awk 'BEGIN { RS = "" } / someone@userdomain\.lk$/ { print $1 }' | postsuper -d -

Clarification 

fgrep will display the detailed line of the mails sent by 'apache@testdomain.nic.lk' which are queued in the mailq and using sed command, just the mailIDs can be listed.
awk is also such tool which can be used for text formatting. When it used correctly with relevant switches. it will generate a list which can be used as an input to postsuper process to delete the given mailID.

Normally, postsuper -d <MailID> will delete the mail in the queue with given mail ID. So the above command will list all mailIDs in the mailq send by a particular user and forward to delete it with postsuper user command.

Good To Read:

https://www.howtoforge.com/delete-mails-to-or-from-a-specific-email-address-from-postfix-mail-queue

Thursday, September 24, 2015

MySQL Error - Use mysql_upgrade

Mysql database has issues and the log file contained following error codes

150924 14:11:17 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
150924 14:11:17 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
150924 14:11:17 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure


Even though the service shows up and running no database interactions were possible. After searching for 'mysql_upgrade' I was able to find out that this is due to MySQL schema storage is broken. These reasons may be:
  • You have broken the database information_schema
  • File system corrupted or some bugs in the file system damaged the database.
  • MySQL internals broke the schema database due to a bug in MySQL (maybe nobody encountered it before).
[Ref: http://stackoverflow.com/questions/6288103/native-table-performance-schema-has-the-wrong-structure ]

All references were guided to run mysql_upgrade as the root.

mysql_upgrade -u root -p
 



*Please note that the root user here is the mysql root user and the password, not the system root








Then the system will prompt for the database root user's password.

When the mysql_upgrate executed, it will check for the compatibility of the databases and tables with the current MySQL version and repair if inconsistency is available. After successful command run,  you need to restart the mysql service. Also check the log file for any errors (/var/log/mysqld.log)

Good References:

https://dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html

*http://serverfault.com/questions/527422/mysql-upgrade-is-failing-with-no-real-reason-given

Wednesday, September 23, 2015

NSUPDATE Issues with TSIG

We planned to enable auto-dnssec maintain in the DNS server to allow dynamic updates with DNSSEC. In the process, it is required to implement dns update with TSIG key. We implemented the key pair with following command.

 #dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 512 -n HOST updatekey.mydomian.lk

It generated following key pair.
Kupdatekey.mydomain.lk.+157+26933.key
Kupdatekey.mydomain.lk.+157+26933.private

and the key pair was included in /var/named as the files can be accessed by named user. The permissions were set to rw by the user named.

The pre-shared key were included in the name.conf (locate in /etc in our case) as follows;

key "updatekey.mydomian.lk." {
        algorithm       hmac-md5;
        secret  "********************************************";
};

where the hidden part is taken from the Kupdatekey.mydomian.private


In the zone section in the named.conf file, the key name was configured as the allows key for zone update;

zone mydomain.lk{
         type master;
         file "mydomain.file";
         .... . . . .
         allow-update {  key updatekey.mydomain.lk.; };
};


Once we need to update the DNS entries in the zone 'mydomain.lk' we tried the following command from the localhost.

nsupdate -k <key_file.private>
>server <serve_ip>
>zone mydomain.lk
>update add/delete <update query>
>send

If there is an issue, the error will be prompted else DNS entries will be updated and if  the zone if configured with
        auto-dnssec maintain;
        dnssec-secure-to-insecure yes;
        key-directory "/var/named/keys"; the new updates will be propagated with dnssec signatures and as IXFR updates to secondaries.

Issues We Found and Solutions
In the initial stage, when generating the key pair we used the domain as the name for the shared key file and the key name given in the named.conf was different to the key file name.
i.e. file generated was Kmydomian.lk.key and Kmydomain.lk.private
and in the named.conf the shared key name was  updatekey.mydomian.lk

We followed the same steps as above the only differences were, the share key name given in the named.conf is different to the Key name;

e.g.
Named conf parameters
key "updatekey.mydomian.lk." {
        algorithm       hmac-md5;
        secret  "**********************************************";
};

Command given for nsupdate
nsupdate -k Kmydomain.lk.private 
>


Once we entered the data for nsupdate, once we confirm the changes with send, it gave the error
TSIG error with server: tsig indicates error

But most interestingly when we used the nsupdate with -y and the key name and pre-shared  string in the named.conf it worked fine.

**Later we understood that the key name should be same as the string that we provided in generating the key with dnssec-keygen -H ..... etc. The key name and the file id should be identical.

Other than that we did not encountered any other issues and we are ready with DNSSEC auto-dnssec maintain with IXFR.

Good reference for TSIG and nsupdate
http://www.crypt.gen.nz/papers/dns_security_1.html

Thursday, May 21, 2015

Upgrade PHP 5.3 to 5.4 in CentOS

I wanted to upgrade php version of one of the server. After referring the following web page it was easily done without any issue.

http://www.servermom.org/upgrade-php-53-54-55-centos/1534/

Monday, April 6, 2015

MySQL Sync with one Master and 2 Slaves

We had a requirement to run mysql replication with one master and 2 slaves. By following normal procedure this is doable. Interestingly we got few points which may be useful to others when working with mysql replication. Following given the points that we had to deal with;

1. A slave with mysql higher version: One slave had mysql ver 5.5 while others are with mysql 5.1. In this case the mysql server 5.5 does not allow to configure mysql masters details in my.cnf where we need to give some important parameters of master server. Following blog page describes the way to give those parameters in the shell and configure the server to connect with the master server.

https://tapasmishra.wordpress.com/2012/06/11/how-to-configure-mysql-5-5-server-as-replication-slave/

Following setting was taken from the above post
mysql> CHANGE MASTER TO MASTER_HOST=’192.168.2.101′,
MASTER_PORT=3306,
MASTER_USER=’replication_user’,
MASTER_PASSWORD=’PASSWORD';
 2. After configuring the master parameters in the slave server as above, we encountered an interesting issue in the synchronization. The issue was identified referring /var/log/mysqld.log and also from 'show slave status' in the shell. The issue was the slave replication SQL thread aborted due to non executable sql commands in master log. Referring below post;

http://stackoverflow.com/questions/2366018/how-to-re-sync-the-mysql-db-if-master-and-slave-have-different-database-incase-o

According to the above post, when defining the master parameters, we need to give MASTER_LOG_FILE and MASTER_LOG_POS. These parameters can be observed by executing 'show master status' in the master server. After getting the log file name and the log position of the master server, the database in the master file should be copied to the slave server. Please note that it is very important to keep the same data in the databases in both master and slave servers when defining the master log positions. mysqldump command can be used to copy the master server's database to slave server.

We gave the master_log_file and master_log_pos parameters along with the master_host, master_port parameters with the CHANGE MASTER TO .. command.

After rectifying the above described issues, the replications were started correctly.

Thursday, October 9, 2014

Limiting a User to Read few columns on a table in MySQL Database

I wanted to limit a mysql user to read only few fields of a table in a MySQL database. I used select grant privileges command to get the desired output.

For example if a user 'test_user' is requested to access field1, field3 and field6 on the test_table in test_db at 192.168.1.1 server following user creation will work.

The user has to be added at the mysql server running on 192.168.1.1. I have assumed the user test_user is connecting from 192.168.1.2

mysql> GRANT SELECT (`field1` ,`field3`, `field6`)  ON `test_db`.`test_table` TO 'test_user'@'192.168.1.2' identified by 'test_pw';


If you want to allow the user to modify the data in the table you may use 'UPDATE' privilege instead of 'SELECT' privilege.

References

Tuesday, September 23, 2014

How to monitor user login history on CentOS with utmpdump

A very useful reading for CentOS admins http://xmodulo.com/2014/09/monitor-user-login-history-centos-utmpdump.html.

I was using `last` and `lastb` earlier but feels we can get more information with `utmpdump`. Thanks for Gabriel Cánepa for his article.

Some short notes from his article

utmpdump /var/run/utmp  - show who is currently logged on and what they are doing, and also by uptime to display system up time

utmpdump /var/log/wtmpshow the listing of last logged-in users

utmpdump /var/log/btmp  - show the listing of last failed login attempts

These files are used in last and `lastb` commands to show details of login but by using utmpdump we get more flexibility for filtering

Upgrade PHP 5.3.3 to 5.4 in CentOS

Sometimes we need to upgrade PHP version inbuilt with the OS to newer version. We have been using CentOS for sometimes. It was requested to upgrade PHP to php5.4 in CentOS 6.5 and I have followed the below given link. We were able to upgrade PHP 5.3.3 to  PHP 5.4.32 (cli) (built: Aug 22 2014 07:07:38) smoothly.

If you have such requirement it is safe to follow the link http://www.shayanderson.com/linux/centos-5-or-centos-6-upgrade-php-to-php-54-or-php-55.htm

Even though it is bit old still works fine :-)

Friday, August 8, 2014

Issue with Roundcube when sending Mails

Today we encountered a strange issue after reboot the server running roundcube webmail application. I was able to login to the webmail application over the network, read mails (I received mails) BUT was not able to send mails. The message says nothing but

'could not send mail. Please wait 76531921 seconds'.

I was clueless as the server had no issue with connecting to sendmail server, web server. No issues were detected in SELinux/iptables/network etc.All the services were OK.

Finally we checked the date and time of the server and found the date had reset to past data in 2012... This had confused the webmail service when the users try to send mails.

After reset the data to current settings, all went OK.

ntpdate -u <ntpserverip>

Moral:
There could be a totally strange reason for an issue. You need to check all possibilities without get panic.