Wednesday, May 18, 2016

LDAP - Create encrypted user password

In Person object class, there is a userPassword attribute and LDAP usually use this to store user password.

To add an encrypted password to the LDAP userPassword attribute, you could

1. Use ldappasswd command

ldappasswd -xv -D "cn=Manager,dc=example,dc=com" -w secret -S "cn=user1,dc=example,dc=com"

where

x --> Use simple authentication
v --> Run in verbose
D --> bind DN
w --> password for simple authentication
-S --> prompt for new password

2. Use slappasswd command

$ /usr/local/sbin/slappasswd
New password:
Re-enter new password:
{SSHA}a6a4/lrXhERF&14qesnZZAAkCgIUvSDOx


It will ask for your password and generate a SSHA password. Copy the output and put at the userPassword attribute in your ldif file.

Wednesday, April 27, 2016

LDAP - Adding inetOrgPerson schema to OpenLDAP

By default, inetOrgPerson schema is not included in the slapd.conf. You will need the following steps to add inetOrgPerson schema to OpenLDAP

1. Edit slapd.conf with any editor tools. The slapd.conf usually is located at /usr/local/etc/openldap and require sudo access to edit the file.

2. Add  the following

include        /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema

to the top section of the slapd.conf file. Please note that the order is important. cosine.schema is required because attribute type audio is defined in cosine.schema.

3. Restart the LDAP with "su root -c /usr/local/libexec/slapd"




Tuesday, March 15, 2016

Oracle - ORA-01034: ORACLE not available

When you see the following error

ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0

and your ORACLE_HOME is set correctly. You may want to check if your ORACLE_SID spelled with wrong case. 

ORACLE_SID is case sensitive in Linux

I saw this https://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:318216852435

The SID is a site identifier. It plus the Oracle_home are hashed together in Unix to create a unique key name for attaching an SGA. If your Oracle_sid or Oracle_home is not set correctly, you'll get "oracle not available" since we cannot attach to a shared memory segment that is identified by magic key.

From Oracle website, the basic format of tnsnames.ora is

net_service_name= 
 (DESCRIPTION= 
   (ADDRESS=(protocol_address_information))
   (CONNECT_DATA= 
     (SERVICE_NAME=service_name))) 

net_service_name can be use when connecting with sqlplus

CONNECT username@net_service_name

If no net_service_name is given, it will use ORACLE_SID

Connectivity Concepts from Oracle is a good read about Service name and SID.


Tuesday, February 23, 2016

Linux - Adding a swap file to RHEL

It is very possible that you may want to increase swap space after installation. For myself, my server is running out of memory, both physical and virtual. So as a workaround, I tried the following to increase my swap space. Although swap partition is recommended, I chose swap file because it will be less disruptive to the users (ie, do not need to reboot..)

To add a swap file:

Determine the size of the new swap file in megabytes and multiple by 1024 to determine the block size. For example, the block size of a 8GB swap file is 8192000.

1. At a shell prompt as root, type the following command with count being equal to the desired block size:

dd if=/dev/zero of=/swapfile bs=1024 count=8192000

The command output is

$ dd if=/dev/zero of=/swapfile bs=1024 count=8192000
8192000+0 records in
8192000+0 records out
8388608000 bytes (8.4 GB) copied, 25.3272 s, 331 MB/s

2. Setup the swap file with the command:

mkswap /swapfile

The command output is

$ mkswap /swapfile
mkswap: /swapfile: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 8191996 KiB
no label, UUID=7s1166af-ls99-e938-lpos-p0a9000e1234


3. To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

This command does not have any output

4. To enable it at boot time, edit /etc/fstab to include:

/swapfile               swap                    swap    defaults        0 0

The next time the system boots, it enables the new swap file.

This command does not have any output

5. After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command cat /proc/swaps or free.

You could also use Top or HTop command to see the additional swap amount. Or, you could ls -al / to see the swapfile

$ ls -al /
...
-rw-r--r--    1 root root 8388608000 Jul  5 22:21 swapfile
...

The above is reference from RedHat System Administrator Guide with my own experience added.


Tuesday, January 12, 2016

Linux - sed to clean up "color codes" or escape sequence

If you see

drwxr-xr-x   23 abc xyz          4096 May 24  2011  [00;34m. [00m/
drwxrwsr-x    4 abc xyz          4096 May  3 01:14  [00;34m.. [00m/

in your directories, you could use the following to remove the color code.


sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"


Reference:

1. http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed

Wednesday, December 16, 2015

WebSphere - Error 404: SRVE0190E: File not found: {0}

When you are accessing a URL from WebSphere Application Server and you encounter the following error

Error 404: SRVE0190E: File not found: {0}

this could means that your WebSphere Application Server is misconfigured.

This could happen if you are trying to access a URL which is actually a servlet mapping and the actual URL/resource does not actually exist.

To workaround this problem, set the following in your WebSphere Application Server

com.ibm.ws.webcontainer.invokefilterscompatibility=true

Resource:

1. http://www-01.ibm.com/support/knowledgecenter/SS7JFU_7.0.0/com.ibm.websphere.express.doc/info/exp/ae/rweb_custom_props.html?cp=SS7JFU_7.0.0%2F1-15-5-9522.

2.  http://frightanic.com/software-development/solution-to-error-404-srve0190e-on-websphere-6-1/

Monday, November 23, 2015

Chrome - Multiple Chrome icon at the taskbar

Problem


When I am fixing my laptop, I messed up with the Chrome Person setting. 



Although Chrome shows only 1 users, it will pop up an addition icon at the task bar whenever I clicked on the pinned Chrome icon (see below)


The previous behavior is only one Chrome icon at the task bar (see below)




Solution

Remove "C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\User Data" and restart Chrome will fix the issue.


Reference:

https://code.google.com/p/chromium/issues/detail?id=91650