VMWARE TOOLS COMMAND
#
cp /media/VMware\ Tools/VMwareTools-9.9.0-2304977.tar.gz /tmp/
#
ll /tmp/
#
tar –zxvf /tmp/VMwareTools-9.9.0-2304977.tar.gz
#
cd/root/Desktop/vmware-tools-distrib/
#
ll
#
./vmware-install.pl
#
/usr/bin/vmware-toolbox-cmd
#
reboot
INTRODUTION OF LINUX
Getting
started with Linux
UNIX -> Bell LAB (1969)- Dennis Ritchie
-> Based on "C" Language
UNIX Distribution:
=> IBM - AIX
=> HP - HPUX
=> SUN - SUN Solaris
=> UNIX-BSD
1969
- UNIX was Devloped, Ken Thompson and Dennis Ritchie
1971
- First edition of Unix released 11/03/1971.
1983
- AT&T is splitted -> It can sell software
1983
- The GNU project is first announced by Richard Stallman
1983
- GNU (GNU Not UNIX) - 1983
A program is
free software if the program's users have the four essential freedoms:
=>
The freedom to run the program as you wish, for any purpose (freedom 0).
=>
The freedom to study how the program works, and change as you wish (freedom 1).
=>
The freedom to redistribute copies so you can help your neighbor (freedom 2).
=>
The freedom to distribute copies of your modified versions to others (freedom
3).
By
doing this you can give the whole community a chance to benefit from your
changes.
1986
- HP-UX 1.0 released.
1987
- Sun introduced
1987
- Minix Released
1991
- Linux is introduced by Linus Torvalds, a student in Finland.
Finland (Helsinki), 4th Year
1994
- Red Hat Linux is introduced.
1994
- Caldera, Inc was founded in 1994
2004
- The first release of Ubuntu is released October 20
2001
- Red Hat Enterprise Linux -
Kernel:
-> Hardware Management
-> Process Management
-> Driver Management
-> Memory Management
Linux Distribution:
-> Red Hat (Commercial) and Enterprise
Support
-> Fedora
-> CentOS
-> Ubuntu
-> Debian
-> Mint
-> BackTrack
-> Kali Linux
-> Slackware
-> Oracle Linux
-> Open SUSE
-> Mandrake
-> Scientific Linux
-> Open BSD
-> Free BSD
-> Android (Linux Kernel)
Version:
RHEL6.0
RHEL6.1
RHEL6.2
………………………….
RHEL 6.5
RHEL 7.0(Current)
OS Types:
=> Desktop
=> Server
=> IBM PowerPC
=> Super Computer
=> LiveOS
OS Architecture:
x86 (32 bit):i386, 2^32
x86_64 (64 Bit): x64, 2^64
Why Linux:
->
Security
-> Free and Open source
-> 10x Times Faster Thand Windows
-> Lighter
->Virus less
-> Crash Less
-> Low Hardware Requirements
-> Multiuser System & Multitasking
System
RHCSA - Red Hat Certified System
Administrator (300 Marks)
RHCE - Red Hat Certified Engineer (300 Marks)
=> Pass mark: 210 for each part
=> Cost: $400 + $100(Original Book)
=> Total RHCE in Bangladesh: 1000+
=> Exam Types: Fully LAB based exam
=> Duration: 4.5 Hrs (Apporx.)
=> Authorized Partner in BD: IBCS,
ITBangla, AT, Patshala, BASE
Linux File System: ext2, ext3, ext4, xfs,
birtFS, jfs
Windows: NTFS, FAT32
Drive Letter:
Windows: C ..... Z
Linux:
SATA -> sdx1, sdx2 .............. sdx15 (x=a,b,c,d)
DVD -> sr0/dvd
USB -> sdx1 (x=a,b,c,d)
Floppy ->fd
Requied Partition:
Windows:
C
Recommanded: Linux: "/boot",
"/", "swap"
=> / (root), Swap (virtual
Memory)
Filesytem Size:
/boot: 200MB
/ : as required (3G+)
swap: 1G+ depends on RAM (max
64GB)
Linux Installation:
=> Dual Boot: Linux + others (Free Space: 8G)
=> Single Boot: Linux
=> Virtual BOx/VMware (Free Space:
8G)
Installaiton Kits:
=> Dual Boot: DVD/USB/Network
=> Single BOot: DVD/USB/Network
=> Virtual Box: ISO/DVD/Network
INTRODUCTION OF DIRECTORY
/ = All directories are grouped. Under
the root directory.
/root = Home directory of root
user/super user/administrative user.
/home = Users directory.
/bin = Admin and users command
directory.
/sbin = Admin command directory.
/lib = linux shared file.
/media = CD/DVD mount directory.
/mnt = Temporary media such as network
drive, pen drive mount directory.
/dev =
All device file.
/etc = OS or main configuration file
directory.
/boot = kernel or boot file directory.
/lost+found = deleted file directory.
/proc = Task manager or status save file
directory.
/temp = Temporary save file directory.
/usr = Installed programmes file directory.
/var = log file, cache file, printer
file, mail file directory.
/opt = provides a location for optional
application to installed
/srv= provides a location for data used
by servers.
/sys = contains information about the
system.
Run Level
0 =
shout down.
1 = single user mode/ safe mode with
network.
2 = multiuser mode/ safe mode with
network.
3 = Full multi user mode / command mode.
4 = used
5 = s11 / graphical mode.
6 = restart.
SOME BASIC COMMAND
MANAGING DIRECTORY AND FILE
[root@ns1
Desktop]#
1
2 3 4
1: user name
2: hostname
3: user's current locaiton
4: user types (root: #, normal user:
$)
LINUX USER'S TYPES:
=>root
user: Administrator (#)
=>system user: service
(mail/ftp/games/daemon)- cannot login
=>regular user: student, guest, delwar ($)
[root@ns1 ~]#
cd :
change directory
[root@desktopX
~]# ls : list of files and dir.
[root@ns1 ~]#
ll : file and dir
properties
OR
[root@ns1 ~]#
ls -l : file and dir properties
[root@desktopX
~]# ls -la : details lis~t with hidden
files and dir
[root@desktopX
~]# ls -li : list of inode no
[root@desktopX
~]# ls -lZ : shows SELinux Context
[root@desktopX
~]# pwd : current working dir
DIRECTORY
AND FILE SYMBOL COLOR:
dir - blue
file - b&w
red - compress
(rpm/zip/rar)
green -
execute file
yellow -
device (terminal/cd/dvd/usb/hdd)
cyan - link
file
magenta -
Picture/image/media
FILE
TYPE:
[root@ns1 ~]#
mkdir mydir
[root@ns1 ~]#
touch test
[root@ns1 ~]#
ln -s test test5
[root@ns1 ~]#
touch test.tar
[root@ns1 ~]#
touch mi4.avi
[root@ns1 ~]#
touch me.jpeg
[root@ns1 ~]#
ls
COMMAND
SIGN:
"~" => home dir
"/" => root partition
"/root" => root's home dir
"/home" => user's home
for example:
/home/delwar
[root@desktopX
~]# => root's user home dir
[root@desktopX
~]# cd : change
directory
[root@desktopX
~]# cd - : back to
previous dir
[root@desktopX
~]# cd . :current dir
[root@desktopX
~]# cd .. :single step back dir
[root@desktopX
/]# cd /home/stuedent/mahdi_dir :
intended dir
[root@desktopX
opt]# pwd : present working dir
PATH
FORMAT:
=> Absolute path /var/ftp/pub : starting with "/"
=> Rlative path var/ftp/pub
: not starting with
"/"
SCREEN:
# ctrl + l = srceen clear
# ctrl + shift
+++ = screen size increase (GUI)
# ctrl + "----" = screen size
decrease (GUI)
# ctrl + shift + "t" => new
terminal (tab) (GUI)
Alt + Ctrl + F2, F3, F4, F5, F6 => new CMD
terminal
Alt + Ctrl + F1 => GUI
CREATE
FILE, DIRECTORY AND REMOVE FILE, DIRECTORY:
[root@ns1
class03]# touch reza_cv :
file create
[root@ns1
class03]# touch test1 test2 test3 :
multiple files create with single command
[root@ns1
class03]# mkdir linux1 linux2 linux3 :
multiple dirs create with single command
[root@ns1
class03]# touch file{1..10} : create multiple file
[root@ns1
class03]# mkdir linux{1,2,3} :
create multiple directory.
[root@ns1
class03]# ll : view the directory content.
[root@ns1
class03]# mkdir soft/windows/office -p :
create a directory with multiple sub-directory at a time
[root@ns1
class03]# rm -rf * :rm remove : -r recursive
remove: -f force remove, * all
[root@ns1
class03]# touch test
[root@ns1
class03]# mkdir linux1
[root@ns1
class03]# ls -l
d rwx r-x r-x
2 root root 4096 Feb 4
18:06 linux1
- rw- r--
r-- 0 root root
0 Feb 4 18:06 test1
1 2a
2b 2c 3 4 5 6 7 8
1: file/dir types
2: file/dir permission: 2a: user permission, 2b: group permission,
2c: others permission
3: file/dir link
4: file/dir owner
5: file/dir group owner
6: file/dir size
7: file/dir modify date
8: file/dir name
Linux
FIle & Dir types:
d =
directory : regular directory
l = link file : /dev/stdin
s = socket : /dev/log
- = regular file : text/any file
p = process file : /dev/initctl
b = device CD/DVD/HDD : /dev/sdb, /dev/sr0
c = character device (serial/prallel/printer):
/dev/tty
FIle/dir
Permission:
r = read
w = write
x = execute
- = no permission
Copy/paste/remove/rename/delete:
[root@ns1
class02]# touch mycv
[root@ns1
class02]# cp mycv myresume :
file copy
[root@ns1
class02]# cp mycv /home/student :
same name
[root@ns1
class02]# cp mycv /home/student/newcv :
diffrent name
[root@ns1
class02]# cd /home/student
[root@ns1
student]# cd -
[root@ns1
class02]# rm mycv : file remove
with confirmation
rm: remove
regular empty file `mycv'? y: press y
[root@ns1
class02]# rm -f test
: file delete without confirmation
[root@ns1
class02]# mv myresume biodata : move or rename
[root@ns1
class02]# cp -r linux1 linux3 : copy
file or dir
[root@ns1
class02]# rmdir linux1 : delete emty
dir
[root@ns1
class02]# rm -r linux3
: delete dir with content and confirmation
[root@ns1
class02]# rm -rf linux3 : delete dir with contains and without
confirmation
[root@ns1
class02]# cp /etc/passwd . :copy to current dir
[root@ns1
class02]# rm -rf * : delete everything from curent dir
rm : empty file remove
rm -f : force
remve
rmdir : empty dir remove
To lock the scree n, sel ect (User)> Lock
or type Ct rl+Alt+L. The screen will lock if the
graphical
sess ion is
idle for a few minutes.
[root@ns1
class02]# file /home/student/mahdi_dir/mizan1 : what is it
COMPRESS AND UNCOMPRESS
COMMAND
compression:
Windows: zip, rar, 7zip
linux: .gz, .bz2, optional (.zip, .rar)
Archive:
.tar
Archive +
compression:
.tar.gz
.tar.bz2
7MB:
.gz(3MB)compress, .bz2(1.5MB)more compress
Archive (tar):
[root@server1 ~]#
mkdir /linux31/class09 -p
[root@server1 ~]# cd /linux31/class09
[root@server1 class09]# cp /etc/passwd .
[root@server1 class09]# cp -r /etc /linux31/class09
[root@server1 class09]# ls
[root@server1 class09]# du -ch * : view size of file and dir
Archive:
[root@server1 class09]# tar -cvf etcarchive.tar etc [dir]
[root@server1 class09]# ls
[root@server1 class09]# du -ch *
[root@server1 class09]# rm -rf etc
[root@server1 class09]# ls
Arcive extract:
[root@server1 class09]# tar -xvf etcarchive.tar
[root@server1 class09]# ll
archive + compress:
[root@server1
class09]# tar -czvf etcbackup.tar.gz etc
[root@server1 class09]# ll
[root@server1 class09]# du -ch etcbackup.tar.gz
extract:
[root@server1
class09]# tar -xzvf etcbackup.tar.gz
[root@server1 class09]# ll
archive + more compress:
[root@server1
class09]# tar -cjvf etc.tar.bz2 etc
[root@server1 class09]# ll
[root@server1 class09]# du -ch etc.tar.bz2
extract:
[root@server1 class09]# rm -rf etc
[root@server1 class09]# tar -xjvf etc.tar.bz2
[root@server1 class09]# ls
compress:
[root@server1 class09]# gzip passwd [filename]
[root@server1 class09]# ls
etc passwd.gz
extract:
[root@server1 class09]# gunzip passwd.gz
[root@server1 class09]# ls
etc passwd
more compress:
[root@server1
class09]# bzip2 passwd
[root@server1 class09]# ls
etc passwd.bz2
extract:
[root@server1 class09]# bunzip2 passwd.bz2
[root@server1 class09]# lsetc passwd
[root@server1 class09]#
Text file edit command
Windows Text Editor: notepad, notepadd++
Linux Text Editor: vi/vim, nano, emac, pico,
gedit (GUI)
Most propular/Advanced Text Editor: Vi/Vim
=>vi - old, b&w, default
=>vim - advanced, colorfull
(Package must be installed)
[root@ns1 ~]# mkdir /linux31/class05 -p
[root@ns1 ~]# cd /linux31/class05
[root@ns1 class05]# ls
[root@ns1 class05]# touch test : create new file
[root@ns1 class05]# echo "hello how r
u" > test
[root@ns1 class05]# cat test
[root@ns1 class05]# echo "my name is
ikbal" >> test
[root@ns1 class05]# cat test
[root@ns1 class05]# ls
[root@ns1 class05]# vi file1 : edit newfile
[root@ns1 class05]# vi test : edit existing file with vi
[root@ns1 class05]# vim test
[root@ns1 class05]# nano test : nano must be installed
[root@ns1 class05]# emacs test : emacks must be installed
[root@ns1 class05]# cp /etc/passwd . :copy
passwd file "into here"
[root@ns1 class05]# ls passwd
test
vi/vim Mode:
=>command mode: cursor movement and
text search.
=> insert
mode : press "i" or "insert" button
=>exit mode : press "esc"
button form keyboard
OPEN FILE WITH VIM:
·
vim
master.txt : file open.
·
vim -m
master.txt : open file but do not
save condition.
·
vim -R
master.txt : open read only mode.
·
vim -n
master.txt : open file but do not
create swap file.
·
vim -r
master.txt : recover crash file from swap.
·
vim -x
master.txt : save file with encrypted and edit file with
decrypted.
EXECUTIVE MODE:
[root@ns1 class05]# vi file1
=> Press "i" for insert mode
=> write something as your requirments
=>press "esc" button exit
from "insert" mode
=> :x :
save and quit
=> :q!
: exit without save
=> :w :
only save not quit
=> :set nu : shows content as line no
=>
:setnonu :hide line no
SHORTCURT COMMAND:
h=
left cursor move.
l=
right cursor move.
j=cursor
move down.
k=cursor
move up.
B=
back a word.
W=
front a word.
(=
back a sentence
)=
front a sentence
{=
back a para
}=front
a para
gg=
go 1st line.
10gg=
go 1st 10 line.
TEXT SEARCH:
/text
: search from under of page.
?text
: search from up of page
n
: show one by one from under
N
:show one by one from up
INSERT MODE:
i= write from behind of cursor.
a=
write from front of cursor
I=
write from first of a line.
A=write
from last of a line.
o=
write from beneath of a line.
O=write
from up of a line.
COPY, PASTE, DELETE& OTHERS COMMAND:
[root@ns1 class05]# cat file1
[root@ns1 class05]# vim passwd
:set
nu
=>dd : one line delete
=>ndd : n lines delete
=>dw : word delete/cut
=>yy : one line copy
=>nyy : n lines copy
=>yw : word copy
=>yl : letter copy
=>2yl : 2 letter copy
=>p: paste (below), P(above)
=> 1+shift+g : move cursor at 1st line
=>shift+g : move cursor at last line
=> 25+shift+g : move cursor at 25th
line
=>ctrl + r : redo
=>u: undo
=>o
=>shift + d : cut lines from
current cursor position
=> /search (pattern) i.e: /root
->n (next)
-> N (previous)
=> :%s/old/new/g : replace old with
new word
note:
all command in "esc" mode
NETWORK SETTING
CONFIGURATION
IPV4 (LAN/MAN/WAN)
Class
A: 0.0.0.0 - 126.255.255.255
Class B: 128.0.0.0 - 191.255.255.255
Class C: 192.0.0.0 - 223.255.255.255
Private:
A: 10.0.0.0 - 10.255.255.255
B: 172.16.0.0 - 172.31.255.255
C: 192.168.0.0 - 192.168.255.255
Linux Network Management
Windows NIC1: Local Area Netowrk
Windows NIC2: Local Area Network 2
Linux
1st NIC : eth0
2nd NIC : eth1
loopback:
lo
virtual
: eth0:0
Bridge : br0
Wireless: wl0
Check All LAN Card Status
[root@ns1
~]# ifconfig
[root@ns1
~]# ifconfig eth0 : sepecific LAN
HWaddr 8C:89:A5:E4:F3:64 => MAC
inet
addr:192.168.11.254 => IP Address
Bcast:192.168.11.255
Mask:255.255.255.0
Check Physical Connectivity
[root@ns1
~]# mii-tool eth0
eth0: negotiated 100baseTx-FD flow-control,
link ok
Check Default Gateway:
[root@ns1
~]# route -n
Gateway Testing
[root@ns1
~]# ping 192.168.11.1
64
bytes from 192.168.11.1: icmp_seq=1 ttl=64 time=0.451 ms
64
bytes from 192.168.11.1: icmp_seq=2 ttl=64 time=0.317 ms
[root@ns1
~]# ping -c 4 192.168.11.1
IP Configure
=>Tempoary
(IP remove after system reboot)
=> Parmanet
Temporay configure
[root@ns1
~]# ifconfig eth0 192.168.11.x [x is IP
address]
[root@ns1 ~]# ifconfig
[root@ns1 ~]# ifconfig eth0 192.168.11.x
netmask 255.255.255.0
[root@ns1 ~]# ifconfig
[root@ns1 ~]# route add default gw 192.168.11.1
[root@ns1 ~]# route -n
LAN Enable and Disable
[root@ns1 ~]# ifdown eth0
[root@ns1 ~]# ifconfig
[root@ns1 ~]# ifup eth0
[root@ns1 ~]# ifconfig
[root@ns1 ~]# service network restart : network service restart
[root@ns1 ~]# ifconfig
IP Client Configure
=> Static
=>dhcp : autmatically ip configure
Host Name Configure
[root@localhost
~]# hostname
localhost.localdomain
[root@ns1 ~]# vi /etc/sysconfig/network
HOSTNAME=desktopX.example.com
:x
[root@ns1
~]# reboot
Parmanent(Dynamic/DHCP) IP configure:
[root@ns1
~]# cd /etc/sysconfig/network-scripts/
[root@ns1
network-scripts]# ls
[root@ns1
network-scripts]# cat ifcfg-ethx :
here x is your NIC
[root@ns1
network-scripts]# vi ifcfg-ethx :
here x is your NIC
DEVICE="eth0"
TYPE="Ethernet"
HWADDR="01:1C:2D:35:26:C0"
BOOTPROTO="dhcp" : dhcp=dynamic IP
ONBOOT="yes"
[root@ns1
network-scripts]# service network restart
[root@ns1
network-scripts]# ifconfig
[root@ns1
network-scripts]# ping 192.168.11.1
Static (parmanent) IP configure:
[root@ns1
~]# cd /etc/sysconfig/network-scripts/
[root@ns1
network-scripts]# ls
[root@ns1
network-scripts]# vi ifcfg-ethx :
here x is your NIC
DEVICE="eth0"
TYPE="Ethernet"
HWADDR="01:1C:2D:35:26:C0"
BOOTPROTO="none" : none/static=static
NM_CONTROLLED="no"
IPADDR=X.X.X.X (192.168.11.x) here x is your IP address
NETMASK=Y.Y.Y.Y (255.255.255.0)
GATEWAY=X.X.X.G (192.168.11.1)
DNS1=A.A.A.A (4.2.2.2)
ONBOOT="yes"
[root@ns1
network-scripts]# service network restart
[root@ns1
network-scripts]# ifconfig ethx
Local Host Entry:
Resolver:
Global (DNS)- Automatically i.e.: ping www.yahoo.com
Local Resolver: localhost entry (manuallY),
i.e: ping destop1
[root@ns1 ~]# vim /etc/hosts
192.168.11.200 desktop0.example.com desktop0
LOGICAL VOLUME MANAGEMENT
COMMAND
1.
Fdisk –l : show
harddisk partitions.
2.
Fdisk /dev/sda :
diskpart utilites
3.
n : create new
volume, d : delete volume
4.
e : extend
volume, l: logical volume, p : primary volme
5.
first cylinder :
6.
last cylinder :
input require size Ex- +100M
7.
p : view
partitions
8.
t : change
partition type.
9.
L : view
partition type code.
10.
w : save
partition table.
11.
Pv (primary volume) create :
pvcreate /dev/sda5
/dev/sda6 /dev/sda7 : create primary
volume.
pvdisplay
: view created table
12.
Group create :
Vgcreate vg1
/dev/sda5 /dev/sda6 /dev/sda7 : create a volume group
Vgdisplay
: display created group
13.
LV (logical
volume) create :
lvcreate -n
lv1 -L 400M
vg1 : create logical volume.
lvdisplay : display created logical volume.
14.
Format and
mount :
Mkfs.ext4 /dev/vg1/lv1
: format file type.
Mkdir /ldata
: create a folder for mount.
Mount /dev/vg1/lv1 /ldata
: mount partition.
15.
Permanent mount
:
Vim /etc/fstab : permanent mount edit command.
Insert
mode : /dev/vg1/lv1 /ldata ext4
defaults 0 0
Mount -a :
check
16.
VG extand :
Fdisk /dev/sda :
Partprobe /dev/sda
:
Pvcreate /dev/sda8 : create new extend volume.
Vgextend vg1
/dev/sda8 :
Vgdisplay
: display group
17.
Lvextend :
Lvextend -L
+100M /dev/vg1/lv1
Df -HT
Xfs
–growfs /lvdata :
18.
Lv remove :
Vim /etc/fstab
: remove fstab entry.
Umount /ldata
: unmounts folder.
Lvremove /dev/vg1/lv1
19.
Vgremove :
Vgremove vg1
20.
Pvremove :
Pvremove /dev/sda5 /dev/sda6
/dev/sda7
21.
Then others :
Fdisk /dev/sda
D : delete partition
W : save
Partprobe /dev/sda
:
Fdisk -l
Reboot
22.
SWAP extend :
free -m :
view current condition
fdisk -l :
view partition
fdisk /dev/sda : disk partition command
n
l
partprobe /dev/sda8
mkswap /dev/sda8
swapon /dev/sda8
vim /etc/fstab
/dev/sda8 swap swap 0 0
Mount -a
Swap
on -a
23.
Swap reduce :
24.
Swap remove :
25.
Quota :
which
user bob type:
·
dd
if=/dev/zero of=file bs=1024 count=4 (he succeed )
·
dd
if=/dev/zero of=file bs=1024 count=8 (he fail )
Step-1: To mount quota
file system permanently. Edit /etc/fstab file then add option usrquota,grpquota
[root@server1] #
vim /etc/fstab
LABEL=/home /home ext3 defaults,usrquota,grpquota 0 0
:wq
[root@server1] #
mount -o
remount,usrquota,grpquota /home
[root@server1] #
Step-2: To create Quota
Database file
[root@server1] #
quotacheck -cug /home
Step-3: To Enable Quota
[root@server1] #
quotaon /home
Step-4: To make Quota limit for user or
group
[root@server1] #
setquota -u susan40966144 0
0 /home (4096 = Soft Limit, 6144= Hard Limit)
or
[root@server1] #
edquota susan
Step-5: To check quota entry of user
[root@server1] #
quota susan
or
[root@server1] #
repquota /home
Step-6: To assign quota
limit for multiple user
[root@server1] #
edquota -p susan
tom rubel akkas
Step-7: To assign Group
quota limit
[root@server1] #
setquota -g sales
0 4096 0
0 /home
Step-8: To test quota
limit
[root@server1] #
su - susan
[susan@server1]
$ dd if=/dev/zeroof=bigfilebs=1M count=3 (if=STDIN,
Source/ of=STDOUT, Destination)
Introduction of user and
group
1.
/etc/passwd :
database of user information.
2.
/etc/group :
database of group information.
3.
/etc/shadow :
users password information.
4.
/etc/gshadow :
groups password information.
5.
/etc/login.defs :
default password policy.
6.
/etc/default/useradd
: users location, home dir, shell etc information.
7.
/etc/skel :
default file/folder create from new user.
User and group command
1.
Create user :
useradd kamal_user
2.
Create group :
groupadd idb_group
3.
User related
information : finger kamal_user
4.
Change password :
passwd kamal_user
5.
Create user with
add another group : useradd kamal_user–G idb_group
6.
User name change :
usermod –l kamal_user ripon_user
7.
Group name change
: groupmod –n idb_group r25_group
8.
User password
change : passwd kamal_user
9.
User password
lock : passwd –l kamal_user
10.
User password
unlock : passwd –u kamal_user
11.
User password
delete : passwd –d kamal_user
12.
User and group
name change with id :
User
– usermod –u 600 kamal_user (show id :
id kamal_user)
Group--
groupmod –g 1000-n idb_groupr25_group
Show
group id : vim /etc/group
13.
Change expire
date of user :
Change
expire---usermod/chage–E20160326kamal_user
Never
expire—chage –E -1 kamal_user
Show
expire date – chage kamal_user
14.
User lock and
unlock :
Lock
-- usermod –Lkamal_user
Unlock
– usermod –U kamal_user
View
user condition- vim /etc/shadow
15.
User’s home
directory change :
mkdir
new_home
usermod
–d newhome kamal_user
16.
User and group
delete with home folder :
User—userdel
–r kamal_user
17.
Create User
profile : chfn kamal_user
18.
User and group
membership change :
Primary
group change : usermod –g r25group kamal_user
Secondary
group :usermod –G Idb_group kamal_user
19.
Add auser with
multi group :
Usermod
–Gbitl_group,r25groupkamal_user
20.
Add multi user
with a group :
Gpasswd –M
kamal,Rahim,karim r25_group
21.
User shell change
:usermod –s /bin/bash
kamal_user
Usermod -s
/sbin/nologin kamal_user
22.
User delete :
userdel kamal_user
23.
Group delete :
groupdel linuxgroup
24.
Delete user with
home directory : userdel –r raihan
PERMISSION COMMAND
Octal Value
|
File Permissions Set
|
Permissions Description
|
0
|
---
|
No permissions
|
1
|
--x
|
Execute permission only
|
2
|
-w-
|
Write permission only
|
3
|
-wx
|
Write and execute
permissions
|
4
|
r--
|
Read permission only
|
5
|
r-x
|
Read and execute permissions
|
6
|
rw-
|
Read and write permissions
|
7
|
rwx
|
Read, write, and execute
permissions
|
·
For File full
permission = 666
·
For directory
full permission = 777
·
Default
umask 002 is used for
non-privileged user.
·
Default
umask 022 is used for root user.
Working with Linux
File/Directory permission & owernship:
[root@server1
Desktop]# mkdir /linux31/class07 -p
[root@server1
Desktop]# cd /linux31/class07
[root@server1
class07]# ls
[root@server1
class07]# touch test1
[root@server1
class07]# mkdir newdir
[root@server1
class07]# cp /etc/passwd
/linux31/class07
[root@server1
class07]# ls -l
total 8
d rwxr-xr-x. 2 root
root 4096 Sep 26 09:33 newdir
- rw-r--r--. 1 root
root 0 Sep 26 09:33 test1
- rw-r--r--. 1 root
root 1389 Sep 26 09:33 passwd
1 2
3 4 5
6 7 8
2 - user/group/others
permission
4 - file/dir owner
5 - file/dir group
owner
Field no: 2
- rw-r--r--. 2 root
root 1389 Sep 26 09:52 test1
d rwxr-xr-x. 2 root
root 4096 Sep 26 09:33 newdir
2
subfield:
- rw- r-- r--
= 644 (file)
d rwx r-x r-x = 755 (dir)
u g
o
u = user
g = group
o = others
r = read (4)
w = write (2)
x = execute (1)
- = no permission (0)
Group:
users others
======
========= ========
students: jony, liza, sumon all (except group members)
File/dir permission for new
file/dir:
dir: 755
file: 644
1. Permission change Command :
Chmod 0+x/1
test_file : add
execute permission. O = other
users.
Chmod o=w/2
test_file : replace permission to write.
Chmod o –r
test_file : remove or decrease
permission.
ll test_file : to view
2. Change file
user owner :
Chown user_ reza
test_file
3. Change group
owner :
Chgrp group_idb
test_file
Chgrp -R
group_idb directoryname
PROCESS
MANAGEMENT
Linux Process
Management:
[root@desktopX
~]# ps
[root@desktopX ~]# ps -au :
pid, process, mem, cpu, tty, cmd
[root@desktopX ~]# ps -au | less
[root@desktopX ~]# ps -u root : list of process for specifc user
[root@desktopX ~]# ps -ef : pid, ppid, time, cmd
[root@desktopX ~]# ps -ef | grep http
=>list of prcocess
=> PID
=> NICE Value
=> CPU%
=> Memory%
=> Process time
=> Process name
=> User's Process information
Process
ID: (1-65,535)
RHEL/CentOS-
7
=> PID 1 (systemd)
RHEL/CentOS-
6
=> PID 1 (init )
[root@desktopX ~]# pidof systemd 1
Graphical Process Tools:
Application
=> System Tools => System Monitor
Process
Dealing:
ps
- list the processes running on the system
kill
- send a signal to one or more processes (usually to "kill" a
process)
jobs
- an alternate way of listing your own processes
bg
- put a process in the background
fg
- put a process in the forground
nice
- new process with specific nice value
renice
- reset process priority
[root@desktopX
~]# firefox
=>
Run Firefox to test (ctrl+z, Ctrl+c)
[root@desktopX
~]# sleep 10
[root@desktopX
~]# sleep 500 &
[root@desktopX
~]# firefox&
[root@desktopX
~]# cat /etc/passwd | more &
[root@desktopX
~]# top (ctrl+Z)
[root@desktopX
~]# ping 172.25.11.254 (ctrl+c)
[root@desktopX
~]# ping 172.25.11.254 (ctrl+Z)
[root@desktopX
~]# jobs
[root@desktopX
~]# fg %1 (sleep)
[root@desktopX
~]# (Ctrl+c)
[root@desktopX
~]# jobs
Process Dealing:
=>End : "Ctrl + c"
-> Kill
=>stop : "Ctrl + z"
->process continue: (ctrl+Z)
- send to bra
(ctrl+C) - Terminate
List of Stoped process:
[root@desktopX
~]# jobs [shows all stoped process]
[root@desktopX ~]# ps [shows stoped process with PID]
Process Findout:
[root@desktopX ~]# firefox&
[root@desktopX
~]# pidof firefox 2869
Process Kill
[root@desktopX Desktop]# kill -9 2869 : here firefox PID 2869
:
"-9" killing frequecy (highest)
Nice Value
Range:
(Low) 19.................. 0 ................
-20 (High)
Nice Value:
[root@desktopX
~]# ps axo pid,comm,nice --sort=-nice
[root@desktopX
~]# firefox&
[root@desktopX
~]# ps axo comm,nice | grep firefox
firefox 0
New Process
Priority:
[root@desktopX
~]# nice -n 15 firefox &
[root@desktopX
~]# ps axo comm,nice | grep firefox
firefox 15
Existing
Process Priority:
[root@desktopX
~]# pidof firefox
[root@desktopX
~]# renice -n -7 [pid]
[root@desktopX
~]# ps axo comm,nice | grep firefox
Linux
Package Management Utilities (RPM/YUM)
Windows: .exe, .bin, .msi, .rar., .zip, .7z
Linux:
.rpm(fedora/oracle/redhat/centos/scientific/suseEP),
.deb
(ubuntu,mint,backtrack,debian)
.tar.gz, .tar.bz2, .tar (all linux)
Common Linux Package:
.rpm (Redhat Package Manager)
.deb (debian)
RPM Source: internet, DVD, ISO Locateion:
(DVD/Packages)
RPM Format:
vsftpd.2.2.2-4.el6.i386.rpm
1
2 3 4 5
1 - rpm name
2 - rpm version
3 - linux platform
4 - processor arc (i386, 86x64)
5 - .extention
COmmon Linux RPM for Linux Server:
1)
ssh - openssh
2) telnet - xinetd, telnet-server
3) vnc - vnc, tiger-vnc
4) proxy - squid
5) DHCP - dhcp
6) FTP - vsftpd
7) Mail - postfix, dovecot, squirrelmail
8) NFS - nfs
9) Samba - samba, winbind, nmb
10) Web - http
11) DNS - bind
RPM Check:
[root@csl /]# rpm -qa | grep vsftpd : rpm query
[root@csl
/]# rpm -qc openssh-server :
configuratin file
[root@csl
/]# rpm -qf /etc/passwd : rpm for
passwd file
setup-2.8.14-16.el6.noarch
RPM :
1)
Queiry : -qa
2) Install: -ivh
3) Upgrade: -Uvh
4) Repair:
-Fvh
5) Remove: -e
RPM Install:
1)
Manually (rpm)
2) Automatically (YUM Server): Yellow Dog
Updater Modifier
(yum server required)
yum server and
client.txt for yum server
=>
DVD (RedHat): 6.3x64
=>
Minimum 4GP free space in "/" root
partition
=>some
yum server pckages installaiton
->dltarpm*
->
python-deltarpm*
->createrepo*
->vsftpd*
step 01: check
Free space in "/"
--------------------------------[root@lcalhost
Desktop]# df -HT
step 02: Mount
RedHat 6.3 Dvd
------------------------------[root@localhost
~ ]# mount /dev/sr0 /mnt
[root@lolcahost
~ ]# cd /mnt
[root@localhost
mnt ]# ls
[root@localhost
mnt ]# cd Packages/
[root@localhost
Packages]# ls (show all Packages)
step 03:
Install Required packages for Yum
server
---------------------------------------------------[root@localhost
Packages]# rpm -ivh
deltarpm.....*
[root@localhost
Packages]# rpm -ivh
python-deltarpm....*
[root@localhost
Packages]# rpm -ivh
createrepo.....*
[root@localhost
Packages]# rpm -ivh vsftpd...*
step 04: copy
all rpm to "/var/ftp/pub"
--------------------------------------[root@localhost
Packages]# cp -rv /mnt/Packages
/var/ftp/pub
step:5 yum
database/repository create
--------------------------------------[root@localhost
~]# cd /var/ftp/pub
[root@localhost
pub]# ls
[root@localhost
pub]# du -ch Packages 3.8 G
[root@localhost
~]# createrepo -v /var/ftp/pub/Packases
step 06: yum
client configure
-----------------------------[root@localhost
Desktop]# cd /etc/yum.repos.d
[root@localhost
yum.repos.d]# ls
[root@localhost
yum.repos.d]# rm -rf *
[root@localhost
yum.repos.d]# ls
[root@localhost
yum.repos.d]# vim yumclient.repo
<for
same machine>
-----------------[yumclient]
name=our
yum server
baseurl=file:///var/ftp/pub/Packases
enabled=1
gpgcheck=0
<for
client machine through ftp>
-----------------------------------[yumclient]
name=our
yum server
baseurl=ftp://192.168.12.X/pub/Packases
enabled=1
gpgcheck=0
step 07: yum
server test
-------------------------[root@localhost
~]# setenforce 0 (SElinux
temporary
disabled)
[root@localhost
~]# service iptables stop
[root@localhost
~]#service vsftpd restart
[root@localhost
~]#chkconfig vsftpd on
[root@localhost
~]#yum clean all
[root@localhost
~]#yum list all
[root@localhost
~]#yum install virt-manager* -y
Yum CLient COnfiugre:
[root@csl /]# ping 192.168.11.254
[root@csl
/]# cd /etc/yum.repos.d
[root@csl
yum.repos.d]# ls
[root@csl
yum.repos.d]# rm -rf *
[root@csl
yum.repos.d]# ls: everything removed
[root@csl
yum.repos.d]# vimyumclient.repo
[yumclient]
name=yum
client
baseurl=ftp://192.168.11.254/pub/Packages : yum server IP
enabled=1
gpgcheck=0
:x
[root@csl
yum.repos.d]# yum list all
[root@csl
yum.repos.d]# yum clean all
[root@csl
yum.repos.d]# yum list all
Instal with VIM:
[root@csl
yum.repos.d]# yum install vim* -y
[root@csl
yum.repos.d]# yum install vsftpd -y
[root@csl
yum.repos.d]# yum install system-config-network-tui
[root@csl
yum.repos.d]# yum install firefox
[root@csl
yum.repos.d]# rpm -qa | grep firefox
Package Remove:
[root@csl
yum.repos.d]# yum remove firefox
[root@csl yum.repos.d]# rpm -qa | grep firefox
Linux Virtualized
Systems.txt
Check VT Support
-----------------[root@desktopX ~]# grep
-i vmx /proc/cpuinfo
--color
[root@desktopX ~]# cat /proc/cpuinfo
[root@desktopX ~]# cat /proc/meminfo
[root@desktopX ~]# free -m
Packages
=> virt-manager (GUI interface)
=>libvirt (daemon + API collection)
=> qemu-kvm (emulator for virtual OS)
Package Installation
--------------------[root@desktopX ~]#
yum install virt-manager* libvirt* qemu-kvm* -y
[root@desktopX ~]# systemctl restart libvirtd.service
[root@desktopX ~]# systemctl enable libvirtd.service
Run Virtual Machine Mananger:
-----------------------------Application
=> System Tools => Virtual Machine
Manager (VMM)
Download CentOS ISO:
--------------------=> Open Mozila
Firefox
=> ftp://172.25.11.254/pub
Create a ISO (Optional):
[root@desktopX ~]# dd if=/dev/sr0
of=/root/Desktop/centos7.iso
Run VM:
Application => System Tools => VMM
-> VM Name: studentX
Install Method: iso
---------------> IOS:/root/Desktop/Ce.........iso
Install Method: Network (FTP/HTTP/NFS)
-----------------------Path:
ftp://172.25.11.254/pub
-> OS=Linux & RHEL 7
-> Disk: /dev/sda* (10.GB)
-> Interface: br0
Time: Asia/Dhaka
Installation Method: Minimal
Size: /boot (500 MB), / (5 GB), swap
(512)
Hostname: serverX.example.com
Virtual Machine Location:
=> /var/libvrit/images
IP configure:
[root@serverX ~]# ip addr
[root@serverX ~]# systemctl stop
NetworkManager.service
[root@serverX ~]# systemctl disable NetworkManager.servie
[root@serverX ~]#
cd/etc/sysconfig/network-scripts
[root@serverX network-scripts]# ls
[root@serverX network-scripts]# vi
ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX
IPADDR=172.25.11.200+X
NETMASK=255.255.255.0
BOOTPROTO=none
ONBOOT=yes
[root@serverX network-scripts]#
systemctlrestart network.service
[root@serverX network-scripts]#
systemctl enable network.service
[root@serverX network-scripts]# ip addr
=>yum client configure
[root@serverX network-scripts]# cd/etc/yum.repos.d
[root@serverX network-scripts]# ls
[root@serverX network-scripts]# rm -rf *
[root@localhost network-scripts]#
vim client.repo
[client]
name=yum client
baseurl=ftp://172.25.11.254/pub/Packages
:yum server IP
enabled=1
gpgcheck=0
:x (SAVE & exit)
=>yum install net-tools
=>yum install vim
[root@serverX network-scripts]# ifconfig
Hostname:
---------[root@serverX ~]# vi
/etc/hostname
serverX.example.com
[root@serverX ~]# reboot
USER AND GROUP SU PERMISSION
[root@ns1 ~]# adduser sumon
[root@ns1 ~]# passwd sumon
[root@ns1 ~]# su - sumon
[sumon@ns1 ~]$ adduser shakil
-bash: /usr/sbin/adduser: Permission denied
What is SUDO
do?
Sudo allows a permitted user to execute
a specifc command or a
group of commands as the superuser.
regular user: sumon, rony, sathi
=>rm,cp,mv,
=>mkdir,touch
=>pwd,free
-m,
=>fdisk,
df -HT
=>ip
addr, tail
super user: root
=>adduser,
passwd, groupadd
=>setup,
systemctl
=>shutdown,
poweroff
=>systemctl
restart network.service
Editing sudo
configuration File:
Rules
1: permit for all
[root@ns1 ~]# vim /etc/sudoers :
configuring file with color.
[root@ns1 ~]# visudo
116
sumon ALL=(ALL) ALL
; summon allow for any command
Test:
[root@ns1 ~]# su sumon
[sumon@ns1 class05]$ sudo adduser shakil
[sudo] password for sumon: ****
[sumon@ns1 class05]$ tail /etc/passwd
Rules 2: shutdown disallow
52
Cmnd_Alias SHUTDOWN = /sbin/reboot, /usr/sbin/useradd
116 sumon ALL=(ALL) ALL, !SHUTDOWN
Rules 3: permit for specific command
52
Cmnd_Alias SUMON = /sbin/reboot, /usr/sbin/useradd
116 sumon ALL=(ALL) SUMON
Rules 4: permit group (support) for specific command
52
Cmnd_Alias SUPPORT = /usr/sbin/ifconfig, /usr/sbin/chkconfig
109 %support
ALL=(ALL) SUPPORT
Note:
[root@ns1 ~]# which useradd ; command
for location of useradd command
CONFIGRE CRON JOBS
How to configure cron jobs?
Crontab file format
Sun = 0
Mon = 1
Tu = 2
Wed = 3
Th = 4
Fri = 5
Sat = 6
Minute Hour Month Day week
60 24 12 30 (0-6)
[root@server1 ~] # crontab -e
50 23 * *
* /usr/sbin/poweroff
[root@server1 ~] # /etc/init.d/crond restart
or
[root@server1 ~] # service
crond restart
[root@server1 ~] # chkconfig
crond on
[root@server1 ~] # crontab
-l
[root@server1 ~] # ls
-l /var/spool/cron/
[root@server1 ~] # cat
/var/spool/cron/root
To
configure cron job for user:
[root@server1 ~] # crontab -e
-u tom
2010 * * *
/bin/touch /home/tom/testfile
[root@server1 ~] # /etc/init.d/crond restart
or
[root@server1 ~] # service
crond restart
[root@server1 ~] # chkconfig
crond on
OR
[root@server1
~] crontab –e
–u rashid
* * * * * /bin/echo
“Bye Bye” > /dev/pts/0
* * * * *
/bin/echo “Welcome” > /dev/tty2
To view the
cron job of user:
[root@server1 ~] # crontab
-l -u tom
[root@server1 ~] # ls
-l /var/spool/cron/
[root@server1 ~] # cat
/var/spool/cron/tom
How to
delete the cron job of user and root?
[root@server1 ~] #
crontab -r
[root@server1 ~] #
crontab -r -u
tom
ADVANCED FILE/DIRECTORY PERMISSION
Create
file and directory for ACL based share
mkdir /resource/content/ -p :
cd
/resource/content :
touch
profile :
vim
/etc/fstab :
/dev/sda6 /resource ext4 defaults,acl 1 2
mount
-o remount /resource :
mount
-a
mount :
File
vies with getacl command :
getfacl
/resource/content/profile :
#
file: resource/content/profile
# ower: root
# group: root
User
:: rw-
Group::r—
Other::
r—
Setting
ACL for multiple user’s:
setfacl
-m
u:asad:r,u:nazrul:rw,arif:rw project :
getfacl
/home/content/project :
#
file: home/content/project
User:
nazrul: rw-
User:
arif: rw-
User:
asad: r—
Setting
ACL permission for specificuser’s:
setfacl
-m u:nazrul:rw
/resource/content/profile
setfacl
-m u:nazrul:rw -R /resource/content/profile
user ::rw-
user :nazrul:rw-
group::r—
mask::rw-
Setting
ACL permission for specific group’s:
setfacl
-m g:idbgroup:r— /resource/content/tutorial
setfacl
-m g:idbgroup:rw— /resource/content/tutorial
getfacl
/resource/content/tutorial :
user::rw-
group::r—
group:idbgroup:r—
group:idb:rw-
mask::rw-
Setting ACL permission for others
setfacl
-m o::rwx
/resource/content/routine
getfacl
/resource/content/routine
user::rw-
group::r—
other::rwx
ACL Remove (group)
setfacl
-x g:idbgroup: /resource/content/tutorial
getfacl
/home/content/tutorial :
ACL Remove (user)
setfacl
-x u:nazrul:
/resource/content/profile
getfacl
/home/content/profile :
VNC SERVER CONFIGURATION
(WINDOWS-LINUX)
1.
rpm -qa
tigervnc -server
2.
yum install
tigervnc -server* -y
3.
yum install
vnc -y
4.
vncpasswd
5.
vim /etc/sysconfig/vncserver
vnc server=”1:username
2:username”
6.
service vncserver
restart
7.
chkconfig vncserver
on
8.
vim /root/.vnc/xstartup
#twm&
exec gnome-session &
9.
Chk config vncserver
on
2nd
part:
For windows : first install vnc viewer software. Then 192.168.0.11:1
Ip address : user code
For
linux: use vncviewer command. Then log
in use 192.168.0.11:1
DHCP SERVER CONFIGURATION
Ø Required rpm: dhcp-4.1.1
Ø Deamon: dhcpd
Ø Sample configuration files: /usr/share/doc/dhcp-4.1.1
Ø Main configuration files: /etc/dhcp/dhcpd.conf
Ø Lease database: /var/lib/dhcp/dhcpd.leases
Ø Port: 67- DHCP server, 68- DHCP client.
Steps
of install dhcp server:
1.
rpm -qa |
grep dhcp
2.
yum install dhcp*
-y
3.
rpm -a
| grep dhcp
4.
cp
/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
cp: overwrite /etc/dhcp/dhcpd.conf ? press y
5.
vim /etc/dhcp/dhcpd.conf
18 authoritative
46 # A slightyly different configuration
for an internal subnet.
47 subnet 192.168.11.0 netmask
255.255.255.0 {
48 range 192.168.11.11 192.168.11.100;
49 option domain-name-servers pc1.r25.com
;
50 option domain-name “r25.com”;
51 option routers
192.168.11.1;
52 option broadcast-address 192.168.11.255;
53 default-lease-time 600;
54 max-lease-time 7200;
55 }
MAC Binding/ reservation:
75 host printer {
76 hardware Ethernet 00:06:4F:5B:63:4D;
77 fixed-address 192.168.11.11;
78 }
Then save and exit.
6.
Service dhcpd
start
7.
Chkconfig dhcpd
on
NFS (Network File
System/Service)
Ø Package: nfs4, nfs-utils, rpcbind
Ø Packages for client: nfs4, outofs
Ø Port: 2049
Ø Deamon: nfs, rpcbind, nfslock
Ø Configuration file:
/etc/exports
Install
process
1.
yum install
nfs* -y
2.
yum install
rpcbind* -y
3.
yum install
nfslock* -y
4.
mkdir /nfsshare
5.
cd /nfsshare
6.
mkdir office
project resource download
rpm
7.
vim /etc/exports
/nfsshar/office 192.168.11.0/24 (rw, sync)
/nfsshare/project 192.168.11.0/24(ro, sync) 192.168.11.1(rw, sync)
/nfsshare/resource
pc1. Cslitbd.com (rw, sync)
/nfsshare/download *.cslitbd.com (rw, sync,
no_root_squash)
*(rw,
sync)
8.
Exportfs -ra :
add more nfs exports later
9.
/etc/init.d/nfs restart
10.
/etc/init.d/rpcbind restart
11.
/etc/init.d/nfslock restart
12.
chkconfig nfs
on
13.
chkconfig nfslock
on
14.
chkconfig rpcbind
on
15.
showmount -e
192.168.11.250
Export
list for 192.168.11.250:
/nfsshare/rpm *
/nfsshare/download *.cslitbd.com
/nfsshare/project 192.168.11.1,
192.168.11.0/24
/nfsshare/office 192.168.11.0/24
/nfsshare/resource pc1.cslitbd.com
Options
client site configuration
Step-1:
1.
yum install
nfs* -y
2.
service nfslock
restart
3.
service nfs
resart
4.
chkconfig nfs
on
5.
chkconfig nfslock
on
Step-2:
1.
showmount -e
192.168.11.250
Export list for
192.168.11.250:
/nfsshare/rpm *
/nfsshare/download *.cslitbd.com
/nfsshare/project 192.168.11.1, 192.168.11.0/24
/nfsshare/office 192.168.11.0/24
/nfsshare/resource pc1.cslitbd.com
2.
mkdir /data
3.
mount -t
nfs
192.168.11.250:/nfsshare/rpm
/data
4.
cd /data
5.
ls
permanent mount
1.
vim /etc/fstab
192.168.11.250:/nfsshare/rpm /data nfs rw,bg,hard,intr 0 0
2.
mount -a
3.
mount
192.168.11.250:/nfsshare/rpm on /data type
nfs……………
SAMBA SHARE (WINDOWS--LINUX)
SHARE:
Linux – linux = nfs
Windows – linux = samba
Linux –windows = vinagre
SAMBA
PACKAGES:
Packages = samba, cifs-utils
Protocol/port = [ NetBIOS-137/UDP, 138/UDP,
139/TCP, NEW SAMBA use 445/TCP]
Configuration file= /etc/samba/smb.conf
Install
process:
step:-01
Host name change and local resover setting.
[root@pc1 ~]# vim/etc/sysconfig/network
HOSTNAME=fileserver
NETWORKING=yes
NETWORKING_IPV6=no
[root@pc1 ~]# vim/etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.100 fileserver.r25.com
fileserver
[root@pc1 ~]# reboot
step
02:- RPM check and install for samba server.
[root@pc1 ~]# rpm-qa | grep samaba
[root@pc1 ~]# yuminstall samba* -y
[root@pc1 ~]# rpm-qa | grep samba
step03:-
user addand group add for samba server
[root@pc1 ~]# adduser rana
[root@pc1 ~]# adduser mijan
[root@pc1 ~]# addsuer reza
step04:-
Modify to as samba users.
[root@pc1 ~]# smbpasswd -a mijan
[root@pc1 ~]# smbpasswd -a reza
[root@pc1 ~]# smbpasswd -a rana
step05:-
Edit samba configuration file.
[root@pc1 ~]#vim /etc/samba/smb.conf
================== Global Setting
=================
[global]
74 workgroup = STAFF
75 server string = Samba Server
77 netbios name =fileserver {remove
";"}
80 hosts allow = 127. 192.168.1. {remove
";" and add only network part}
=============== share
deffinitions==================
user's home direcotory share
248 [homes]
249 comment =HomeDirectories
250 browseable =no
251 writeable = yes
290 [nt25]
291 comment = student file
292 path = /samba/nt25
293 writeable = yes
294 printable = no
295 write list = ripon reza rana
296 public =no
297 valid users =ripon reza rana
298 invalid users= delwar rashed
step06:-
SElinux disable and service restart
[root@pc1 ~]#setenforce 0
[root@pc1 ~]#service smb restart
[root@pc1 ~]#chkconfig smb on
[root@pc1 ~]#service nmb restart
[root@pc1 ~]#chkconfig nmb on
step07:- samba server configuration test
[root@pc1 ~]#testparm
DNS (DOMAIN NAME
SERVICE)CONFIGURATION
No comments:
Post a Comment