Blogs

Customize Linux Shell Prompt

Bore of using old bash prompt. Here I have tried some other tricks
to change the shell prompt. Custom shell prompt. Colurful Shell
Prompt.

For having shell prompt in way we like for specific user, edit ~/.bashrc and add your customization below line "# User specific aliases and functions"

For Example: PS1 variable is reponsible for how our bash prompt looks like.

Defauls PS1 value on RHEL 5.X systems look like
PS1='\u@\H:\w\$ '
Which results in shell prompt as follows:

Troubleshooting HDD provided to Linux system from SAN box

First we need to check and verify whether the HDD is visible on the Linux system or not.
1. How we can check that?
fdisk -l
Is there any other way?
2. Generally if any new hardware is attached and detected by Linux system it logs in messages file
Any other way then fdisk and messages
in the output of dmesg or in the output of

Popular Linux Network Troubleshooting Tools

Network Tools:

hostname: Useful in finding the hostname or domain name or IP address of system.
ping: Useful in checking network connection
ifconfig: Useful in getting network configuration information
netstat: USeful in getting information on network connections, routing tables and interface stats.
nslookup: Useful in hostname to IP lookup and IP to hostname IP lookup.
telnet: Useful to check communication with other host on specific port.
traceroute: To count number of hops and response time between hosts.

Use of Sysreq key in Linux

You need to have your kernel compiled with the "Magic SysRq Key" option. Find out if it has been by looking at /proc/sys/kernel/sysrq — if it exists and contains the value 1 then:

Auto Login to GUI and to TTY terminal in RHEL and CentOS 6:

For GUI:
Edit /etc/gdm/custom.conf
[daemon]
AutomaticLoginEnable=true
AutomaticLogin=username

For CLI:
Edit /etc/init/tty.conf
Look for the line: exec /sbin/mingetty $TTY
Edit the line as: exec /sbin/mingetty --autologin username $TTY

LDAP Authentication

Authentication is the basic building block of the entire modern computer world. User locks there computer using passwords. Interesting thing is all about authentication mechanism developed by Operating System developer over the period of time. Kerberos, Plugable Authentication Module (PAM), LDAP so on and so forth is in the list.
This document revolves around LDAP.

Kdump Configuration

Configure kdump to analyse Linux kernel crash and kernel panics.

Linux kernel crash and panics and the reason behind it is analyzed with the help of kdump utility.
Kdump is a crash dumping mechanism and it uses the context of another kernel at boot time to capture the crash and core dump. The context of the kernel reserves a small amount of memory, and its only purpose is to capture the core dump of the crashed kernel.

Following are the steps to configure kdump from command prompt.

LVM

Manipulating LVM Swap Space

1. Extending Swap On LVM

#swapoff -v /dev/LVMName/Volume
#lvresize /dev/LVMName/Volume -L +Size_in_Megs

Format Extended Volume to Swap Filesystem
#mkswap /dev/LVMName/Volume
Enable Swap Sapce
#swapon -va

2. Creating LVM For Swap Space
#lvcreate VolGroupName -n Swap_Volume_Name -L Size_in _Megs
Format to Swap File System
#mkswap /dev/LVMName/Swap_Volume_Name
Appropriate name entry in /etc/fstab for permanent mounting
Enable swap space
#swapon -va

3. Creating a Swap File

Know Your Console: Art of Console Access

Disable Shutdown via Ctrl+Alt+Del
Comment following line from /etc/inittab file
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Allow non-privilege user to shutdown
to do so add -a option in a line from /etc/inittab file
ca::ctrlaltdel:/sbin/shutdown -a -t3 -r now
-a option looks for /etc/shutdown.allow file
create /etc/shutdown.allow in /etc. Add non-privilege user to whom you want to give an
authority to shutdown.

Disable Console Program Access
#rm -f /etc/security/console/apps/*

to disable powerroff, halt or reboot
#rm -f /etc/security/console.apps/{poweroff, halt, reboot}

Samba as a PDC with tdbsam as a backend on CentOS 5

Here I discuss how to set up Samba as a Primary Domain Controller with tdbsam as a backend to store username and password.

Steps:

1. Install the following packages
samba-common-3.0.33-3.14.el5
samba-3.0.33-3.14.el5
samba-client-3.0.33-3.14.el5
2. Configure /etc/samba/smb.conf file as follows:
[global]
workgroup = "YOURDOMAIN NAME"
server string = Samba PDC
passdb backend = tdbsam
log level = 3
log file = /var/log/samba/%m.log
max log size = 50
add user script = /usr/sbin/useradd "%u" -n -g users

Syndicate content