Sunday, June 2, 2013

Linux: Log Files

Linux: Log Files

Daemon:             syslogd
sysklogd               this is the package that  installs syslogd
klogd                    this is the daemon that logs kernel messages only
/etc/syslog.conf                              config file for syslogd

logger                 
This tool creates manual log entries
Options:
-i             records PID
-s            echos data to stderr and log file
Rotating log files
logrotate             tool for rotating log files
/etc/logrotate.conf         config file for logrotate
Watching logs
This is the most important cmd to see whats happening:

tail –f /var/log/messages
Share:

Linux: User and Group Management – Key Commands and Utilities


Managing Users


Adding Users

useradd - this cmd is used to add new user to the system

-d           specify home dir

-e           expiry date

-s            shell

-G           group

-u           UID


/etc/login.defs  - this file stores all the parameters for users

passwd [username]  - creates a password for the user

usermod
This modifies user's account
-m          used with -d, this moves contents of the current home dir to the new one specified
-U           unlocks password
-L            locks account
-l             changes username (usermod -l new_username old_username)

chage
This command deals with account expiration
-m          sets the minimum time before a user can change password. Usage: -m 1 (1 day)
-M          sets the maximum time after which password needs to be changed
-d           sets the last day the password was changed (can be used to manipulate account info)
-I            sets number of inactive days allowed before password expires
-E           sets expiration date
-W          sets warndays – warn the user before the password expires

Deleting Accounts


userdel                              
This cmd is used to delete users from a system.
Options:
-r            remove all the files from home dir and mail spool
-f            force deletion of the account (when the user is logged in)
-h           get help

Managing groups

/etc/group - this file controls the group membership (also /etc/gshadow)

/etc/passwd - this file contains info on the user's primary group (also /etc/shadow)

newgrp - this cmd is used for changing current group to a different one

chgrp - this cmd is used to change the group of a file or dir

First 100 GIDs and UIDs (0-99) are reserved for system use (generally)

0 UID/GID belongs to root - always

 

Adding groups


groupadd
This cmd adds a new group to the system.
Options:
-g           specifies a GID
-r            creates a system group
-f            forces creation

 

Modifying groups


groupmod
This cmd modifies a group.
Options:
-g           specify a new group ID for an existing group
-n           specify a new group name for an existing group
gpasswd
This cmd sets a password for the group
Options:
-a           add a user to the group                  usage:   -a user group
-d           delete a user from the group        usage:   -d user group
-R           configures a group to not allow the cmd newgrp
-r            removes the password from a group
-A           specify group admin

 

Deleting groups


groupdel
This cmd deletes a group





Share:

Saturday, June 1, 2013

X Window System on Linux

X server options:

1. XFree86 -------------------------------------commonly used till 2004
2. Xorg-X11 ------------------------------------used in most system today
3. Accelerated-X --------------------------------commercial version (not used much)

Configuring X:

Using configuration utilities is the best way to configure X for linux.
Available Utilities:
1. X Server: 
                                   XFree86 -configure (should get you: /root/XF86Config.new)
                                   Xorg -configure (should get you: /root/xorg.conf.new)

2. Distro-tools:
                                   RedHat - Display Settings tool (cmd: system-config-display)
                                   SuSE - YaST

3. xf86fg and xorgcfg:
                                   no longer supported


Config files:
                                   xorg.conf (/etc/X11/xorg.conf)
                                   XF86Config-4 or XF86Config (/etc/X11/XF86Config)

Shutting down X:
                                   RedHat: telinit 3
                                   Debian:
                                   /etc/init.d/xdm stop
                                   dm could be gdm, kdm, mdm ---------------whatever your distro uses.


Starting X: 
                                   startx
                                   telinit 5 (RHEL)
                                   /etc/init.d/xdm start (Debian)



Config Options for X:

Loading Modules

Section "Module"
Load "------"
Load "------"

Loads all the modules listed in this section.

Loading Keyboard

Section "InputDevice"
Identifier "Keyboard0"
Driver "----"
Option "-----" "----"

Loading the Mouse

Section "InputDevice"
Identifier "Mouse0"
Driver "----"
Option "-----" "----"

Loading the monitor

Section "Monitor"
Identifier "Monitor0"
ModelName -------------- could be anything
HorizSync ---------------- horizontal refresh rate in kHz
VertRefresh -------------- vertical refresh rate in kHz
Modeline ----------------- resolution

Loading the video card

X sends data to the monitor INDIRECTLY through the video card.

Drivers are found in: /usr/X11R6/lib/modules/drivers
                                  /usr/lib/xorg/modules/drivers




Share: