Changes Linux Cloud Workshop PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

CentOS 6.

5 Installation
1. Boot your system with CentOS bootable media or ISO, youll get
following screen.

CentOS Boot Menu


2. Check the media. You can Skip it.

Media Check
3. CentOS Installer started.

CentOS Installation
4. Language to choose during installation process.

Language Selection

5. Select Keyboard type.

Select Keyboard

6. Select Storage Devices Basic Storage Devices and Specialized


Storage Devices (For advanced users).

Select Storage Devices

7. Storage device warning, Click Yes, discard any data.

8. Give Hostname. Click on Configure Network button below if you


want to configure network settings during installation. Same can be
configure manually later on also.

Set Hostname

9. Select location.

10. Set root password.

11. Select Create Custom Layout to edit file system manually.

12. Selecting Standard Partition

13. Partitions review.

14. Format Warnings. Click Format which will erase existing data.

Device Formatting

15. Writing storage configuration to disk.

16. Formatting drive.

Formatting Devices

17. Bootloader installation confirmation. Check Use a boot loader


password box if you would like to give bootloader password.

18. Choose Desktop to install.

19. The installation has begun.

20. Relax Installation is still in progress. Have a cup of coffee to


get it 100%.

21. Installation is complete. Eject media and click on reboot.

22. Login Screen.

23. CentOS 6.5 Desktop.

Linux Directory Structure (File System Structure)

1. / - Parent Directory

Only root user has write privilege under this directory.

2. /bin User Binaries

Contains the list of commands that can be used by Normal user and
Super user.

For example: ps, ls, ping, grep, cp.

3. /sbin System Binaries

Contains the list of commands that can be used ONLY by Super


user.
For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc Configuration Files

Contains default configuration files required to install servers


and other services.
For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev Device Files

Contains device files.


Provides the information of devices connected to the machine.
For example: /dev/tty1, /dev/usbmon0

6. /proc Process Information

Contains information about system process.


This contains information about running process. For example:
/proc/{pid} directory contains information about the process with
that particular pid.

7. /var Variable Files

var stands for variable files.


This includes system log files (/var/log); packages and
database files (/var/lib); emails (/var/mail); print queues
(/var/spool); lock files (/var/lock); temp files needed across
reboots (/var/tmp);

8. /tmp Temporary Files

Directory that contains temporary files created by system and


users.
Files under this directory are deleted when system is rebooted.

9. /usr User Programs

Contains binaries, libraries, documentation, and source-code for


second level programs.
/usr/bin contains binary files for user programs.
/usr/sbin contains binary files for system administrators.
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source.
For example, when you install apache from source, it goes under
/usr/local/apache2

10. /home Home Directories

Home directories for all users to store their personal files.


For example: /home/john, /home/nikita

11. /boot Boot Loader Files

Contains boot loader related files.


Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24generic

12. /lib System Libraries

Contains library files that supports the binaries located under


/bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt Optional add-on Applications

opt stands for optional.

Third party applications should be installed under either /opt/


or /opt/ sub-directory.

14. /mnt Mount Directory

Temporary or Permanent mount directory where sysadmins can mount


filesystems.

15. /media Removable Media Devices

Temporary mount directory for removable devices.


For examples, /media/cdrom for CD-ROM; /media/floppy for floppy
drives; /media/cdrecorder for CD writer

16. /srv Service Data

srv stands for service.


Contains server specific services related data.
For example, /srv/cvs contains CVS related data.

Basic Linux Commands


To know present loggedin user
[vimals@linkshare ~]$ whoami
vimals
To find present working directory
[vimals@linkshare ~]$ pwd
/home/vimals
To list the files and directories

[vimals@linkshare /]$ ls
bin
net

boot dev
opt proc

etc home lib lib64 lost+found media misc mnt


root sbin selinux srv sys tmp u01 usr var

To enter into home directory of user


[vimals@linkshare /]$ cd /home/vimals

To create multiple directories


[vimals@linkshare ~]$ mkdir Dir1 Dir2 Dir3
To create a directory
[vimals@linkshare ~]$ mkdir Directory
To enter into the directory
[vimals@linkshare ~]$ cd Directory
[vimals@linkshare Directory]$ mkdir sub_directory
To come out of the directory
[vimals@linkshare Directory]$ cd ..
To create parent directory
[vimals@linkshare ~]$ mkdir -p world/asia/india/hyd
To list the recursive directories

[vimals@linkshare ~]$ ls -R world


world:
asia
world/asia:
india
world/asia/india:
hyd
world/asia/india/hyd:
[vimals@linkshare ~]$ cd world/asia/india/hyd/
To move one step behind
[vimals@linkshare hyd]$ cd ..
To move two steps behind
[vimals@linkshare india]$ cd ../..
[vimals@linkshare world]$
To create empty file
[vimals@linkshare ~]$ touch emp_file
To create multiple empty files
[vimals@linkshare ~]$ touch emp_file1 emp_file2 emp_file3

To create a file with cat


[vimals@linkshare ~]$ cat > myfile.txt
Hi... Happy New Year 2015..!!!!
To read the contents of the file
[vimals@linkshare ~]$ cat myfile.txt
Hi... Happy New Year 2015..!!!!
To append the file
[vimals@linkshare ~]$ cat >> myfile.txt
Wishing you a better start for the Career..!!
[vimals@linkshare ~]$ cat myfile.txt
Hi... Happy New Year 2015..!!!!
Wishing you a better start for the Career..!!
Copy Command
[vimals@linkshare ~]$ cat file1.txt
This is Record ONE..
[vimals@linkshare ~]$ cat file2.txt
This is Record TWO..
Copying source to destination

