Sunday 15 April 2012

Aliases,default permission,runlevel,welcome message at time of login In Linux

 Aliases:

Aliases are shortcut names for large commands. If we have command that run often, but take a considerable amount of typing, we can reduce these to an aliases.
Alias c=clear
We can make a permanent entry of alias in .bashrc file
Type:
#vi .bashrc
alias c=`clear`
save and exit
Test your change by logging out, logging back and type the following
#alias
#c

Default Permission: 

The default permission for files is 666 and directory is 777. umask is used to withhold permission. Default root’s umask is 022. without a umask in effect, only file created will have 666 permission and directory will have 777. this means that anyone on the system will have read and write access to any file. A umask of 002 will result in file created with 664 permission and directory with permission 775.
Default umask on Red hat enterprise linux is 002. to change
#umask 022
umask is typically set by script run at login time. The next time you lig in umask will be set bask to your default unless you add command to one of your startup files such as .bashrc.

Run Level: 

To check the run level we need to see the file /etc/inittab
#vi /etc/inittab
defaults run – level used by RHS are
0          :           hault ( do not set init default to this)
1          :           single user mode
2          :           multi user mode without networking
3          :           multi-user mode with networking
4          :           unused
5          :           X11 (Graphical)
6          :           reboot

#runlevel        :           this command shows that in which run level you are at present

in init 3 runlevel, if you type command startx to go to the graphical mode then it will not ask you for password.
By default we have 6 virtual console (text mode), but we van increase or decrease the number of text mode simply by editing the file /etc/inittab

#vi /etc/inittab
line No 18       :           id:5:initdefault
(we can change this value from 1 to 5 as per our need)

Line No 44      :          
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
.
.
.
6:2345:respawn:/sbin/mingetty tty6
in these line if we add one more line the number of virtual console increase and if we remove one line , virtual console terminal decrease.
For adding
7:2345:respawn:/sbin/mingetty tty7
after editing this file we need to sane and exit
#init q             :           this command is used to activate the change made.

Welcome Message at the time of login :-


We need to edit the file /etc/motd
#vi /etc/motd
type any message which we want to display
“WELCOME TO www.rhceccna.blogspot.com”
save and exit
Now login to user and check message…


Thanks,

No comments:

Post a Comment