Monday, December 10, 2012

Modifying default template for user settings in Linux

If you wish to put or modify a standard template when creating new users, you may wish to put them in the /etc/skel. The /etc/skel acts as a containers where you can out the typical .bashrc .bash_profile .bash_profile or other scripts that you would want all the default users should have. In CentOS, you would typically see

drwxr-xr-x   3 root root  4096 Oct 31 13:12 .
drwxr-xr-x 126 root root 12288 Dec 11 22:48 ..
-rw-r--r--   1 root root    33 Jan 22  2009 .bash_logout
-rw-r--r--   1 root root   290 Oct 31 13:12 .bash_profile
-rw-r--r--   1 root root   176 Jan 22  2009 .bash_profile.old
-rw-r--r--   1 root root   461 Oct 31 13:12 .bashrc
-rw-r--r--   1 root root   124 Jan 22  2009 .bashrc.old
-rw-r--r--   1 root root   515 Jun 15  2008 .emacs
drwxr-xr-x   4 root root  4096 Sep  9  2010 .mozilla
-rw-r--r--   1 root root   658 Sep 22  2009 .zshrc

Do when you do a useradd, you will invoke the following workflow Default values used by useradd command  and inclusion of the template found in /etc/skel

Sunday, December 9, 2012

Black Screen when reconnecting back to old VNC Server when hostname was changed

When I was reconnecting to an old VNC session, I got a black screen and the screen was unresponsive. There was no way to get back to the contents in the screen. Prior to the reconnecting, the hostname on the VNC Server was changed.

VNC uses hostname and the session id for the identification of the session. You can take a look at the contents at ~/.vnc/

$ ls ~/.vnc/

headnode-h00.mycluster.sg:33.pid
headnode-h00.mycluster.sg:33.log
headnode-h00.mycluster.sg:40.pid
headnode-h00.mycluster.sg:40.log
headnode-h00.mycluster.sg:42.log

To get back to any session, and assuming your VNC Server and network are accounted for and has connection, then you have to check the hostname of the server has not been accidentally changed.

$ hostname

headnode-h00.mycluster.sg
If hostname is changed,do read the blog entries 
  1. Changing the hostname on CentOS 
  2. Another look at Changing hostname for CentOS 

Thursday, December 6, 2012

libstdc++.so.5()(64bit) is needed

If you have an error, for example something like this

libstdc++.so.5()(64bit) is needed by gpfs.base-3.4.0-0.x86_64
libstdc++.so.5(CXXABI_1.2)(64bit) is needed by gpfs.base-3.4.0-0.x86_64
libstdc++.so.5(GLIBCPP_3.2)(64bit) is needed by gpfs.base-3.4.0-0.x86_64
libstdc++.so.5(GLIBCPP_3.2.2)(64bit) is needed by gpfs.base-3.4.0-0.x86_64

The error is due to missing legacy libraries compat-libstdc++. For CentOS, just do a

 yum install compat-libstdc++*

Tuesday, December 4, 2012

Debugging gmond issue quickly

If you need to debug gmond issues quickly, use the command

# /usr/sbin/gmond --debug=9

loaded module: core_metrics
loaded module: cpu_module
loaded module: disk_module
loaded module: load_module
loaded module: mem_module
loaded module: net_module
loaded module: proc_module
loaded module: sys_module
loaded module: multicpu_module
udp_recv_channel mcast_join=NULL mcast_if=NULL port=8649 bind=NULL
tcp_accept_channel bind=NULL port=8649
Unable to create tcp_accept_channel. Exiting.

For more information and example see: 
  1. Ganglia Node unable to update Gmetad Node 
  2. Gmond dead but subsys locked for ganglia monitoring daemon

Monday, December 3, 2012

Default values used by useradd command

When the users issues a useradd command, the useradd commands reads the /etc/default/useradd and the /etc/login.defs and determine the default value for useradd. To display the value for /etc/defaults/useradd, see Displaying defaults for useradd

Do read also Modifying default template for user settings in Linux which will add in the files settings for the users.

To read the /etc/login.defs,
# vim /etc/login.defs

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   99999
PASS_MIN_DAYS   0
PASS_MIN_LEN    5
PASS_WARN_AGE   7

#
# Min/max values for automatic uid selection in useradd
#
UID_MIN                   500
UID_MAX                 60000

#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN                   500
GID_MAX                 60000

#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD    /usr/sbin/userdel_local

#
# If useradd should create home directories for users by default
# On RH systems, we do. This option is overridden with the -m flag on
# useradd command line.
#
CREATE_HOME     yes

# The permission mask is initialized to this value. If not specified,
# the permission mask will be initialized to 022.
UMASK           077

# This enables userdel to remove user groups if no members exist.
#
USERGROUPS_ENAB yes

# Use MD5 or DES to encrypt password? Red Hat use MD5 by default.
MD5_CRYPT_ENAB yes

ENCRYPT_METHOD MD5