HomeBanner

Shell Related Questions

Shell related Administration

1. How can I change my default shell ?
2. How can set the user to a restricted shell ?
3. How can I manipulate the bash prompt color ?
1.

How can I change my default shell ?

Use the command chsh or edit /etc/passwd

With root user rights, enter the command yast then System Administarion->User administration select the user you want modified with F3 function key and when you come to login shell again press F3 and select the shell and finish. When you login as that user you can have the shell you have assigned in YaST

The interactive way to deal with it is through usermod. Something like (don't quote , read the man page):

  # usermod -s USER /qualified/path/to/shell
	
2.

How can set the user to a restricted shell ?

Simply give the user /usr/bin/rbash instead of /usr/bin/bash as a login shell. If bash is either called with the -r parameter or as rbash, it will react as restricted shell. See info bash for further documentation.

3.

How can I manipulate the bash prompt color ?

Everything you need to know - and more is at: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO

This is what I came up with after playing with things for a few minutes.

# some colors
export black="\[\033[0;30m\]"
export dark_gray="\[\033[1;30m\]"
export blue="\[\033[0;34m\]"
export light_blue="\[\033[1;34m\]"
export green="\[\033[0;32m\]"
export light_green="\[\033[1;32m\]"
export cyan="\[\033[0;36m\]"
export light_cyan="\[\033[1;36m\]"
export red="\[\033[0;31m\]"
export light_red="\[\033[1;31m\]"
export purple="\[\033[0;35m\]"
export light_purple="\[\033[1;35m\]"
export brown="\[\033[0;33m\]"
export yellow="\[\033[1;33m\]"
export light_gray="\[\033[0;37m\]"
export white="\[\033[1;37m\]"
export no_color="\[\033[0m\]"
export inverse_color="\[\033[7m\]"
export blue_bg="\[\033[0;44m\]"
export gray_bg="\[\033[0;47m\]"

PATH=$PATH:~/opt/bin

PS1="$blue\u@\h:\w/$red\n\d \t$no_color:> "
      


Updated: Tue, 03 Feb 2004
Valid CSS!Valid HTML 4.01!