Note: Data in destination file is overwritten with the source file


[vimals@linkshare ~]$ cp file1.txt file2.txt
[vimals@linkshare ~]$ cat file1.txt
This is Record ONE..
[vimals@linkshare ~]$ cat file2.txt
This is Record ONE..
Copying the data without overwriting
[vimals@linkshare ~]$ cat > file1
This is file1
[vimals@linkshare ~]$ cat > file2
This is file2
[vimals@linkshare ~]$ cat file1 >> file2
[vimals@linkshare ~]$ cat file1
This is file1
[vimals@linkshare ~]$ cat file2
This is file2
This is file1

COPYING directories

[student@gss Desktop]$ mkdir Dir_1


[student@gss Desktop]$ cd Dir_1/
[student@gss Dir_1]$ touch d1 d2 d3
[student@gss Dir_1]$ cd ..

[student@gss Desktop]$ mkdir Dir_2


[student@gss Desktop]$ cd Dir_2
[student@gss Dir_2]$ touch e1 e2 e3
[student@gss Dir_2]$ cd ..
[student@gss Desktop]$ cp -rv Dir_1 Dir_2
`Dir_1' -> `Dir_2/Dir_1'
`Dir_1/d2' -> `Dir_2/Dir_1/d2'
`Dir_1/d3' -> `Dir_2/Dir_1/d3'
`Dir_1/d1' -> `Dir_2/Dir_1/d1'
To copy multiple files into a Directory
[student@gss Desktop]$ touch file1 file2 file3 file4
[student@gss Desktop]$ mkdir Boook
[student@gss Desktop]$ cp file1 file2 file3 file4 Boook/
[student@gss Desktop]$ cd Boook/
[student@gss Boook]$ ls
file1 file2 file3 file4
To copy All files to Directory
[student@gss Desktop]$ cp * Boook/

MOVE command
[vimals@linkshare ~]$ cat > Linux
This is a Linux classroom.
[vimals@linkshare ~]$ cat > Selenium
This is a selenium classroom
Moving linux to Selenium
[vimals@linkshare ~]$ mv Linux

Selenium

[vimals@linkshare ~]$ ls
Selenium

To rename a directory/file
[vimals@linkshare ~]$ ls
Mydir1

Mydir2

Renaming Mydir1 to New_name_Mydir3


[vimals@linkshare ~]$ mv Mydir1 New_name_Mydir3
[vimals@linkshare ~]$ ls
Mydir2

New_name_Mydir3

