Friday, February 20, 2009

How to display user attributes in WebSphere Portal?

If you want to display some attributes of current user, you can use tag in your theme pages, e.g. in banner_toolbar.jspf



Hello < portal-fmt:user attribute="sn"/>, < portal-fmt:user attribute="givenName"/>



this tag supports following attributes :

Default attributes are:

* jobTitle
* roomNumber
* telephoneNumber


Member Manager attributes valid for including in person link contact information are:

* businessCategory
* carLicense
* cn
* countryName
* departmentNumber
* description
* displayName
* employeeNumber
* employeeType
* facsimileTelephoneNumber
* givenName
* homePostalAddress
* ibm-gender
* ibm-generationQualifier
* ibm-hobby
* ibm-middleName
* ibm-otherEmail
* ibm-personalTitle
* ibm-primaryEmail
* ibm-regionalLocale
* ibm-timeZone
* Initials
* jobTitle
* localityName
* manager
* mobile
* o
* ou
* pager
* postalAddress
* postalCode
* preferredLanguage
* roomNumber
* secretary
* seeAlso
* sn
* stateOrProvinceName
* street
* telephoneNumber
* uid

Wednesday, February 18, 2009

How to Set JAVA_HOME / PATH variables Under Linux Bash Profile

~/.bash_profile is a startup script which generally runs once. This particular file is used for commands which run when the normal user logs in. Common uses for .bash_profile are to set environment variables such as PATH, JAVA_HOME, to create aliases for shell commands, and to set the default permissions for newly created files.

Set JAVA_HOME / PATH for single user
Login to your account and open .bash_profile file
$ vi ~/.bash_profile


Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

Set PATH as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin

Save and close the file. Just logout and login back to see new changes:
$ echo $JAVA_HOME
$ echo $PATH

Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
$ which java


Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.

Set JAVA_HOME / PATH for all user
You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:
# vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin


link-> http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/

How To Install JDK 6 / Java SE 6 (+ Tomcat) in Fedora Core 6 / Fedora 7 in 5 Minutes

Fedora Core developers make it rather hard to install and properly configure Sun's JVM. All said and done Sun's JVM (comes with JDK) is the best JVM implementation out there; not to mention that it is the reference implementation. Here is how you can easily install JDK 6 / Java SE 6 in 5 minutes or less. Here are the steps:

1. Login as root

2. First you need to download it from here. This works fine from GUI browsers like Firefox, Internet Explorer or Safari. However Sun makes it very hard (from java.sun.com) to download it for Linux console users (like those trying to install on their dedicated web server). You cannot access the download link from text based lynx browser. Fortunately there is a way. I found a secret location for you to easily download JDK 6 using wget or curl (console apps). This is also very useful if you are planning to use any download accelerators. The current binary (32 bit version) is here. This link will surely change with time so it is better to browse to the link above and then access this link from that page.

Download it using wget or curl. The command, for example, today will be:
wget http://www.java.net/…/jdk-6u2-ea-bin-b02-linux-i586-12_apr_2007-rpm.bin

Note: The link has been truncated for brevity, however it is hyperlinked to the actual link.

3. Now change the permission of the downloaded file to 755 like this:
chmod 755 jdk-6u2-ea-bin-b02-linux-i586-12_apr_2007-rpm.bin

4. Then run it:
./jdk-6u2-ea-bin-b02-linux-i586-12_apr_2007-rpm.bin

You will need to type yes to indicate your acceptance to their agreement and the installation will complete on its own. Unfortunately you are not yet done. Type java -version on the command line and you will see that it still points to the crappy old JVM from gcj.

5. Now you need to find the actual location of your JDK installation and indicate to Fedora to accept your choice.

Type the following:
updatedb;locate javac |grep bin

You will see an entry like this:
/usr/java/jdk1.6.0_02/bin/javac

Here /usr/java/jdk1.6.0_02 is the actual JAVA_HOME for your machine. Note this as you will need it to run the future commands.

Now you need to run the alternatives command to instruct Fedora to recognize Sun's JVM.
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_02/bin/java 100
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_02/bin/jar 100
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_02/bin/javac 100

You can do this for other Java executables too, should you need them, following the same pattern.

Note: If alternatives is not in your path then use locate alternatives to locate it.

Finally you should configure alternative to use Sun's JVM as the default JVM. To do this type:
/usr/sbin/alternatives --config java

This will present you with at least 2 options. Choose the one for Sun's JVM. Similarly repeat the process for other commands.

Now you are done configuring Fedora for the most part. Type java -version and you should see something like this:

java version "1.6.0_02-ea"
Java(TM) SE Runtime Environment (build 1.6.0_02-ea-b02)
Java HotSpot(TM) Client VM (build 1.6.0_02-ea-b02, mixed mode, sharing)


Note: This works for most part, except Tomcat. The default installation of Tomcat has been hardwired to use GCJ. I changed the configuration file and it didn't help. My solution for Tomcat is to ditch Fedora's version and install directly from site. It works like a charm. Set JAVA_HOME to the value we found above and you are done.


copy from -> this link http://blog.taragana.com/index.php/archive/how-to-install-jdk-6-java-se-6-tomcat-in-fedora-core-6-fedora-7-in-5-minutes/

Monday, February 16, 2009

keytool - Key and Certificate Management Tool

How do I delete a cert from the default .keystore

keytool -delete -alias xxxxx (where xxxxx is the alias name)

How do I delete a cert from the cacerts file

keytool -delete -alias xxxxx -keystore F:\j2sdk1.4.2_04\jre\lib\security\cacerts (where xxxxx is the alias name)

How do I list all .keystore certs


keytool -list -v | more

How do I list all .keystore certs in a specific keystore

keytool -list -keystore F:\j2sdk1.4.2_04\jre\lib\security\zzzzz | more (where zzzzz is the keystore name)

How do I list just one .keystore cert

keytool -list -v -alias xxxxx | more (where xxxxx is the alias name)

How do I list all cacerts certificates

keytool -list -keystore F:\j2sdk1.4.2_04\jre\lib\security\cacerts | more

How do I list just one cacerts certificate


keytool -list -keystore F:\j2sdk1.4.2_04\jre\lib\security\cacerts -alias xxxxx | more (where xxxxx is the alias name)