X-windows system
X Windows System:
XFree86 process is used for only a GUI mode processing. Red hat Linux 8.0 uses
xfree86 version 4.2 as the base X Windows system which includes the necessary X Libraries, Fonts, utilities, documents and development tools. Red hat Linux 9.0 uses XFree86 version 4.3
XWindows files are stored in below path:
/etc/X11R6 directory will be display.
Or
/etc/X11
In this path is containing XClients binaries, header files, libraries and manual pages.
When the XWindow is first to run in this path.
/etc/X11/Xf86config à XWindow Configuration files.
Changing the resolution:
# redhat-config-XFree86
XClient run file path:
/etc/x11/xinit/xinitrc
Default XServer run file path:
/etc/x11/xinit/Xserverrc
To editing a main window in redhat Linux à press e
Grub (Grand Unified Boot Loader)
You install a two operating system namely Linux & windows 2000. You can easily change name in (Linux & windows 2000) main window (desktop). (It is fully customize option)
Grub Configuration files
/boot/grub/grub.conf
O/P =>
Default =0
time out=50
splash image (hdo,4) /grub/splash xpm.gz
title Redhat Linux (2.4-20-2.48)
root (hdo,h)
kernel /boot/umlinux -2.4.20-2.8 o root=LABEL =/
initrd/initrd-2.4-20-2.48.img
title Windows
root verify (had,0)
chain load +1
1, Specify in which operating system o be loaded in default.
2, How much time boot screen for waiting.
3, Boot screen image file.
4, title will be display in the grub screen.
LILO (Linux Loader)
It is not customize time, name ….etc. could not to be change in LILO method. (Like Typical)
Press ^x to edit.
Configuration File
/etc/lilo.conf
/etc/lilo.conf.anaconda à Found the grub.
/etc/lilo.conf o/p is given below:
boot=/dev/had
Map=boot/map
install=/boot/boot.b
prompt
time out=50
message=/boot/message
lba32
default = Linux
image=/boot/umlinuz-2.4-0-0-43.6
label=linux
initrd=/boot/initrd-2.4.0-0.43.6.img
read-only
root=/dev/hda5
other=/dev/hda1
label=dos
How to change GRUB to LILO Format:
You copy a file name lilo.conf.anaconda to lilo.conf
(e.g)
cp lilo.conf.anaconda lilo.conf
After copy a file goes to prompt
# lilo
# init 6
A system is restart. A boot loader is change in lilo format.
LILO to GRUB
After changing the file lilo.conf to lilo.conf.anaconda
# boot: linux –s
#grub-install/dev/hda (To start Linux single)
Lilo is change to grub.
When init starts, it becomes the parent or grants parent of all the process that startup automatically in redhat linux. First, it runs the /etc/rc.d.rc.sysinit script, which set your path, starts swapping, and checks the file system & so on.
/etc/inittab This program after loaded a kernel. The default run level is 5 in this example, the number after the first colon. If you want to change it, you can enter a /etc/inittab and you can change the run level careful to handle, when you are editing the inittab file.
To change from a console to a graphical login, you should change the number in the line id:3:initdefault: from a 3 to a 5.
Id:runlevel:action:command
Action
Once à Only one time Execute.
Wait à
Response à
Init Default à
Sysinit à
à
Id:runlevel:action:command
15:2345:response:/sbin/tty
Init run level
0 à Halt
1 à Single user mode.
2 à Multi user mode (with out XWindow -NFS-NIS)
3 à Fulmulti user mode with out GUI.
4 à Fulmulti user mode with out GUI.
5 à Fulmulti user mode with GUI.
6 à Reboot.
You can enter a Linux, when a processing & checking some files. This processing are include in this path /etc/inittab. Whenever you can boot a system immediately checking each configuration file.
(e.g) keyboard file, hard disk file …etc.
After checking, it will come to GUI mode.
Last file for init processing: rc.local /etc/rc.d/rc.local
/etc/rc.d àThis directory contains the following directory.
i, /init.d ii,/rc0.d iii, /rc1.d iv, /rc2.d up to /rc6.d
rc.sysinit à First start up file.
rc.local àlast file for init process.
rc àThis file is responsible for starting/stopping a service. When the run level is change.
Shutdown command
Shutdown [option] [-t sec] time [warning message]
# shutdown -k à Message should be display but system is not shutdown.
# shutdown 12:45 à System will be shutdown in 12:45
# shutdown –g 12:45 à System will be shutdown 3 minutes later in 12:45.
# shutdown –r à Reboot after shutdown.
# shutdown –h à Halt after shutdown.
-f à do a ‘Fast’ reboot (skip sack).
-F à Force fsck on reboot.
-n à Do not go through “init” but go down real fast.
-c à Cancel a running shutdown.
-t sec à delay between warning and kill signal.
USER ADMINISTRATION
User creation in GUI mode:
Start à System Setting à Usr
User creation in CUI (Character user interface)
# useradd [option] <username>
v uid à user id
v gid à group id ( primary & Secondary )
v shell à This has to be activating when the user is logged in.
v command à
v password à
v valid date à
OPTION
-u à For specifying the user id.
-g à For specifying the primary group id.
-G à For specifying the secondary group id.
-c à For specifying the command.
-d à For specifying home directory path.
-m à For specifying the create a home directory in particular path.
-s à For specifying a shell.
-e à For specifying a expiry date.
-f à Number of days account can be activated after the password will be expire.
-f0 à Account number & password are expiring.
# usradd –u 503 –g 601 –G 602,603 –s /bin/bash –f2 –e3 –d /home/test –m test
-D à Default values.
Useradd => immediately checking in this file.
(i) read /etc/login.defs
(ii) create entries in
/etc/passwd
/etc/shadow
/etc/group
(iii) copies file from /etc/skel directory to user home directory.
/etc/login.defs contains default account polices. (First, read this file).
PASS – MAX – DAYS – 99999
PASS – MIN – DAYS 0
PASS – MIN – LEN 5
PASS – MIN AGE 7
UID – MIN 500
UID – MAX 60000
GID – MIN 500
GID – MAX 60000
CREATE – HOME YES
Password Command
After creating a user account you must set a passwd for that account using the
passwd command as follow.
root# passwd ibrahim (user name)
Enter the password:
Confirm password :
Username : password : uid : gid : command : homedir : shell
User mod command
The usermod command is used is used to modify the user parameters as follows.
# Usermod [-u uid] [-g GID] [-G group1, group2…] [-c comment] [-s shell] [–d home]
[-e expire -date] –l –L –m <username>
-I à change the user login name.
-L à used to lock a user account.
-U à used to unlock the user account.
Chage command
It is used to set password aging policies.
# chage [option] username
-m à minimum days required between password change.
-M à maximum number of days a user can use the same password with out changing.
-E <date> à Password expiry date in YYYY – MM – DD Format.
-W à Set warning days message as the number of days before password expiration
during which user is warned that is password is due to expire.
User delete command
# userdel [-r] username Userdel command can be used to delete a user account.
Groupadd Command
# groupadd [-g GID] groupname This command will create a new group called aita.
# groupadd aita
Groupmod Command
It is used to modify the group parameters, normally the gid or the group name as follows.
groupmod [-g new gid] [-n new name] group name
-g à Change the group id.
-n à Change the group name alone.
Groupdel Command
#groupdel groupname It is used to delete the user account as follows.
Shadow Password
Improved system security by moving the encrypted passwords normally found in
/etc/shadow, which is readable only by root.
v Account name.
v Account encrypted password.
v The number of days elapsed since 1st January 1970 to the day last password changed.
v The minimum number of days required between the passwords changed.
v The maximum number of days after which password must be changed.
v The number of days before password expires the user is warned.
v The number of days after the password expires before the account is disabled.
v The number of day’s since1 Jan 1970 after which the account is disabled.
To View the group details
# vi /etc/group
# group
To view the user details
#id <user name> ( etc# id ibrahim )
# id à To view root details.
Su Command
The su- switch user command is used to get privilege of a different user with out logging to the system using that user name.
Su-<user name> Totally changes the user environment outside from root. It returns to root.
It ask root password.
Su <user name> This user name only works on root environment.
Change History
/etc/profile To change history. etc#vi profile To change the modification on the all user
or system wide environment.
Send Message
/etc/motd This is message command file.
etc#vi motd
Hai welcome to all
Press ^d
After enter any user “Hai welcome to all” message will be display.
Remove this message etc#vi motd delete “hai welcome to all” message.
Block all users
etc#cat > nologin (after)
: wq
After this command could not enter any user in our system.
Remove the permission
etc# rm nologin This command is removed easily enter all user in our system.
Default Alias settings
# alias cls = clear Set alias name its working very well. However, restart in your system alias name is corrupted. If you want to standard work means, you can set default alias settings.
# cls means system screen should be cleared up to reboot your system. But any times and whenever
Work in this command means set default alias.
/usr/bin/clear copy from clear to cls
bin#cp clear cls Clear & cls are work in same condition.
Ownership and File Permissions
Earlier in this chapter, when you tried to change to root's login directory, you received the following message:
cd /root bash: /root: Permission denied |
Figure 13-11. Permissions for sneakers.txt
Other information to the right of the group includes file size, date and time of file creation, and file name.
The first column shows current permissions; it has ten slots. The first slot represents the type of file. The remaining nine slots are actually three sets of permissions for three different categories of users.
For example:
-rw-rw-r-- |
Those three sets are the owner of the file, the group in which the file belongs, and "others," meaning other users on the system.
- (rw-) (rw-) (r--) 1 sam sam | | | | type owner group others
|
The first item, which specifies the file type, can show one of the following:
mission has not been granted. Look again at the first column of sneakers.txt and identify its permissions.
ls -l sneakers.txt -rw-rw-r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
The file's owner (in this case, sam) has permission to read and write to the file. The group, sam, has permission to read and write to sneakers.txt, as well. It is not a program, so neither the owner or the group has permission to execute it.
The chmod Command
Use the chmod command to change permissions. This example shows how to change the permissions on sneakers.txt with the chmod command.
The original file looks like this, with its initial permissions settings:
-rw-rw-r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
If you are the owner of the file or are logged into the root account, you can change any permissions for the owner, group, and others.
Right now, the owner and group can read and write to the file. Anyone outside of the group can only read the file (r--).
|
Caution |
|
Remember that file permissions are a security feature. Whenever you allow anyone else to read, write to, and execute files, you are increasing the risk of files being tampered with, altered, or deleted. As a rule, you should only grant read and write permissions to those who truly need them. |
In the following example, you want to allow everyone to write to the file, so they can read it, write notes in it, and save it. That means you will have to change the "others" section of the file permissions.
Look at the file first. At the shell prompt, type:
ls -l sneakers.txt |
The previous command displays this file information:
-rw-rw-r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
Now, type the following:
chmod o+w sneakers.txt |
The o+w command tells the system you want to give others write permission to the file sneakers.txt. To check the results, list the file's details again. Now, the file looks like this:
-rw-rw-rw- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
Now, everyone can read and write to the file.
To remove read and write permissions from sneakers.txt use the chmod command to take away both the read and write permissions.
chmod go-rw sneakers.txt |
By typing go-rw, you are telling the system to remove read and write permissions for the group and for others from the file sneakers.txt.
The result will look like this:
-rw------- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
Tpermission
Want to test your permissions skills? Remove all permissions from sneakers.txt — for everyone.
chmod a-rwx sneakers.txt |
Now, see if you can read the file with the command cat sneakers.txt, which should return the following:
cat: sneakers.txt: Permission denied |
Removing all permissions, including your own, successfully locked the file. But since the file belongs to you, you can always change its permissions back with the following command:
chmod u+rw sneakers.txt |
U
chmod a-x tigger |
to remove everyone has execute permissions.
Here is what happens now when you try to cd to into tigger:
bash: tigger: Permission denied |
Next, restore your own and your group's access:
chmod ug+x tigger |
Now, if you check your work with ls -l you will see that only others will be denied access to the tigger directory.
Changing Permissions With Numbers
Remember the reference to the shorthand method of chmod? Here is another way to change permissions, although it may seem a little complex at first.
Go back to the original permissions for sneakers.txt:
-rw-rw-r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
Each permission setting can be represented by a numerical value:
· r = 4
- (rw-) (rw-) (r--) | | | 4+2+0 4+2+0 4+0+0 |
Tould become six, four, and four (644).
To implement these new settings, type:
chmod 644 sneakers.txt |
Now verify the changes by listing the file. Type:
ls -l sneakers.txt |
The output should be:
-rw-r--r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt |
Now, neither the group nor others have write permission to sneakers.txt. To return the group's write access for the file, add the value of w (2) to the second set of permissions.
chmod 664 sneakers.txt |
|
Warning |
|
Setting permissions to 666 will allow everyone to read and write to a file or directory. Setting permissions to 777 allows everyone read, write, and execute permission. These permissions could allow tampering with sensitive files, so in general, it is not a good idea to use these settings. |
He effect.
# mount –tvfat –o ro /dev/fdo /mnt/floppy
The above command will mount a windows formatted (vfat) floppy in the read only mode under the sub directory /mnt/floppy (mount point). After mounting the floppy you can access it by entering in to the /mnt/floppy subdirectories. After mounting a floppy what ever you are copying to /mnt/floppy directory will be getting copied to the floppy disk.
# mount /dev/fdo /mnt/floppy
# mount /dev/cdrom /mnt/cdrom
# mount /dev/hda3 /mnt/c ( it is directory name to create own a /mnt directory.)
The mount command
#umount /mnt/cdrom
#umount /mnt/fdo
The /etc/mtab file:
The /etc/mtab file contain the information above the currently mounted file system. This file will automatically update. When you are mounting or unmounting partitions. Do not try to edit this file manually.
This is a text file which contain the information of the file system. [The rc.sysinit file is automatically mounted the this file]
/dev/hda1 / ext2 defaults 1 1
/dev/hda5 /home ext2 defaults,rw 1 2 1
/dev/hda3 /usr ext2 defaults 1 1
/dev/hdc /mnt/cdrom iso9660 user,noauto,ro 0 0
/dev/hda2 none swap sw 0 0
(Device name what partion (mount point) (fiel system type) (mount point option or permission) (dump interval)
what device) no of days since backup)
mkfs à make file name
# mkfs –t <>fs /dev/hds5 àformat the particular partition.
#df àSay in blocks.
#df –h <mount point> à Human readable format.
# du àDirectory Usage.
# du <director name> à Say in blocks.
# du –h <directory name> à Human readable format.
# tune2fs –j à say in blocks.(but not convert to ext3 to ext2)
One of the Linux most enjoyable qualities is the variety and number of s/w packages available it. User can download and install new or update s/w with little or no difficulty with RPM. It is provides detailed information and instructions for adding, removing, updating, checking and querying the s/w package using RPM.
# rpm <option> <package>
Generally a package’s file name will be in the following format.
E.g.
Opendap –2.0 –1.9 –i386.rpm
The RPM Command
Linux is having inbuilt command line tool named RPM to administrator the s/w package.
v Installing Package
v Upgrading Package.
v Removing Package.
v Querying Package.
v Verifying package.
-I à installing.
-v à verbose (show some useful information during the installation)
-h à Hash (print up to 50 hash mark (#) to illustrate the progress of the installation).
-e à uninstalling & removing.
-q à querying.
# rpm –l []option package
insert cd in the drive.
# mount /dev/cdrom /mnt/cdrom
# cd /mnt/cdrom
# ls
#cd redhat
# cd RPMS
# rpm –I openldap
# rpm –irh –force openldap –2.0 –1.9 .1386.rpm
To install old version package using use --oldpackage for --force
# rpm –ivh –oldpackage openladap –1.0 -1.9 .i386 .rpm
--replace files à To replace in all files.
-- nodeps à Do not perform dependency check before installing or upgrading a
package.
--test à(To check a file it is corrupted or not) don’t install the package or update the
database. Just identify and display possible conflicts or dependence error.
--ignorearch àdon’t check for a architecture.
# rpm –qf /etc/ahcpd.conf (to search a file)
# rpm –qa à To view a install all package.
# rpm –qi <Package name> à To display in all information in this package.
# rpm –ql <package> à Check all corresponding file in package.
# rpm -qc <>package name> à Only a configuration file.
# rpm –qR <package name> à libraries files and commands in corresponding package.
/usr/share/doc àAll documentation file.
# rpm –qd <package name> àAll documentation files are show in this method.
# rpm –V [package] àTo verify the status of files in package.
Backup And Recovery
Floppy, cdrom, Harddisk and Tap drive this are Backup storage device.
I) tar à tab archive.
II) cpio.
III) dd.
IV) dump.
# tar <option <>soured file [destination file]
-c àcreating archive.
-t àlist of all files in the backup.
-x àrestoring the backup or extracting.
-v àverbose.
-f àforce.
# tar –cvf /files.tar /etc
Destination source file
# tar –cvf /dev/fdo /etc à To send, backup store.
# tar –tvf /dev/fdo à view a backup store files.
# tar –xvf /dev/fdo à Extract method.
When you store a destination files. Destination storage device is greater than source file means, it is not ask question to insert another disk.
Linux and Unix are all full incremental backup method. Tar means full backup.
cpio (copy input and output)
-o à Tacking backup. Tape drive only use in this method.
-I à Restoring Backup.
-p à Tacking backup from one directory to another directory. (p means pass)
# cd /etc
# ls –l | cpio –pcvf /file (file is a destination path)
# cat /etc | cpio –pcvf /file. à Fully content are all store.
# dd à Copy a file one by one.
# dd if = /etc/passwd of = /dev/ …..
# dump <option> <argument> <files to be backup >
level 1 à Fully backup.
level 1-9 à Incremental backup.(Incremental backup is possible in dump command )
( it is same as bank data processing store method)
# /etc/dumpdates
Option:
-u à Full backup
# restore <option> /dev/hda6
-r àRestore all.
-x àParticular file only.
-c àTo compare a backup proper or not. (source file to destination file)
-c /dev/hda6 –D/etc
-D àTo compare a directory
to compare
-c /dev/hda6 –D/etc
# restore –rf /dev/hda6
-I àRestore a interactive command.
Performance Monitoring
To check process of the system.
v ps
v pgrep viewing the process, which is running in the system.
v Top
# ps –a àIt will be show in which terminal and what process are running.
# ps –A àOverall what process are running. ( same as ps -e)
# ps -f àFile listing, priority, time, parent processed. This are all include in file listing.
# ps –u <user name> à That current users starting time process only display.
-u <user name> àefficient user id.
-U <user id> àreal user id.
-g <group name> àgroup.
-G <>Group id> àreal group.
pgrep à process grep.
Find the process status with the help of process name.
pgrep <option> <pattern>
-n àexactly matching pattern
-l àProcess id will be display.
-v àexecuted the particular pattern.
-V àversion will be display.
# <process name>
# vi thenu & àBackground processes are running.
# jobs àView the background process.
# top à
# kill <process id> à To terminal the process.
-9 à Force killing.
-15 à Terminating.
kill –9 <process id>
pkill <processname>
# vmstat à Details of virtual memory ( it is part of HDD for the RAM) – virtual memory.
cd proc à Details of memory / swap information.
cpuinfo à Details of cpu information.
Process Scheduling
In Linux, tasks can be configured to run automatically with in a specified period of time, on a specified date, or when the system load average is below a specified number. Redhat Linux comes reconfigured to run important system tasks to keep the system update. For example, the slocate database used by the locate command is update daily. A system administrator can use automated tasks to perform periodic backups, monitor the system run custom scripts, and more.
Redhat Linux comes with four automated tasks utilities: cron, anacron, at and batch.
Cron
Cron is a daemon that can be used to schedule the execution of recurring tasks according to a combination of the time, date of the month, month, day of the week, and week. (Process is repeated to run at particular time). cron assumes that the system is on continuously. If the system is not on when a task is scheduled, it is not executed.
/etc/crontab
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
# crontab –e à Show VI editors mode.
Minutes hours day month day of week command
1-59 1-24 1-30 1-12 1-7 echo”hai”> /dev/tty/
50 16 12 8 * à All Times.
/var/spool/cron.d
# crontab –l à View all the command (option in crontab)
/etc/cron.allow
/etc/cron.deny
Processes are run at particular time. (Only one time)
at –l à list of all jobs.
at –rm à remove the jobs.
at –rm jobid
at –rm 5 To remove the job.