List[ls] commands:
Version of ls
[student@gss Desktop]$ ls --version
ls (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.

Display ALL information about Files/Directories


[student@gss Desktop]$ ls -l
total 16
-rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt
-rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt
-rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt
-rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt
Display File size in Human readable format total
[student@gss Desktop]$ ls -lh
16K
-rw-rw-r--. 1 student student 16 Feb 15 20:33 first.txt
-rw-rw-r--. 1 student student 4 Feb 15 20:34 fourth.txt
-rw-rw-r--. 1 student student 24 Feb 15 20:31 second.txt
-rw-rw-r--. 1 student student 7 Feb 15 20:33 third.txt

Display the details of directory


[student@gss Desktop]$ mkdir dir

[student@gss Desktop]$ ls -ld dir/


drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir/

Display files and Directories w.r.t last modification time in Reverse


Order
[student@gss Desktop]$ ls -ltr
total 20
-rw-rw-r--. 1 student student
24 Feb 15 20:31 second.txt
-rw-rw-r--. 1 student student
7 Feb 15 20:33 third.txt
-rw-rw-r--. 1 student student
16 Feb 15 20:33 first.txt
-rw-rw-r--. 1 student student
4 Feb 15 20:34 fourth.txt
drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir

Display Hidden files


[student@gss Desktop]$ ls -a
. .. dir first.txt fourth.txt

second.txt

Display without Hidden files


[student@gss Desktop]$ ls -A
dir first.txt fourth.txt second.txt

third.txt

third.txt

Display inode numbers


[student@gss Desktop]$ ls -il
total 20
654352 drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir
654290 -rw-rw-r--. 1 student student
16 Feb 15 20:33 first.txt
654318 -rw-rw-r--. 1 student student
4 Feb 15 20:34 fourth.txt
654345 -rw-rw-r--. 1 student student
24 Feb 15 20:31 second.txt
654348 -rw-rw-r--. 1 student student
7 Feb 15 20:33 third.txt
Display inode numbers in human readable format
[student@gss Desktop]$ ls -ilh
total 20K
654352 drwxrwxr-x. 2 student student 4.0K Feb 15 20:43 dir
654290 -rw-rw-r--. 1 student student
16 Feb 15 20:33 first.txt
654318 -rw-rw-r--. 1 student student
4 Feb 15 20:34 fourth.txt

654345 -rw-rw-r--. 1 student student


654348 -rw-rw-r--. 1 student student

24 Feb 15 20:31 second.txt


7 Feb 15 20:33 third.txt

Display inode number of a directory


[student@gss Desktop]$ ls -ild dir/
654352 drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir/

Sort files or Dir's by size


[student@gss Desktop]$ ls -lS
total 20
drwxrwxr-x. 2 student student 4096 Feb 15 20:43 dir
-rw-rw-r--. 1 student student
24 Feb 15 20:31 second.txt
-rw-rw-r--. 1 student student
16 Feb 15 20:33 first.txt
-rw-rw-r--. 1 student student
7 Feb 15 20:33 third.txt
-rw-rw-r--. 1 student student
4 Feb 15 20:34 fourth.txt

Sort files or Dir's by size in human readable format


[student@gss Desktop]$ ls -lSh
total 20K
drwxrwxr-x. 2 student student 4.0K Feb 15 20:43 dir
-rw-rw-r--. 1 student student
24 Feb 15 20:31 second.txt
-rw-rw-r--. 1 student student
16 Feb 15 20:33 first.txt
-rw-rw-r--. 1 student student
7 Feb 15 20:33 third.txt
-rw-rw-r--. 1 student student
4 Feb 15 20:34 fourth.txt
Wordcount
[vimals@linkshare ~]$ cat > wordcount
This is a workday.
This is a salesforce.
This is a Selenium Testing.

To Count Characters including special symbols


[vimals@linkshare ~]$ wc -c wordcount
79 wordcount
To Count Lines
[vimals@linkshare ~]$ wc -l wordcount
7 wordcount
To Count words
[vimals@linkshare ~]$ wc -w wordcount
13 wordcount

To find date
[vimals@linkshare ~]$ date
Tue Jan

6 23:12:54 IST 2015

To view calender
[vimals@linkshare ~]$ cal
January 2015
Su Mo Tu We Th Fr Sa

9 10

11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
To view calender of specific month of a year
[vimals@linkshare ~]$ cal 05 2015
May 2015
Su Mo Tu We Th Fr Sa

10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30 31
To perform calculations
[vimals@linkshare ~]$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software
Foundation, Inc.

This is free software with ABSOLUTELY NO WARRANTY.


For details type `warranty'.
2+2
4
Quit

EDITORS
Vim is an editor to create or edit a text file.
There are three modes in vim. One is the command mode, second is the
insert mode followed by Execution mode.
In the command mode, user can move around the file, delete text,
etc.
In the insert mode, user can insert text.
In Execution mode, user can save and quit the file.
Changing mode from one to another
From command mode to insert mode PRESS a/A/i/I/o/O
From insert mode to command mode PRESS Esc (escape key)
From command mode to execution mode PRESS shift+:

Insert Mode:
i Insert a text at current cursor position

I Insert text at the beginning of the line


a Append text after a current cursor position
A Append text to the end of current line
o Open up a new line below the current line and add text there
O Open up a new line above the current line and add text there
Command Mode
yw: To copy a word
yy: To copy a line
nyy: To copy n lines
dw: To delete a word
dd: To delete a line
ndd: To delete n lines
p: To paste
u: To undo
ctrl+r: To redo
G: To move to last line of a file
nG: To move to nth line of a line
w: move forward word by word
b: move backward word by word

/search-name: to search a word.


/hello

E.g: To search for the word hello use

Execute Mode
:q

To quit from a file without saving

:q! To quit with force


:w To save a file without quitting
:w! To save with force
:wq To save and quit
:wq!

To save and quit with force

:1,$s/find a word/replace with new word

Managing linux partitions with Fdisk


To view the list of partitions
[root@gss ~]# fdisk -cul
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001bc6a
Device Boot
/dev/sda1
*
/dev/sda2

Start
2048
411648

End
411647
51611647

Blocks
204800
25600000

Id
83
83

System
Linux
Linux

/dev/sda3
Solaris

51611648

53708799

1048576

82

Linux swap /

To view the help menu


[root@gss ~]# fdisk -cu /dev/sda
Command (m for help): m
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): n ######### To create a NEW Partition #########
Command action
e
extended
p
primary partition (1-4)
e ### Press e to create a EXTENDED Partition ####
Selected partition 4
First sector (53708800-62914559, default 53708800): PRESS ENTER BUTTON
Using default value 53708800
Last sector, +sectors or +size{K,M,G} (53708800-62914559, default
62914559): PRESS ENTER BUTTON
Using default value 62914559

Command (m for help): p ### To view the list of available partitions


####
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001bc6a
Device Boot
/dev/sda1
*
/dev/sda2
/dev/sda3
Solaris
/dev/sda4

Start
2048
411648
51611648

End
411647
51611647
53708799

Blocks
204800
25600000
1048576

Id
83
83
82

53708800

62914559

4602880

Command (m for help): w

System
Linux
Linux
Linux swap /
Extended

### To save ####

Restart the machine for the kernel update ### MANDATORY ###
[root@gss Desktop]#reboot
Creating Logical Partitions
[root@gss Desktop]# fdisk -cu /dev/sda
Command (m for help): n
First sector (54122496-62914559, default 54122496): PRESS ENTER BUTTON
Using default value 54122496
Last sector, +sectors or +size{K,M,G} (54122496-62914559, default
62914559): +200M
Format the partition with File Systeem
[root@gss ~]# mkfs -t ext4 /dev/sda5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks

51200 inodes, 204800 blocks


10240 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
25 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@gss ~]# mkfs -t ext4 /dev/sda6
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
51200 inodes, 204800 blocks
10240 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
25 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

To create a Mount Point


[root@gss ~]# mkdir /mnt/fdisk_partition
Mounting Partition /dev/sda5 on /mnt/fdisk_partition
[root@gss ~]# mount /dev/sda5 /mnt/fdisk_partition/

Creating files under Mount Point


[root@gss ~]# cd /mnt/fdisk_partition/
[root@gss fdisk_partition]# touch hello.txt hi.txt whoami.txt
[root@gss fdisk_partition]# ls
hello.txt hi.txt lost+found whoami.txt
[root@gss fdisk_partition]# reboot
In Temporay Mounting: Files are not found after the rebooting the
machine
[root@gss ~]# cd /mnt/fdisk_partition/
[root@gss fdisk_partition]# ls
[root@gss fdisk_partition]#

Permanent Mounting with fstab


[root@gss /]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Feb 3 17:44:09 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
info
#

UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
defaults
0 0
tmpfs
/dev/shm
defaults
0 0
devpts
/dev/pts
gid=5,mode=620 0 0
sysfs
/sys
defaults
0 0
proc
/proc
defaults
0 0
/dev/sda6
/mnt/fdisk_permanentpartition
defaults
0 0

ext4
ext4
swap
tmpfs
devpts
sysfs
proc
ext4

To update the fstab table


[root@gss /]# mount -a
[root@gss /]# df -h
Filesystem
Size Used Avail Use%
/dev/sda2
25G 6.6G
17G 29%
tmpfs
504M 228K 504M
1%
/dev/sda1
194M
27M 158M 15%
/dev/sr0
3.6G 3.6G
0 100%
/dev/sda6
194M 5.6M 179M
4%
/mnt/fdisk_permanentpartition

Mounted on
/
/dev/shm
/boot
/media/CentOS_6.4_Final

[root@gss /]# reboot


[root@gss /]# cd /mnt/fdisk_permanentpartition/
[root@gss fdisk_permanentpartition]# ls
data1.txt data2.txt data3.txt

To create a swap partition

[root@gss /]# mkswap /dev/sda5


Setting up swapspace version 1, size = 204796 KiB
no label, UUID=c1588cbc-7534-4150-bd9e-4693c986008a
[root@gss /]# swapon /dev/sda5
[root@gss /]# swapon -s
Filename
/dev/sda3
/dev/sda5

Type

Size Used Priority


partition 1048568
partition 204792

0
0

-1
-2

Size Used Priority


partition 1048568

-1

[root@gss /]# swapoff /dev/sda5


[root@gss /]# swapon -s
Filename
/dev/sda3

Type

[root@gss ~]# vim /etc/fstab


# /etc/fstab
# Created by anaconda on Mon Feb 3 17:44:09 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
info
#
UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
ext4
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
ext4
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
swap
defaults
0 0
tmpfs
/dev/shm
tmpfs
defaults
0 0
devpts
/dev/pts
devpts gid=5,mode=620
0 0
sysfs
/sys
sysfs
defaults
0 0

proc
0 0
/dev/sda6
defaults,pri=10

/proc

proc

swap
0 0

defaults

swap

[root@gss ~]# mount -a


[root@gss /]# swapon -a
[root@gss /]# reboot

[root@gss /]# swapon -s


Filename
/dev/sda3
/dev/sda5

Type

Size Used Priority


partition 1048568
partition 204792

To encrypt a partition
[root@gss ~]# cryptsetup luksFormat /dev/sda5
WARNING!
========
This will overwrite data on /dev/sda5 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: redhat
Verify passphrase: redhat
[root@gss ~]# cryptsetup luksOpen /dev/sda5 gss
Enter passphrase for /dev/sda5: redhat
[root@gss ~]# mkdir /mnt/disk_lock
[root@gss ~]# mkfs -t ext4 /dev/mapper/gss
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)

0
0

-1
10

Stride=0 blocks, Stripe width=0 blocks


25168 inodes, 100352 blocks
5017 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1936 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@gss ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Feb 3 17:44:09 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
info
#
UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
ext4
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
ext4
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
swap
defaults
0 0
tmpfs
/dev/shm
tmpfs
defaults
0 0
devpts
/dev/pts
devpts gid=5,mode=620
0 0

sysfs
0 0
proc
0 0
/dev/mapper/gss
0 0

/sys

sysfs

defaults

/proc

proc

defaults

/mnt/disk_lock

ext4

defaults

[root@gss ~]# vim /etc/crypttab


gss /dev/sda5
[root@gss ~]# mount -a
[root@gss ~]# reboot
To remove
[root@gss
[root@gss
[root@gss
[root@gss
[root@gss

the encryption
Desktop]# umount /mnt/disk_lock/
Desktop]# vim /etc/fstab ### Remove the entries #####
Desktop]# vim /etc/crypttab #### Remove the entries ####
Desktop]# cryptsetup luksClose gss
~]# reboot

**********************************************************************
******************************************************
************* LVM Configuration ***********
/dev/sda5
53710848
53915647
102400
83
/dev/sda6
53917696
54122495
102400
83
/dev/sda7
54124544
54226943
51200
83
[root@gss ~]# pvcreate /dev/sda{5,6,7}
WARNING: LUKS signature detected on /dev/sda5. Wipe it?
Wiping LUKS signature on /dev/sda5.
Physical volume "/dev/sda5" successfully created
Physical volume "/dev/sda6" successfully created
Physical volume "/dev/sda7" successfully created
[root@gss ~]# pvs
PV
VG
Fmt Attr PSize
PFree
/dev/sda5
lvm2 a-- 100.00m 100.00m
/dev/sda6
lvm2 a-- 100.00m 100.00m
/dev/sda7
lvm2 a-50.00m 50.00m
[root@gss ~]# pvdisplay
"/dev/sda5" is a new physical volume of "100.00 MiB"

Linux
Linux
Linux
[y/n] y

--- NEW Physical volume --PV Name


/dev/sda5
VG Name
PV Size
100.00 MiB
Allocatable
NO
PE Size
0
Total PE
0
Free PE
0
Allocated PE
0
PV UUID
Se3k9Y-vZPY-OBOM-44Go-4wHO-DgEx-vFFvrj
"/dev/sda6" is a new physical volume of "100.00 MiB"
--- NEW Physical volume --PV Name
/dev/sda6
VG Name
PV Size
100.00 MiB
Allocatable
NO
PE Size
0
Total PE
0
Free PE
0
Allocated PE
0
PV UUID
BoREd6-dPby-tqzW-CyD3-gxhd-5w2E-Hc2Gki
"/dev/sda7" is a new physical volume of "50.00 MiB"
--- NEW Physical volume --PV Name
/dev/sda7
VG Name
PV Size
50.00 MiB
Allocatable
NO
PE Size
0
Total PE
0
Free PE
0
Allocated PE
0
PV UUID
KU6pQp-y4VJ-jAPg-UG1e-hgAB-7IC4-C54DKl
**********************************************************************
**
creating volumeGroup

[root@gss ~]# vgcreate vol_grp1 /dev/sda5


Volume group "vol_grp1" successfully created
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
0
0 wz--n- 96.00m 96.00m
[root@gss ~]# vgdisplay
--- Volume group --VG Name
vol_grp1
System ID
Format
lvm2
Metadata Areas
1
Metadata Sequence No 1
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
0
Open LV
0
Max PV
0
Cur PV
1
Act PV
1
VG Size
96.00 MiB
PE Size
4.00 MiB
Total PE
24
Alloc PE / Size
0 / 0
Free PE / Size
24 / 96.00 MiB
VG UUID
8FOigJ-0PrC-WIBy-Rwuw-9aUW-C230-H47u52
[root@gss ~]# vgdisplay
--- Volume group --VG Name
System ID
Format
Metadata Areas
Metadata Sequence No
VG Access
VG Status
MAX LV
Cur LV
Open LV

vol_grp1
vol_grp1
lvm2
1
1
read/write
resizable
0
0
0

Max PV
Cur PV
Act PV
VG Size
PE Size
Total PE
Alloc PE / Size
Free PE / Size
VG UUID

0
1
1
96.00 MiB
4.00 MiB
24
0 / 0
24 / 96.00 MiB
8FOigJ-0PrC-WIBy-Rwuw-9aUW-C230-H47u52

[root@gss ~]# vgcreate vol_grp2 /dev/sda6


Volume group "vol_grp2" successfully created
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
0
0 wz--n- 96.00m 96.00m
vol_grp2
1
0
0 wz--n- 96.00m 96.00m
[root@gss ~]# vgdisplay vol_grp2
--- Volume group --VG Name
vol_grp2
System ID
Format
lvm2
Metadata Areas
1
Metadata Sequence No 1
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
0
Open LV
0
Max PV
0
Cur PV
1
Act PV
1
VG Size
96.00 MiB
PE Size
4.00 MiB
Total PE
24
Alloc PE / Size
0 / 0
Free PE / Size
24 / 96.00 MiB
VG UUID
Qrxh79-KcD1-LE0e-c316-fngY-7hAk-p7cYFy

[root@gss ~]# vgcreate vol_grp3 /dev/sda7


Volume group "vol_grp3" successfully created
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
0
0 wz--n- 96.00m 96.00m
vol_grp2
1
0
0 wz--n- 96.00m 96.00m
vol_grp3
1
0
0 wz--n- 48.00m 48.00m
[root@gss ~]# vgdisplay vol_grp3
--- Volume group --VG Name
vol_grp3
System ID
Format
lvm2
Metadata Areas
1
Metadata Sequence No 1
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
0
Open LV
0
Max PV
0
Cur PV
1
Act PV
1
VG Size
48.00 MiB
PE Size
4.00 MiB
Total PE
12
Alloc PE / Size
0 / 0
Free PE / Size
12 / 48.00 MiB
VG UUID
LeGp3O-Ku5k-4M8q-yNyR-mvRL-RzSU-Iy9Yqk
*****************************************************
To Create Logical Volume
[root@gss ~]# vgs
VG
#PV #LV #SN
vol_grp1
1
0
0
vol_grp2
1
0
0
vol_grp3
1
0
0
[root@gss ~]# lvcreate

Attr
VSize VFree
wz--n- 96.00m 96.00m
wz--n- 96.00m 96.00m
wz--n- 48.00m 48.00m
-L +50M -n log_vol1 vol_grp1

Rounding up size to full physical extent 52.00 MiB


Logical volume "log_vol1" created
[root@gss ~]# lvs
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-a---- 52.00m
[root@gss ~]# lvdisplay
--- Logical volume --LV Path
LV Name
VG Name
LV UUID
LV Write Access
LV Creation host, time
LV Status
# open
LV Size
Current LE
Segments
Allocation
Read ahead sectors
- currently set to
Block device

Move Log

/dev/vol_grp1/log_vol1
log_vol1
vol_grp1
utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt
read/write
gss.com, 2014-05-31 16:26:22 +0530
available
0
52.00 MiB
13
1
inherit
auto
256
253:0

[root@gss ~]# lvdisplay /dev/vol_grp1/log_vol1


--- Logical volume --LV Path
/dev/vol_grp1/log_vol1
LV Name
log_vol1
VG Name
vol_grp1
LV UUID
utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt
LV Write Access
read/write
LV Creation host, time gss.com, 2014-05-31 16:26:22 +0530
LV Status
available
# open
0
LV Size
52.00 MiB
Current LE
13
Segments
1
Allocation
inherit

Read ahead sectors


- currently set to
Block device

auto
256
253:0

[root@gss ~]# lvcreate -L +50M -n log_vol2 vol_grp2


Rounding up size to full physical extent 52.00 MiB
Logical volume "log_vol2" created
[root@gss ~]# lvs
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-a---- 52.00m
log_vol2 vol_grp2 -wi-a---- 52.00m

Move Log

[root@gss ~]# lvdisplay


--- Logical volume --LV Path
LV Name
VG Name
LV UUID
LV Write Access
LV Creation host, time
LV Status
# open
LV Size
Current LE
Segments
Allocation
Read ahead sectors
- currently set to
Block device

/dev/vol_grp2/log_vol2
log_vol2
vol_grp2
goVxt0-QsKS-QfoC-Hcif-LC7n-juLS-JnF7gn
read/write
gss.com, 2014-05-31 16:29:30 +0530
available
0
52.00 MiB
13
1
inherit
auto
256
253:1

--- Logical volume --LV Path


LV Name
VG Name
LV UUID
LV Write Access
LV Creation host, time

/dev/vol_grp1/log_vol1
log_vol1
vol_grp1
utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt
read/write
gss.com, 2014-05-31 16:26:22 +0530

LV Status
# open
LV Size
Current LE
Segments
Allocation
Read ahead sectors
- currently set to
Block device

available
0
52.00 MiB
13
1
inherit
auto
256
253:0

[root@gss ~]# lvdisplay /dev/vol_grp2/log_vol2


--- Logical volume --LV Path
/dev/vol_grp2/log_vol2
LV Name
log_vol2
VG Name
vol_grp2
LV UUID
goVxt0-QsKS-QfoC-Hcif-LC7n-juLS-JnF7gn
LV Write Access
read/write
LV Creation host, time gss.com, 2014-05-31 16:29:30 +0530
LV Status
available
# open
0
LV Size
52.00 MiB
Current LE
13
Segments
1
Allocation
inherit
Read ahead sectors
auto
- currently set to
256
Block device
253:1
****************************************************
Format the logical volume
[root@gss ~]# mkfs -t ext4 /dev/vol_grp1/log_vol1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
13328 inodes, 53248 blocks

2662 blocks (5.00%) reserved for the super user


First data block=1
Maximum filesystem blocks=54525952
7 block groups
8192 blocks per group, 8192 fragments per group
1904 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@gss ~]# mkfs -t ext4 /dev/vol_grp2/log_vol2
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
13328 inodes, 53248 blocks
2662 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=54525952
7 block groups
8192 blocks per group, 8192 fragments per group
1904 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

************************************************************
Creating mount point for volume groups
[root@gss ~]# mkdir /mnt/vol_grp1
[root@gss ~]# mkdir /mnt/vol_grp2
*****************************************************************
Permanently mounting the volume groups
[root@gss ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Feb 3 17:44:09 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
info
#
UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
ext4
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
ext4
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
swap
defaults
0 0
tmpfs
/dev/shm
tmpfs
defaults
0 0
devpts
/dev/pts
devpts gid=5,mode=620
0 0
sysfs
/sys
sysfs
defaults
0 0
proc
/proc
proc
defaults
0 0
/dev/mapper/vol_grp1-log_vol1
/mnt/vol_grp1
ext4
defaults
0 0

/dev/mapper/vol_grp2-log_vol2
defaults
0 0

/mnt/vol_grp2

ext4

[root@gss ~]# mount -a


[root@gss ~]# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs
(rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock
(rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sr0 on /media/CentOS_6.4_Final type iso9660
(ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=04
00,dmode=0500)
/dev/mapper/vol_grp1-log_vol1 on /mnt/vol_grp1 type ext4 (rw)
/dev/mapper/vol_grp2-log_vol2 on /mnt/vol_grp2 type ext4 (rw)
**********************************************************************
***
To resize the Logical Volume
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
1
0 wz--n- 96.00m 44.00m
vol_grp2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# lvs
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-ao--- 52.00m
log_vol2 vol_grp2 -wi-ao--- 52.00m

Move Log

[root@gss ~]# lvresize -L +20M /dev/vol_grp1/log_vol1


Extending logical volume log_vol1 to 72.00 MiB
Logical volume log_vol1 successfully resized
[root@gss ~]# lvs
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-ao--- 72.00m
log_vol2 vol_grp2 -wi-ao--- 52.00m

Move Log

[root@gss ~]# vgs


VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
1
0 wz--n- 96.00m 24.00m
vol_grp2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/sda2
25G 3.2G
20G 15% /
tmpfs
504M 228K 504M
1% /dev/shm
/dev/sda1
194M
27M 158M 15% /boot
/dev/sr0
3.6G 3.6G
0 100% /media/CentOS_6.4_Final
/dev/mapper/vol_grp1-log_vol1
51M 4.9M
43M 11% /mnt/vol_grp1
/dev/mapper/vol_grp2-log_vol2
51M 4.9M
43M 11% /mnt/vol_grp2
[root@gss ~]# resize2fs /dev/vol_grp1/log_vol1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vol_grp1/log_vol1 is mounted on /mnt/vol_grp1; online resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vol_grp1/log_vol1 to 73728 (1k)
blocks.
The filesystem on /dev/vol_grp1/log_vol1 is now 73728 blocks long.
[root@gss ~]# df -h
Filesystem
/dev/sda2

Size
25G

Used Avail Use% Mounted on


3.2G
20G 15% /

tmpfs
504M 228K
/dev/sda1
194M
27M
/dev/sr0
3.6G 3.6G
/dev/mapper/vol_grp1-log_vol1
70M 5.1M
/dev/mapper/vol_grp2-log_vol2
51M 4.9M

504M
1% /dev/shm
158M 15% /boot
0 100% /media/CentOS_6.4_Final
62M

8% /mnt/vol_grp1

43M

11% /mnt/vol_grp2

*****************************************************************
To reduce the logical volume
[root@gss ~]# umount /dev/vol_grp1/log_vol1
/mnt/vol_grp1

or [root@gss ~]# umount

[root@gss ~]# df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/sda2
25G 3.2G
20G 15% /
tmpfs
504M 228K 504M
1% /dev/shm
/dev/sda1
194M
27M 158M 15% /boot
/dev/sr0
3.6G 3.6G
0 100% /media/CentOS_6.4_Final
/dev/mapper/vol_grp2-log_vol2
51M 4.9M
43M 11% /mnt/vol_grp2
[root@gss ~]# fsck -f /dev/vol_grp1/log_vol1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
fsck.ext2: Is a directory while trying to open /dev/vol_grp1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2

filesystem (and not swap or ufs or something else), then the


superblock
is corrupt, and you might try running e2fsck with an alternate
superblock:
e2fsck -b 8193 <device>
[root@gss ~]# resize2fs -p /dev/vol_grp1/log_vol1 30M
resize2fs 1.41.12 (17-May-2010)
Please run 'e2fsck -f /dev/vol_grp1/log_vol1' first.
[root@gss ~]# lvreduce -L 30M /dev/vol_grp1/log_vol1
Rounding size to boundary between physical extents: 32.00 MiB
WARNING: Reducing active logical volume to 32.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce log_vol1? [y/n]: y
Reducing logical volume log_vol1 to 32.00 MiB
Logical volume log_vol1 successfully resized
[root@gss ~]# lvs
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-a---- 32.00m
log_vol2 vol_grp2 -wi-ao--- 52.00m
*************************************
Mount the logical volume again
[root@gss ~]# mount -a
**********************************
Removing LV, VG and PV
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vol_grp1
1
1
0 wz--n- 96.00m 64.00m
vol_grp2
1
1
0 wz--n- 96.00m 44.00m
vol_grp3
1
0
0 wz--n- 48.00m 48.00m
[root@gss ~]# lvs

Move Log

LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-a---- 32.00m
log_vol2 vol_grp2 -wi-ao--- 52.00m
[root@gss ~]# pvs
PV
VG
Fmt Attr PSize PFree
/dev/sda5 vol_grp1 lvm2 a-- 96.00m 64.00m
/dev/sda6 vol_grp2 lvm2 a-- 96.00m 44.00m
/dev/sda7 vol_grp3 lvm2 a-- 48.00m 48.00m

Move Log

Vim /etc/fstab
################REMOVE THE FOLLOWING LINES FROM THE FILE AND SAVE
IT#################
/dev/mapper/vol_grp1-log_vol1
/mnt/vol_grp1
ext4
defaults
0 0
/dev/mapper/vol_grp2-log_vol2
/mnt/vol_grp2
ext4
defaults
0 0

[root@gss ~]# lvremove /dev/vol_grp1/log_vol1


Do you really want to remove active logical volume log_vol1? [y/n]: y
Logical volume "log_vol1" successfully removed
[root@gss ~]# vgremove vol_grp1
Volume group "vol_grp1" successfully removed
[root@gss ~]# pvs
PV
VG
Fmt Attr PSize
PFree
/dev/sda5
lvm2 a-- 100.00m 100.00m
/dev/sda6 vol_grp2 lvm2 a-96.00m 44.00m
/dev/sda7 vol_grp3 lvm2 a-48.00m 48.00m
[root@gss ~]# pvremove /dev/sda5
Labels on physical volume "/dev/sda5" successfully wiped
[root@gss ~]# lvremove /dev/vol_grp2/log_vol2
Do you really want to remove active logical volume log_vol2? [y/n]: y
Logical volume "log_vol2" successfully removed
[root@gss ~]# vgremove vol_grp2
Volume group "vol_grp2" successfully removed
[root@gss ~]# pvremove /dev/sda6
Labels on physical volume "/dev/sda6" successfully wiped

********************************************************************
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vg1
1
1
0 wz--n- 96.00m 64.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgextend vg1 /dev/sda7
No physical volume label read from /dev/sda7
Physical volume "/dev/sda7" successfully created
Volume group "vg1" successfully extended
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize
VFree
vg1
2
1
0 wz--n- 144.00m 112.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgreduce vg1 /dev/sda7
Removed "/dev/sda7" from volume group "vg1"
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vg1
1
1
0 wz--n- 96.00m 64.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgcreate vg3 /dev/sda7
Volume group "vg3" successfully created
[root@gss ~]# vgmerge vg1 vg3
Volume group "vg3" successfully merged into "vg1"
[root@gss ~]# vgsplit vg1 vg3 /dev/sda7
New volume group "vg3" successfully split from "vg1"

***************************************************************

USER AND GROUP ADMINISTRATION


***************************************************************
***-***********************************
CREATING USERS AND GROUPS
*******************************************
[root@gss ~]# useradd centos
[root@gss ~]# passwd centos
Changing password for user centos.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
-------------------------------------------------------------[root@gss ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
rtkit:x:499:497:RealtimeKit:/proc:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahiautoipd:/sbin/nologin
pulse:x:498:496:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin

haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
saslauth:x:497:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
student:x:500:500::/home/student:/bin/bash
centos:x:501:501::/home/centos:/bin/bash
---------------------------------------------------------------------------[root@gss ~]# cat /etc/shadow
root:$6$lJlCBi9cCMDewWga$QI2AfHrMrvfqFO9HiH/GYy5CdFKh.3gnCuJ87nasjPUpd
Rpx3ja6y9yu7Zd666cfw7rW4J5loVmX0flOFXPUh1:16104:0:99999:7:::
bin:*:15628:0:99999:7:::
daemon:*:15628:0:99999:7:::
adm:*:15628:0:99999:7:::
lp:*:15628:0:99999:7:::
sync:*:15628:0:99999:7:::
shutdown:*:15628:0:99999:7:::
halt:*:15628:0:99999:7:::
mail:*:15628:0:99999:7:::
uucp:*:15628:0:99999:7:::
operator:*:15628:0:99999:7:::
games:*:15628:0:99999:7:::
gopher:*:15628:0:99999:7:::
ftp:*:15628:0:99999:7:::
nobody:*:15628:0:99999:7:::
dbus:!!:16104::::::
usbmuxd:!!:16104::::::
vcsa:!!:16104::::::
rpc:!!:16104:0:99999:7:::
rtkit:!!:16104::::::
avahi-autoipd:!!:16104::::::

pulse:!!:16104::::::
haldaemon:!!:16104::::::
ntp:!!:16104::::::
apache:!!:16104::::::
saslauth:!!:16104::::::
postfix:!!:16104::::::
abrt:!!:16104::::::
rpcuser:!!:16104::::::
nfsnobody:!!:16104::::::
gdm:!!:16104::::::
sshd:!!:16104::::::
tcpdump:!!:16104::::::
student:$6$G1zJyUfcwV8cIsFV$hzpxmKL7rEkcXfiYbYY6JVhNT8K4O0NH9Ro1XM92YU
TgNuH8eCYMwcJ/FNekbkurAWoc9VgJ1npYTJBwDpN2P.:16107:0:99999:7:::
centos:$6$.h/1EAQB$j7Y7Cce82PjDXuGpPCZv5uukXWB.q1hntgsEZO7xXPrm3AQUQZS
UK2iBNHxi.MeRxd0f9of5gqsy1mxxXfRYH0:16222:0:99999:7:::
-----------------------------------------------------------------CREATING USER WITH USER ID
[root@gss ~]# useradd -u 505 narendra
[root@gss ~]# passwd narendra
Changing password for user narendra.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@gss ~]# grep narendra /etc/passwd
narendra:x:505:505::/home/narendra:/bin/bash
[root@gss ~]# usermod -u 510 narendra
[root@gss ~]# grep narendra /etc/passwd
narendra:x:510:505::/home/narendra:/bin/bash
--------------------------------------------------------------------[root@gss ~]# useradd -c "PM of INDIA" modi
[root@gss ~]# grep modi /etc/passwd
modi:x:511:511:PM of INDIA:/home/modi:/bin/bash

[root@gss ~]# usermod -c "NARENDRA_MODI PM OF INDIA" modi


[root@gss ~]# grep modi /etc/passwd
modi:x:511:511:NARENDRA_MODI PM OF INDIA:/home/modi:/bin/bash
---------------------------------------------------------------------[root@gss /]# useradd -d /home/NAMO narendra_modi
[root@gss /]# grep narendra_modi /etc/passwd
narendra_modi:x:512:512::/home/NAMO:/bin/bash
[root@gss /]# usermod -d /home/NAMO_PM narendra_modi
[root@gss /]# grep narendra_modi /etc/passwd
narendra_modi:x:512:512::/home/NAMO_PM:/bin/bash
---------------------------------------------------------------------[root@gss /]# useradd -s /bin/bash Harsha
[root@gss /]# grep Harsha /etc/passwd
Harsha:x:513:513::/home/Harsha:/bin/bash
[root@gss /]# usermod -s /sbin/nologin Harsha
[root@gss /]# grep Harsha /etc/passwd
Harsha:x:513:513::/home/Harsha:/sbin/nologin
-----------------------------------------------------------------[root@gss /]# usermod -L centos
[root@gss /]# su - centos
Password:
su: incorrect password
[root@gss /]# usermod -U centos
[root@gss /]# su - centos
Password:
[centos@gss ~]$
------------------------------------------------------[root@gss /]# userdel Harsha

[root@gss home]# ls
centos Harsha NAMO

student

[root@gss /]# userdel -r centos


[root@gss /]# cd /home
[root@gss home]# ls
NAMO student
--------------------------------------------------------[root@gss /]# usermod -l Newname Oldname
--------------------------------------------------------[root@gss /]# groupadd sales_GSS
[root@gss /]# grep sales_GSS /etc/group
sales_GSS:x:501:

[root@gss /]# groupadd -g 575 finance_GSS


[root@gss /]# grep finance_GSS /etc/group
finance_GSS:x:575:

[root@gss /]# groupmod -n newgrp_name oldgrp_name

[root@gss /]# gpasswd -a tom servicedesk_GSS


Adding user tom to group servicedesk_GSS
[root@gss /]# grep servicedesk_GSS /etc/group
servicedesk_GSS:x:501:tom
[root@gss /]# gpasswd -d tom servicedesk_GSS
Removing user tom from group servicedesk_GSS
[root@gss /]# grep servicedesk_GSS /etc/group
servicedesk_GSS:x:501:

[root@gss /]# gpasswd -M tom,dick,harry servicedesk_GSS


[root@gss /]# grep servicedesk_GSS /etc/group
servicedesk_GSS:x:501:tom,dick,harry

You might also like