You are on page 1of 78

P age |1

Cloud Prerequisite
Basic Networking + Windows and Linux Server

S.no Topics Page number


1 Basic networking 1--30
2 Windows Server 31-49
3 Linux Server 50-72

Basic networking

1) Introduction
2) NIC (Network Interface Card)
3) Transmission media
4) Networking Devices
5) Topology
6) OSI Layer
7) TCP/IP
8) IP Addressing
9) Subnetting
10) Firewall
11) Port Number

Windows Server

1) Windows Server Introduction


2) Active Directory
3) Group Policy
4) IIS – HTTP
5) IIS – FTP
6) File System
7) Storage
8) RDP, Server core and RSAT

Linux Server
1) Linux Server Introduction
2) Basic Commands
3) User and Group account
4) fdisk HD partition
5) shell scripting, crontab, chmod
6) SCP,SSH
7) NFS
8) HTTP
9) FTP
P age |2

Networking Introduction
Definition: Networking is the interconnection of two or more devices that makes inter
communication among them to share the resource.

Advantages

1) Hardware Sharing: eg – Printer, scanner, web cam, speaker etc.


2) Folder Sharing
3) Application software sharing.
4) Entertainment: Chatting, video conferencing, etc
5) Increasing Storage capacity.
6) Remote devices access.

Disadvantages

1) Unauthorized access ( hacking problem).


2) Virus can spread easily in network.

Classification of Network
On the basis of distance

 PAN : Personal Area Network (one to one)


 LAN : Within a room to a office to a building.

 CAN: Within the campus


 MAN : Within the city
 WAN : All over the world( min two city)
P age |3

On the basis of use

 Peer to peer network (Workgroup)


 Client-server model ( Domain)
P age |4

On the basis of connection

 Intranet: Accessing server within the organization


 Extranet: Accessing server of partner organization
 Internet: Accessing server of all over the world
P age |5

On the basis of Processing

Requirement to create network


1) Computers
2) Operating System that support networking
3) NIC (Network Interface Card) or LAN Card
4) Transmission media
5) Networking Devices
6) Topology
7) Networking Protocol

COMPUTERS

1) Laptops 2)Desktops 3)Palmtops

Any types of computers can be connected in network.


P age |6

O.S (Operating Systems) Family


1) Windows 2)Linux 3)Netware 4)MAC OS 5) BSD

WINDOWS
CLIENT O.S SERVER O.S LINUX O.S
DOS (1980s) Windows NT Server Redhat Linux
Windows 1.0 Windows Server 2000 Fedora
Windows 3.0 Windows Server 2003 Centos
Windows 95 Windows Server 2008 Ubuntu
Windows 98 Windows Server 2012 Mandriva
Windows ME Windows Server 2016 Kali linux
Windows NT Debian
Windows 2000 Arch Linux
Windows XP (2000) Free Linux
Windows Vista Scientific Linux
Windows 7 Mint Linux
Windows 8/8.1
Windows 10

Client computers:
 End devices that users use to access the shared resources.
 Usually they run desktop version of OS such as Window 10, Window 7 etc.
 Client computers are also known as workstations.

Server computers:
 Computers that provide shared resources.
 Usually they run sever version of OS such as Window Server 2008, Linux etc.
 Server computers run many specialized services to control the shared resources.

Server Type
P age |7

1) Tower Server 2) Rack Server 3) Blade Server

NIC : Network Interface Card


 NIC is an interface that enables the computer to communicate over the network.
 Every computer must have a NIC in order to connect with the network.
 In earlier time it was a separate card and need to be installed on motherboard.
 All modern computers have it as the integral part of motherboard.

Physical Address or MAC address

 Fixed address . We can't change it.


 It is already present in NIC Card.
 Given by INTERNIC Organization to manufacturer.
 48 bits address divided into 24 bits and 24 bits.
 The 1st 24 bits is manufacturer ID and 2nd is unique ID.

Logical Address or IP address

 It can be changed as you like.


 Used for assigning a IP address
 Two types: IPv4 and IPv6
 IPv4 : 32 bits and IPv6 :bits
P age |8

Transmission Media

Twisted Pair Cable


Two Types

UTP STP
(Unshielded Twisted Pair) (Sheilded Twisted Pair)
 Cheaper  Costly
 Normally used everywhere  Used in sensitive places only
 Having 8 wires of different colours  same
 Only one outer shield  Outer shield as well as separate shield in
each pair
 To protect from electromagnetic disturbance
in common wiring STP will be used.
P age |9

Twisted pair categories

Connector used : RJ45


( Resistered jack)

Coaxial Cable
 Coaxial cable is an electrical cable consisting of a round conducting wire, surrounded by an
insulating spacer, surrounded by a cylindrical conducting sheath, and usually surrounded by a
final insulating layer.

 Most common use of coaxial cable today is in standard cable TV. A copper conductor lies in the
center of the cable, which is surrounded by insulation. A braided or mesh outer covering
surrounds the insulation. This is also a conductor.
P a g e | 10

Two Types :Thicknet and Thinnnet


1) ThickNet, or RG-6:
It is older and one of the first types of coaxial cable used in networks. Its thick shielding, very rigid
and difficult to work with.

2) ThinNet or RG-59:
It is far more flexible than ThickNet and much easier to work with.
P a g e | 11

Advantages:

 Sufficient frequency range to support multiple channels, which allows for much
greater throughput.
 Lower error rates. because the inner conductor is in a Faraday shield

Disadvantages:

 More expensive to install compare to twisted pair cable.


 The thicker the cable, the more difficult to work with.

Connector used : BNC (Bayonet Neill Concelman).

Fiber Optic Cable

 A technology that uses glass (or plastic) threads (fibers) to transmit data.

 Fiber optic cables provide higher bandwidth and can transmit data over longer distances.

 Fiber optic cables support much of the world's internet, cable television and telephone systems.

 Fiber cables rated at 10 Gbps, 40 Gbps and even 100 Gbps are standard.

 Fiber optic cables carry communication signals using pulses of light generated by small lasers

or light-emitting diodes (LEDs).


 Speed of light 3 x 10^8 m/s , 30000 km/s.
P a g e | 12

 In sender side Electrical signal is converted in light signal by the help of transducer and at

receiver side light signal is again converted into electrical signal by using transducer.

Types of fiber cables

1.) Single Mode:


Single mode fiber is optical fiber that is designed for the transmission of a single ray or mode of
light as a carrier and is used for long-distance signal transmission.

2.) Multimode:
Multi-mode optical fiber is a type of optical fiber mostly used for communication over
short distances, such as within a building or on a campus. Typical multi-mode links have data
rates of 10 Mbit/s to 10 Gbit/s over link lengths of up to 600 meters (2000 feet).
P a g e | 13

Optical fiber cable under sea

Optical fibre Cable Connectors


P a g e | 14

Wireless Media
Microwaves:
Microwave link. A microwave link is a communications system that uses a beam of radio waves in the
microwave frequency range to transmit video, audio, or data between two locations, which can be
from just a few feet or meters to several miles or kilometers apart.

Microwaves travel by line-of-sight;

Radio wave:
P a g e | 15

Radio waves are a type of electromagnetic radiation with wavelengths in the electromagnetic
spectrum longer than infrared light. Radio waves have frequencies as high as 300 GHz to as low as 3
kHz.

A wireless network uses radio waves, just like cell phones, televisions and radios.

Infrared wave:
Method of transferring data without the use of wires. A common example of an infrared (Ir) device is
a TV remote. However, infrared is also used with computers and devices like a cordless keyboard or
mouse, wifi routers.

Infrared technology allowed


computing devices to communicate
via short-range wireless signals in
the 1990s. Using IR, computers
could transfer files and other digital
data bi directionally. The infrared
transmission technology used in
computers was similar to that used
in consumer product remote control
units. Infrared was replaced in
modern computers by the much
faster Bluetooth and Wi-Fi
technologies.

Bluetooth:
P a g e | 16

Bluetooth is a wireless technology standard for exchanging data over short distances (using short-
wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz) from fixed and mobile devices,
and building personal area networks(PANs).

Bluetooth refers to a wireless technology which allows digital devices to easily transfer files at high
speed. Bluetooth is common in many portable devices such as laptops, PDAs, mobile phones,
smartphones and tablets.
P a g e | 17

Networking devices
1. Repeater: This is used to convert weak signals into strong signals.

2.Hub: It is used to connect multi devices.

3.Switch: It is same as hub but it is smarter and faster.

Two types : Manageable and Non Manageable Switch


P a g e | 18

Differences between Hub and Switch:

HUB SWITCH
1. It is layer 1 device of OSI mode. 1. It is layer 2 device of OSI mode. Some
switch are layer 3 devices.

2. Max speed 10mbps. 2. Speed = 100Mbps, 1Gbps, 10Gbps, 40


Gbps.

3. Works in half duplex mode. 3. Works in full duplex mode.


4. It broadcast the packet to all its ports. 4.Unicast the packet to its destination(one
time broadcast only)

Transmission Modes:
1) Simplex:- In this mode, the communication between sender and receiver occur only in one
direction.

That means only the sender can transmit the data to receiver but receive can’t.

2) Half- Duplex:- In this mode, the communication between sender and receiver occurs in both the
directions but, one at a time.

The sender and receiver both can transmit and receive the information but, only one is allowed to
transmit at a time.

3) Full-Duplex:- In this mode, the communication between sender and receiver can occur
simultaneously.
Sender and receiver both can transmit and receive simultaneously at the same time.
P a g e | 19

4. Bridge:
It is same as switch but have two or three port only.

5. Router:
It is used to connect from two different networks.

Two types: Home or Office use router and Enterprise router


P a g e | 20

6. Brouter:

7. Gateway:

8. MAU (Multistation Access Unit)


P a g e | 21

OSI Layer
 Open System Interconnect (OSI) developed by ISO in 1970.
 Defines a networking framework to implement protocols in seven layers.
 Communication over network is understandable through this OSI model.
 OSI having 7 layers and each layers has its own responsibilities.
 Hardware and software work together.
 Troubleshooting is easier by separate networks.

Known as Layer n0. OSI layer Format of NW devices used


Data
Upper Layer Layer-7 Application Layer
or Layer-6 Presentation Layer
User access Layer Layer-5 Session Layer Data
Heart/Core of OSI Layer-4 Transport layer Segment
Lower Layer Layer-3 Network layer Packet Router,
or Layer-2 Data Link Layer Frame Switch, Bridge
NW access Layer Layer-1 Physical Layer Bits Hub, Repeater,
Networking cable
P a g e | 22

TCP/IP ( Transmission Control Protocol/ Internet protocol )


 It is the collection of protocols and also called TCP/IP protocol suite.
 These protocols describe the movement of data between the source and destination or the
internet.
 It consists of 4 layers and each layer having some protocols.
 Each protocol works independently but some protocol works together depend on the
requirement.
P a g e | 23

IP ADDRESSING
It is a unique address used to identify a device (like computer, smart phone, router, IP based phone,
network printer etc) in network.

IP Address

IP v4 IP v6

Decimal Format Hexadecimal Format

32 Bits address 128 Bits address

What happened to IPv1, IPv2, IPv3 and IPv5 ?

 IPv1, 2, & 3 would actually be part of the TCP/IP protocols, of which there were 3 versions.

 IPv5 is an experimental TCP/IP protocol called the Internet Stream Protocol that never really
went anywhere because increases in bandwith made streaming over IPv4 feasible. So IPv5 was
never finalized and they skipped to IPv6.

IP V4

• It is 32 bits address divided into 4 octet.

• This 32 bits address is having Network ID and Host ID.

Example:-

192 . 168 . 1. 1
11 00 00 00 .10 10 10 00 .00 00 00 01 . 00 00 00 01
8 8 8 8
32 bits

Network ID Host ID
8 bits = 28= 256

Therefore the value we can write in each octet is from 0 – 255 only.

32-bits = 232 = Around 4.2 billions numbers.


P a g e | 24

IP v4

Classful Classless

1) Class A – Used for large network Subnetting

2) Class B – Used for medium network and

3) Class C – Used for small network Supernetting

4) Class D – Used for multicasting


5) Class E – Reserved for Research and Development

Q: Where we can assign the IP Address?


Ans: NIC card
Q: Which organization is responsible for managing IP addresses ?
IANA (Internet Assigned Number Authority) : IANA created some range to distribute the IP based on use.

Range of IPv4

Class Starting Ending

A 1.0.0.0 126.255.255.255
B 128.0.0.0 191.255.255.255
C 192.0.0.0 223.255.255.255
D 224.0.0.0 239.255.255.255
E 240.0.0.0 255.255.255.255

Note : 127.0.0.1 is reserved for local host and called loopback address.
Range: 127.0.0.1 – 127.255.255.254

To Remember
Class Range
A 1 - 126
B 128 – 191
C 192 – 223
D 224 – 239
E 240 – 255
P a g e | 25

Network bits and Host bits

Class A: Network bits: 08, Host bits: 24

Subnet Mask

Class B: Network bits : 16, Host bits: 16

Subnet Mask

Class C: Network bits: 24, Host bits: 08

Subnet Mask

Types of IP Address:
 Unicast Address
 Multicast Address
 Broadcast Address

 Unicast is communication between One to One receiver.[A, B, C – Unicasting]


 Multicast is communication between one-to-many
[D, E – Multicasting]
 Broadcast is Communication between one-to-all.

Loop-back Address:
It is a special class A IP address (127.0.0.1-127 255.255.255.0),reserved for loopback or
diagnostic functions.
P a g e | 26

Condition for Pinging / Communicating:

Class PC-1 PC-2


Class - A A B C D A X Y Z
Class - B A B C D A B X Y
Class - C A B C D A B C X

Note:- To communicate two PC the network ID must be same in both PC.

Calculation of IP Address:

Formula:-

No. of Network = 2n-r No. of Host Network = 2h-2

Where, n = Network bits r = Reserved bits h = Host bits

Reserved bits:

Class Reserved bits No of bits


A 0 1
B 10 2
C 110 3

1) Class - A :
n = 8, h = 24, r = 1
No. of network = 2n-r = 28-1 = 27 = 128
No. of host network = 2h-2 = 224-2 = 16,777,214

2) Class – B :
n = 16, h = 16, r = 2
No. of network = 2n-r = 216-2 = 214 = 16384
No. of host network = 2h-2 = 216-2 = 65,536-2 = 65,534

3) Class – C :
n = 24, h = 8, r = 3
No. of network = 2n-r = 224-3 = 221 = 2,097,152
No. of host network = 2h-2 = 28-2 = 256-2 = 254
P a g e | 27

How to configure Class-C IP address for 600 Computers ?

Ans:
192.168.1.0 Network ID
192.168.1.1
192.168.1.2
. Valid host = 254
.
192.168.1.254
192.168.1.255 Broadcast ID
192.168.2.0 Network ID
192.168.2.1
192.168.2.2
. Valid host = 254
.
192.168.2.254
192.168.2.255 Broadcast ID
192.168.3.0 Network ID
192.168.3.1
192.168.3.2
. Valid host = 92
.
192.168.3.92
192.168.2.255 Broadcast ID

Therefore total valid host (Computers) = 254+254+92 = 600


Two routers require communicating all systems here.
P a g e | 28

Public IP and Private IP:

Differences between Public IP and Private IP:


Public IP Private IP
Assinged by ISP Assigned by user from a given range

Used to Connect Internet Used to Share Internet Connection

It can be directly accessed through It cannot be accessed through Internet


Internet

Private IP Range:

Note:- Total IP Address = 232 = 4.2 Billions

3.7 billions used by Public IP

0.5 billions used by Private IP, Lookback address and APIPA address.
P a g e | 29

SUBNETTING
 Subnetting enables the network administrator to further divide the host part of the address
into two or more subnets.

Subnetting advantages
 Reduces the network traffic by reducing the volume of broadcasts
 Saving unused IP addresses
 Enables users to access shared data within their network.
 Security can be maintained
 Easy to troubleshoot network problems.

The default subnet mask is as follows:

Class Subnet mask CIDR notation


A 255.0.0.0 X.X.X.X/8
B 255.255.0.0 X.X.X.X/16
C 255.255.255.0 X.X.X.X./24
P a g e | 30

Firewall
A firewall is a network security system designed to prevent unauthorized access to or from a
private network.

Firewalls can be implemented in both hardware and software, or a combination of both.

Hardware Firewall Software Firewall


The firewall is a dedicated hardware appliance Software firewalls are installed on your computer
protecting all your computers, also referred to as and you can customize it; allowing you some
a network or gateway firewall. control over its function and protection features.

A hardware firewall is more secure, can protect A software firewall will protect your computer
more computers and runs on its own processing from outside attempts to control or gain access
power and so does not affect a computer's your computer, and, depending on your choice of
performance. software firewall.

Firewall Rule

Inbound rules: These are to do with other things accessing your computer. If you are running a
Web Server or RD server on your computer then you will have to tell the Firewall that outsiders
are allowed to connect to it.
Outbound rules: These are so that you can let some programs use the Internet, and Block
others. You will want to let your Web Browser (Internet Explorer, Firefox, Safari, Chrome,
Opera...) have access to the Internet, so you will tell Windows Firewall that it's allowed.
P a g e | 31

Port Numbers

Port numbers are processed by network hardware and the software automatically.
Network ports are provided by the TCP or UDP protocols at the Transport layer.
Port numbers are used to determine what protocol incoming traffic should be directed to.

Port Service name

20, 21 File Transfer Protocol (FTP)

22 Secure Shell (SSH)

3389 RDP

80 Hypertext Transfer Protocol (HTTP)

443 HTTP with Secure Sockets Layer (SSL)

2049 NFS

1433 MSSQL

3306 MySQL
P a g e | 32

WINDOWS SERVER INTRODUCTION

Different OS Family
1) Windows
2) Unix/Linux
3) Mac OS
4) Android
5) IBM OS/2
6) BSD
7) HP-UX

Microsoft
Client OS Server OS
DOS ( Disk Operating System) Windows NT Server
Windows 1.1 Windows 2000 Server
Windows 3.1 Windows Server 2003
Windows 95 Windows Server 2003 R2
Windows 98 Windows Server 2008
Windows ME Windows Server 2008 R2
Windows NT Windows Server 2012
Windows 2000 Windows Server 2012 R2
Windows XP Windows Server 2016
Windows Vista Windows Server 2019
Windows 7
Windows 8, 8.1
Windows 10
P a g e | 33

ACTIVE DIRECTORY DOMAIN SERVICES(ADDS)


1) Active directory is the directory Service provided by Microsoft.
2) It is the centralize data base used to manage and control the users and computers of whole
organization.
3) It is the collection of objects ( users, computers, group, OU, printers, contact etc)
4) It manages user logon process, authentication and directory searches.

Elements of AD
Logical Elements Physical Elements
Domain Domain Controller
Users Sites
Organizational Unit
Forest

Q : What is Active Directory Database File


Ans: C:\Windows\NTDS\ntds.dit

Ntds.dit = New Technology Directory Service. Directory Information Tree

Q: What is sysvol folder ?


Ans: Replicate the AD database to different domain controller.( C:\Windows\sysvol)

ACTIVE DIRECTORY STRUCTURE

1) Domains:
 It is the administrative boundary for the active directory objects.
 It a logical group of network objects (computers, users, printers, etc.) that share the
same Active Directory database.
 A single domain can span upto multiple physical locations or sites.
 A domain is managed by a physical machine known as Domain Controller.
 All domain controller hold a copy of the domain database, this domain database is
continuously synchronized.
P a g e | 34

2) Domain Controller:
a) A Machine which hold AD Database.
b) A machine where ADDS is installed.
c) DC uses Kerberos KDC ( key Distribution Center) service to perform authentication.
d) For security of DC, we can implement DC on server core for remote office.

3) Parent Domain Controller (PDC): Main Server or root server


4) Child Domain Controller (CDC): Branch Server
5) Additional Domain Controller (ADC): Backup Server
P a g e | 35

6) Global Catalog Server


 A global catalog server is a domain controller that stores a full copy of all objects in the
directory for its host domain and a partial, read-only copy of all objects for all other domains
in the forest.

 Storing the most commonly searched attributes of all domain objects in the global catalog
makes searches more efficient for users without affecting network performance, thus
preventing unnecessary.

When you install AD DS, the global catalog for a new forest is created automatically on the first
domain controller in the forest

You can add global catalog functionality to additional domain controllers.


P a g e | 36

Main Function of Global catalog


 Finds objects.
 Allowing user log on anywhere by supplying UPN( user Principle Name) and user-group
information.

7) AD DS Schema

 The ADDS schema defines attributes and objects classes.


 The schema defines the objects that reside in the ADDS database and defines the mandatory
and optional attributes as well as the syntax and the relationships between the objects and the
attributes.
 All AD objects ( users, groups, computer etc.) are defined in the schema. Each time that the
directory handles data, the directory queries the schema for an appropriate object definition.
 Schema can be accessed by using MMC.

8) Tree :
Domain trees are collections of domains that are grouped together in hierarchical structures.
9) Forest :
 It is the highest level in the AD.
 It shares single database and single global address list.
 It contain one or more domain container objects like Directory structure, global catalog and
directory schema.
 It contain multiple domain trees.
 The first domain in the forest is called as Forest Root domain.
 By default, a user or administrator of one forest cannot access another forest.
P a g e | 37

10) Sites : It is a collection of Subnets.

11) Objects : It is the main resource which need to manage or control. Eg: users, computers, group,
Organisational unit, Printer, contact etc.

Heirarchical structure of ADDS

Forest
Domain
Organisational Unit
User, Computer, Group

Active Directory Domain Services (AD DS) Functional Levels


 Functional levels determine the available Active Directory Domain Services (AD DS) domain or
forest capabilities.
 They also determine which Windows Server operating systems you can run on domain
controllers in the domain or forest.
 The functional level of a domain or forest controls which advanced features are available in the
domain or forest.
 If W.S. 2003 is selected as domain or forest functional level then all higher version of server
2003 will be supported.
P a g e | 38

Active Directory Installation in Server 2016


Prerequisite

1) System must have user friendly name.


2) System must have Static IP with DNS IP configured.
3) NIC port must be connected to network cable.

Installation Process
1) Open server Manager –Add role sand Features – Roles-based or feature based installation –

Select ADDS - next-next---------Install –close

After completing it close the window and open Server manager – click on notification area and
click on promote this server to a domain controller-
P a g e | 39

Select Add a new forest and type your domain name ( corp.contoso.com)
P a g e | 40

Next ---------Finish – Server will restart automatically

How to add Client PC to Server( Adding workstation to domain )

Ans: 1) Check proper connectivity with server and having same DNS address as server.

2) Right Click on Computer – Properties – Change setting – change – select domain and type domain
name – ok – Type Server user name ( administrator) and password – ok – ok --------Restart the PC
P a g e | 41

Now restart the PC and Log on with domain user.

How to Remove ADDS in Server 2012

Open Server Manager- manage - Remove roles and features- next-next -


uncheck ADDS-remove features-next -click on demote this domain
controller
P a g e | 42

Click on last domain controller-next- click on proceed with removal-next-remove this


dns zone and remove application partition

- enter new administrator password - demote ---finish

After restart - open server manager- manage- remove roles -----finish


P a g e | 43

Group Policy
 Group Policy allows administrators to define options for what users can do on a network –
including what files, folders and applications they can access. The collections of user and
computer settings are referred to as Group Policy Objects
 We can apply GP for users and computers only.
 GP is applied through Local, Site, domain and OU.

Group Policy Hierarchy


P a g e | 44

Exercise
1) Block “Task manager” option for all users of Account department OU.
In server:
Open AD Users & computers  create OU named “Account” and create some Users in
it.
Start Administrative tools  Group policy managementExpand Forest  Expand
Domains
Expand Yahoo.com (Domain Name).
(a) Right click on Account OU  create a GPO Type "Task manager Disabled" 
OK
(b) Expand Account OU click on “Task Manager disabled”  ok  R.C. on “Task
manager disable”  edit
User configuration Policies  Administrative Templates  system  Ctrl +Alt
+Del options
Double click  “Remove Task manager” Select “enable”  Apply  ok.
Start  Run  type as “gp update”  OK

In client PC:
Log on with any user of account OU and check “Task manager”.

2) To Remove Desktop icons icon:


Open Group Policy management
(a) R.c on Sales OU  Create a GPO  Remove Desktop icons  OK.
(b) Expand Sales OU  R.c on created GPO " Remove Desktop icons " edit
User configuration  Administrative templates  Desktop  Select “Remove all
desktop items”  select Enable apply  ok.

3) To Remove All Programs list from start menu:


Open AD Users & computers  create OU named “Sales” and create some Users in
it.
Start Administrative tools  Group Policy management Expand Forest
Expand Domains Expand Yahoo.com (Domain Name).

(a) R.c on Sales OU  Create a GPO  Type "Disable All Programs from start menu"  OK
P a g e | 45

(b) Expand Sales OU  R.c on created GPO "Disable All Programs from start menu" edit

User configuration  Admin templates  Start menu & Task bar  select “Remove all
programs list from the start menu  select “Enable”  Apply  Ok

Start  Run  Gp update  ok

In client PC:

Log on with any user of Sales OU and check.

4) Disable Pen-drive access for all User of sales department:

Start Admin tool GP management 

(a)R.c on Sales OU  create a GPO  Disable Pen-drive access  OK

(b)Expand Sales OU R.c on created GPO  edit

User configurationpolicies  Admin templates  System  Select “Removable Storage


Access” Double click on “Removable Storage access”  Select Removable Disks: Deny
read access  Double click  select “Enable” Apply Ok.

Start  run gpupdate  Ok.

In client PC:

Log on any user of the sales OU.

Enable or disable right-click context menus in Explorer


User Configuration > Administrative Templates > Windows Components > File
Explorer-> double-click on Remove File Explorer’s default context menu to open its
settings box.-> Select enabled > Apply -ok
Start  Run  gpupdate ok.
P a g e | 46

IIS in Windows Server

• Stands for "Internet Information Services." IIS is a web server software package
designed for Windows Server. It is used for hosting websites and other content on
the Web.

• Microsoft’s Internet Information Services provides a graphical user interface


(GUI) for managing websites and the associated users. It provides a visual means
of creating, configuring, and publishing sites on the web. The IIS Manager tool
allows web administrators to modify website options, such as default pages, error
pages, logging settings, security settings, and performance optimizations

FTP (File Transfer Protocol)

 Port no :- 21
 We can keep all important data or software in one centralized server and it is
available for all user in the network.
 Any user can download FTP server data by using its web browser.
 Additionally winscp software can be install to transfer data from one pc to other.
 For FTP configuration IIS service is required.
 IIS (Internet Information Service).

IIS (Internet Information Services) Installation:

Process:-

 Create a folder and store data.


 Install Internet information services (IIS) from add roles and features.
P a g e | 47
P a g e | 48

  Start  Administrative tool  IIS Manager  double click PC Name Right

click on sites  Add ftp sites give ftp site name  Select Physical path of
created folder  Next  Give server IP Address  Select No SSL  Next 
Authentication (select Anonymous)  Allow access to (All users)  Permission
(Read)  Finish.
P a g e | 49

 Now right click on created FTP link  Edit permission  Security  Edit  Add
 Advanced  Find now  Everyone  OK OK Full control  Apply  OK.
 In other PC open any browser and type ftp://192.168.5.2/

FTP for Special User

1) Same as normal FTP but while accessing FTP from web browser a usrname and
password will be asked.
2) Generally created for WAN users.

Process:-

1) Open active directory users and computer create some users like delhi, Mumbai,
Chennai etc.
2) Create a group (FTP-User) and add all above three users.
3) Open IIS manager  Right click on sites  Add FTP sites  Name  Address 
Next  IP address  No SSL  Next  Authentication (Basic)  Authorization:
allow access to (Specified roles or users groups)  FTP-User name of group 
Permission (Read)  Finish.
4) In client PC open any browser and type ftp://192.168.5.1/ (server IP).
5) Type user name and Password.

Note:- Only one FTP sites will be active at a time.

Right click on site  Manage FTP site  start or stop

HTTP (Hyper Text Transfer Protocol)

1) Install IIS
2) After Installing IIS . It create a default path in “c:/” drive.
P a g e | 50

(c:/inetpub/wwwroot), keep your html web page here.


3) Open IIS manager  Right click on sites  Add website  site name (Test 1) 
Physical path (C:\inetpub\wwwroot)  IP address (192.168.5.1 or server IP
address)  Ok.
4) Now in client PC open any web browser and write http://192.168.5.1 (server IP).

Windows File System Types

1) FAT: File Allocation Table

 Introduced with DOS OS


 Support maximum of 2 GB HD Partition
 No files and directory security

2) FAT 32:

 Introduced with Windows 95 OS


 Support maximum of 32 GB HD Partition
 Weak files and directory security

3) NTFS: New Technology File System

 Introduced with Windows NT OS


 Support maximum of 2 TB HD Partition
 Strong files and directory security
 Additionally Support
o Disk compression
o Data Encryption
o Disk Quota
o Support Active Directory

4) ReFS : Resilient File System

 Introduced with Windows 8 and Server 2012 OS.


 ReFS has high tolerance to failures and providing easy file recovery
P a g e | 51

5) exFAT (Extended File Allocation Table)


 exFAT is primarily intended to be used on portable media devices like flash drives,
SDHC and SDXC cards, etc.
 The exFAT file system is supported by almost all versions of Windows (older ones with
optional updates), Mac OS X (10.6.5+), as well as on many TV, media, and other
devices.

Storage System
Basic Disks
Basic disks are the storage types most often used with Windows.

The term basic disk refers to a disk that contains partitions, such as primary partitions and
logical drives,

Basic disks provide a simple storage solution.


P a g e | 52

Dynamic Disks
Dynamic disks provide features that basic disks do not, such as the ability to create volumes
that span multiple disks (spanned and striped volumes) and the ability to create fault-tolerant
volumes (mirrored and RAID-5 volumes).
Like basic disks, dynamic disks can use the MBR or GPT partition styles on systems that
support both.

Difference between MBR and GPT

Remote Desktop

Taking Desktop control of Server from remote PC.

Process: 1) In server Right click on Computer- Properties- Remote setting – Select


Allow connection.
P a g e | 53

2) Open Active Directory Users and Computer and Select any authorize use
and add it to “Administrators and remote desktop users” group.

In client PC

1) Start- Remote desktop connection – type Server IP- then authorize user-
name and password .

Now you can get full access of Server


P a g e | 54

INTRODUTION TO LINUX

BRIEF INTRODUCTION OF UNIX:


UNIX- UNIPLEXED INFORMATION COMPUTING SYSTEM.

 It is developed in 1969 by Kem Thomson and Dennis Ritchie.


 It is written in c language.
 It is open source operating system.

BRIEF INTRODUCTION OF LINUX AND ITS DISTRIBUTIONS:

1. LINUX:
 It is developed by Linus Torvalds.
 Linux were publicly released later that year (1991)
 Based on UNIX OS, C language and Assembly level language.
 It is open source Operating system.

2. DISTRIBUTIONS:

Red hat Linux, Fedora, Cent OS, Mandriva, Debian, Slackware Linux, Scientific Linux, Arch Linux,

Free Linux, Back track –kali Linux, Open Suse.


P a g e | 55

 RED HAT VERSIONS:

 Red hat Linux 1.1


 Red hat Linux 2.0
 Red hat Linux 3.0
 Red hat Linux 4.0
 Red hat Linux 5.0
 Red hat Linux 6.0
 Red hat Linux 7.0
 Red hat Linux 8.0
 Red hat Linux 9.0

RED HAT ENTERPRISE LINUX:

 Red Hat Enterprise Linux 2.1


 Red Hat Enterprise Linux 3.0
 Red Hat Enterprise Linux.0
 Red Hat Enterprise Linux 5.0
 Red Hat Enterprise Linux 6.0
 Red Hat Enterprise Linux 7.0, 7.1, 7.3,7.4
 Red Hat Enterprise Linux 8.0

 DIRECTORY STRUCTURE OF LINUX:


P a g e | 56

/bin/ - Essential user command binaries

/boot/ - Static files of the boot loader

/dev/ - Device files

/etc/ - Host-specific system configuration (secure directories)

/home/ - User home directories

/lib/ - Essential shared libraries and kernel modules

/media/ - Mount point from removable disk

/mnt/ - Mount point for a temporarily mounted file system

/opt/ - Add-on-applications software packages

/sbin/ - System binaries

/srv/ - Data for service provided by this system

/tmp/ - Temporary files

/usr/ - Multi-user utilities and apps

/var/ - Variable files

/root/ - Home directory for the root user

/proc/ - Virtual file system documenting kernel and process status as text files.

 DIFFERENT TERMINALS IN LINUX:

 CTRL+ALT+F1 ---GUI Mode


 CTRL+ALT+F2 ---CUI Mode
 CTRL+ALT+F3--- CUI Mode
 CTRL+ALT+F4--- CUI Mode
 CTRL+ALT+F5--- CUI Mode
 CTRL+ALT+F6--- CUI Mode
 CTRL+ALT+F7--- GUI Mode
P a g e | 57

 DIFFERENT DESKTOP:

 ubantoUbuntu's Unity desktop with Dash open.


 The GNOME desktop in Fedora Workstation.
 KDE in kool desktop environment.
 Linux Mint with the Cinnamon desktop.
 Linux Mint with the MATE desktop.
 Lubuntu with the LXDE desktop.
 Xubuntu with the XFCE desktop.

 USER ACCOUNT TYPES:


Three types of user accounts:

 Administrative (Root).
 Regular.
 Service.

Administrative (Root): The Linux administrative root account is automatically created


when you install Linux, and it has administrative privileges for all services on Linux Operating
System. The root account is also known as super user

Regular: Regular users have the necessary privileges to perform standard tasks on a Linux
computer such as running word processors, databases, and Web browsers. They can store files
in their own home directories. Since regular users do not normally have administrative
privileges, they cannot accidentally delete critical operating system configuration files.

Service: Services such as Apache, Squid, mail, games, and printing have their own individual
service accounts. These accounts exist to allow each of these services to interact with your
computer.
P a g e | 58

Windows vs Linux

Term Windows Linux


Executable file extension . exe , .msi .rpm , .bin
File Systm FAT32, exfat, NTFS, Refs Fat, exfat, ext3, ext4, xfs
Partition C:\ , D:\ , E:\ /dev/sda1, /dev/sda2
Directory Structure C:\data1\data2\ /home/deepak/Desktop
Default browser Internet Explorer Mozilla firefox
Restart required Server restart req after each Only service restart required
config
Desktop Single Multiple terminal
Secure No yes
Licence Cost No cost-free
Source code Closed source code Open source
Interface GUI more CLI less GUI less CLI more
Hardware resource usage More less
File extension Compulsory optional
User password Optional compulsory
Case sensitive No yes
P a g e | 59

Basic Commands
To check system configuration

# lscpu ; to get cpu detail

#hostname: to get hostname

# free -m : to check RAM

# fdisk -l | grep sd : to check number of HD

# df -h

# ifconfig : to check network / IP

1) # pwd : to check present working directory

2)# ls : to list the content

3) #whoami, who, id : to check current user login info

4) #cal : calender --- cal MM YYYY

eg: # cat 11 2019, # cal 2019, #cal 1947, #cal 04 1520

5) #uname -a , uname -r : to check system full info

6) # cat /etc/redhat-release -:to check red hat version

7) #whatis, man, --help : to get the help of any command

8) #du, df - to check disk usage and free space

eg: # du /home/deepak

# df /home/deepak

09) #hostname or # hostnamectl : to get hostname

# hostnamectl set-hostname myserver1 : to change hostname

10) #date : to check date and time

eg: # date , # date +%d

date +%Y%m%d -s "20120418"


P a g e | 60

date +%T -s "11:14:00"


date -s "19 APR 2012 11:14:00"

11) #init 0, #halt, #poweroff : to shutdown

12) #init 6, #reboot, press ctrl+alt+del : to restart

13) #eject, eject -t : to in or out optical media

14) # history : to check history of used commands

# history 12 : to show history of last 12 commands only

# history > file1: to store the history result in a new file

# history -c : to delete history

# HISTTIMEFORMAT="%d/%m/%y %T " : to see the history with date and time

or

# export HISTTIMEFORMAT='%F %T'

%F – expands to full date same, as %Y-%m-%d (year-month-date).


%T – expands to time; same as %H:%M:%S (hour:minute:seconds).

15)# ifconfig : to check all network interface

16) # nmtui : to configure IP address

# ifdown eno16777736

# ifup eno16777736

# ifconfig eno16777736

17) # free -m : to check memory status

18)# top : to see cpu and memory usage

19) #kill : to kill PID

20) #sar 1 3 : to check cpu status 3 times within one second

21)# su : to switch to super user or # su deepak : to switch to other user

22)#su - : to switch to super user but getting /root as home directory bydefault
P a g e | 61

23)# uptime : to check how long server is started

24)#which, whereis command : to check the location of command script

25)# clear : to clear the screen

26)# fdisk -l : to check all connected storage and partition or # df -h

27)#passwd username :changing password of user

28) #ping IP or hostname : to check the communication

29) #nslookup hostname : to get IP

30) # bc : calculator

31) ctrl+c or q : to cancel running process

Working with files and Directories

#mkdir dirname : To create a directory/folder.

#cd dirname : To go to inside the directory.

#mkdir dir1 dir2 dir3 : To create multiple dir at a time

# mkdir -p /india/delhi/chandni

#cd / : To come in root level.

#cd ~ : To come to user level.

#cd .. : come one step back.

#touch filename : To create empty file.

#cat >filename : To create a file.

...................

.................... Write ur text normally

Now press “ ctrl+d “ - To save.

#cat filename : To see the file contents.


P a g e | 62

#more filename : Showing content of file one screen at a time ( Sequentially)

Eg: #more /root/install.log

# head filename : Showing content of top portion only

# tail filename : Showing content of bottom portion only

# cat file1; cat fil2; cat file3 : To see the content of multiple file at a time.

# echo “ tiger” > file1 : to insert content in a file without opening it but old content will be removed

# echo “ tiger” >> file1 : to insert content in a file without opening it.

# cat file1 file2 > file3 : To combine content of two file and insert in new file

#rm filename : To remove a file.

#rm –f filename : To remove a file without asking permissions.

#cp : To copy the file and dir.

#cp source-path/file-name dest-path/ : To copy and paste for files

# mv source-path/file-name dest-path/ : To cut and paste for files

# mv old-file-name new-file-name : To rename the file/folder name.

#sort : to show content of file in sorted form ( only for viewing)

Eg:
# sort filename : to show from a-----z
#sort -r filename : to show from z-----a
# sort file1 file 2 : show sorting content from both file
# sort file1 >sort.txt : saving the sorted result in a new file.

SED : To replace the content of a file

To replace test with example in myfile.txt


# sed 's/test/example/g' myfile.txt -- only display

s - substitute
g - global ( changes to be done in all lines)

To replace test with example in myfile.txt and print the output in a new file

sed 's/test/example/g' myfile.txt > newfile.txt


P a g e | 63

sed -i 's/test/example/g' myfile.txt > newfile.txt -- change in same


file

Replacing string on a specific line number

# sed '3 s/unix/linux/' myfile.txt

Deleting lines from a particular file

Syntax:
# sed 'nd' filename.txt
Example:
# sed '5d' filename.txt

Deleting last line from a particular file

# sed '$d' filename.txt

#rm –r dirname : To remove a directory/folder.

#rm –rf dirname : To remove a directory/folder without asking confirmaton

# rm -rf * : to delete all

# rm -f *.mp3 : to delete all .mp3 files

# rm -rf file* : remove all words related with file text

#cp –r [dir-source-path] [dir-destination-path] : To copy and paste for dir

#mv [dir-source-path] [dir-destination-path] : To cut and paste for dir

#wc : To see how many characters/words/lines are used in file.

# wc -c file-name

# wc -w file-name

# wc -l file-name

# ls /home | wc -l : show number of content in that dir.

Aliasing

Creating nick name of command

# alias m=mkdir -- #m india : india folder will be created


P a g e | 64

#alias cd=”cd /root/Desktop/Data/”


#alias kk=” rm -f /india/song/*.mp3”

#unalias -a : to unalias all

# unalias m : to unalias only m

Finding
1) locate

#locate filename : To find something in entire OS

Note: Sometime locate command do not show anything then use # updatedb and use locate
command again

2) grep “string” filename : to find availability of word in particular file

Eg: grep “traceroute” /root/install.log

Eg: chkconfig --list | grep sshd

#whereis command-name : To check the script file location

Egg : # whereis date or #whereis mkdir or # whereis ls

3) find : to find from specific location

Find all .txt files in home directory ( for all users).

#find /home - type f -name "*.txt"

Find and remove multiple File

#find -type f -name "*.txt" -exec rm -f {} \;

ls command examples
#ls –a : To show all

#ls -i filename/dirname : to show inode number

# ls -l filename/dirname : to show long format + associated permissions

# ls -t filename/dirname : to show which created first( based on time)

# ls -s : list file size

# ls > file1 : to store the result of ls in a new file


P a g e | 65

USER ACCOUNT AND GROUP ACCOUNT

USER ACCOUNT:
#useradd username : To add a user

#passwd username : To set password

#ls /home/ : To check user created or not

#userdel username : To delete the username

#userdel –r username : To delete the user as well as his saved data or his entire profile

GROUP ACCOUNT:
#groupadd groupname : To add a group

#groupdel groupname : To delete the group

# gpasswd –a user2 groupname Adding a user in a group

# gpassword -M ram,ram1,ram2 accounts : adding multiple users to a group

Q-* How to see all created user/group in a file or Where these all created users and group are stored
?

Ans : # cat /etc/passwd - for users

#cat /etc/group - for group

Q-* How to see encrypted password of all created users ?

Ans : # cat /etc/shadow

# cat /etc/gshadow

Q: How to assign root privilege to any normal user ?

Ans: 1) log on through root user.

2) # visudo

root ALL=(ALL) ALL


newusername ALL=(ALL) ALL

or
newusername2 ALL=(ALL) NOPASSWD: ALL

For group

% wheel ALL=(ALL) ALL


P a g e | 66

% sales ALL=(ALL) ALL

add this newuser here then save and exit

Now in other terminal log on with newuser

$ sudo mkdir /india

type password of newuser

$ sudo systemctl stop firewalld

Hard Disk Partition


FILE SYSTEM
Ans: File system is the way to organize and keeping track of data that is stored in hard disk.

File System types:


1) Windows : FAT, FAT32, NTFS, Refs

2) Linux : FAT32, extFAT, EXT2, EXT3, EXT4, XFS

Partition using fdisk

Using fdisk you can create a new partition, delete an existing partition, or change existing
partition.

Using fidsk you are allowed to create a maximum of four primary partition, and any number of
logical partitions, based on the size of the disk.
# echo "- - -" > /sys/class/scsi_host/host0/scan
# fdisk -l | grep sd

View all fdisk Commands : # fdisk /dev/sdb enter then type m

d delete a partition

n add a new partition

p print the partition table

q quit without saving changes


P a g e | 67

W write table and exit

press n

press p -- primary partition, press 1, press enter, press enter

# mkfs.ext4 /dev/sdb1

3) Mount the partition and use it


# mount /dev/sda /folder1
# cd /folder1

To unmounts
# cd ..

# umount /dev/sda

SCP-SECURE COPYING FILES IN NETWORK


P a g e | 68

PC-1 PC-2

1. #mkdir /india/delhi 1. #mkdir /usa/ny


2. #cd /india/delhi 2. #cd /usa/ny
#cat >modi #cat >trumph
---------------- ----------------
---------------- ----------------
Ctrl+d Ctrl+d

3. Sending data 3. Sending data


#scp modi 192.168.5.2:/usa/ny/….. #scp trumph 192.168.5.1:/india/delhi/

2nd pc IP dest path

4. Receiving data 4. Receving data


#scp 192.168.5.2:/usa/ny/obama 5.
#scp 192.168.5.1:/india/delhi/modi
/india /delhi
/usa /ny
My own pc
Root password of other pc is required
Note: send directory My own pc
#scp -r Root password of other pc is required

SSH-SECURE SHELL ( In RHEl -7)


It is same like telnet connection but it is secure connection.
P a g e | 69

Ssh server:

#Systemctl start sshd

# Systemctl enable sshd

Turn off firewall

# Systemctl stop firewalld

# Systemctl enable firewalld

# useradd deepak

# passwd deepak

Ssh client:

#ssh root@serverIP

or

#ssh deepak@192.168.5.1

Run any command on server without login(user password require)

#ssh root@192.168.5.1 mkdir /root/india

# ssh root@192.168.5.1 ls /root/

To configure passwordless login

In client PC

# ssh-keygen

# ssh-copy-id deepak@server-IP
P a g e | 70

type deepak user password

How to check

# ssh deepak@192.168.5.1

you should be able to log on without asking any password

Restrict or permit specific users only

# vi /etc/ssh/sshd_config

at the end of the line add

AllowUsers deepak deepak1 :- these users are allowed only remaining are denied

or

DenyUsers deepak1 : this user is denied but remaining are allowed

or

AllowUsers deepak@192.168.5.1 deepak1 @192.168.5.2

#Systemctl restart sshd

Display a nice login banner

You can do it by modifying the content of /etc/issue.net file and adding the following line inside the
sshd configuration file.

banner /etc/issue.net

Allow SSH login using passwords only from specific hosts

[root@node3 ~]# vim /etc/ssh/sshd_config


# Turn this option to 'no' to deny password based login for public
PasswordAuthentication no

# Add below content to allow password based login from node2 (10.0.2.31)
Match Address 10.0.2.31
PasswordAuthentication yes
[root@node3 ~]# systemctl restart sshd
P a g e | 71

Allow SSH from certain users, host and subnet

[root@node3 ~]# vim /etc/ssh/sshd_config


# Turn this option to 'no' to deny password based login for public
PasswordAuthentication no

# Add below content to allow password based login from subnet 10.0.2.*
Match User deepak Address 10.0.2.*
PasswordAuthentication yes

Allow SSH login only for a certain group

[root@node3 ~]# vim /etc/ssh/sshd_config


# Turn this option to 'no' to deny password based login for public
PasswordAuthentication no

# Add below content to password based login for all users part of group 'techteam'
Match Group techteam
PasswordAuthentication yes

Linux to Linux ( NFS) Network File Service

Linux PC-1 Linux PC-2


How to access
1)# yum install nfs\*
# mkdir /india/delhi # yum install nfs\*
# chmod 777 /india/delhi # systemctl start rpcbind
2) vi /etc/exports # systemctl enable rpcbind
# rpcinfo -p 192.168.5.1 (pc-1 IP)
/india/delhi *(rw,sync)
Or Now mount it in any directory
/india/delhi 192.168.5.3(ro,sync) # mount 192.168.5.1:\india\delhi \mnt
#cd /mnt
Save and exit #ls

3) # exportfs -a
# exportfs -v

4) # systemctl start rpcbind


# systemctl enable rpcbind
# systemctl start nfs
P a g e | 72

# systemctl enable nfs

5)# rpcinfo -p 192.168.5.1(self pc)

Permanently mounting File system

# vi /etc/fstab

At the end of line add

192.168.5.1:/india/delhi /share1 nfs defaults 0 0

HTTP Web server in RHEL

# yum install httpd -y

# cd /var/www/html/

#ls

# nano index .html

<html>

<h1> Welcome to AWS training </h1>

</html>

# systemctl start httpd

# systemctl enable httpd

How to access : Open web browser and type :- http://instance-public-ip

Apache Web server in Ubuntu

# apt-get update

# apt install apache2

# cd /var/www/html/

#ls
P a g e | 73

# nano mobile.html

<html>

<h1> Welcome to Azure training </h1>

</html>

# systemctl start apache2

# systemctl enable apache2

# ufw disable

How to access : Open web browser and type :-

http://instance-public-ip or http://instance-public-ip/mobile.html

FTP server in RHEL

Centralise server to keep data

# yum install vsftpd -y

# cd /var/ftp

# mkdir software data

# cd data

# touch file1 file2 file3

# systemctl start vsftpd

# systemctl enable vsftpd

How to access : Open web browser and type :-

ftp://instance-public-ip
P a g e | 74

Shell File
Writing a script
To create a shell script, you use a text editor. A text editor is a program, like a word processor, that reads and
writes ASCII text files.

Vi, vi, nano anyone can be used

1) Write a shell file to create directories


# vi test.sh
mkdir india us auk aus

# chmod 700 test.sh


# sh test.sh

2) Write a shell file to restart the system


# vi test.sh
init 6

# sh test.sh
3) To display my username and home directory
# vi test.sh

echo $USERNAME
echo $HOME
4) Ececute date, cal, id and ls command at a time.

# vi test.sh
date
cal
id
ls

5) # vi test.sh

mkdir india
cd india
touch file1 file2 file3
mkdir dir1 dir2 dir3

6) Delete only .mp3 and .jpg files from a directory /home/john/song

# vi test.sh

rm –f /home/john/song/*.jpg
rm –f /home/john/song/*.mp3
P a g e | 75

Job Scheduling in Linux –Crontab

• The crontab (short for "cron table") is a list of commands that are scheduled to run at regular time
intervals on your computer system.
• The crontab command opens the crontab for editing, and lets you add, remove, or modify scheduled
tasks.
• The daemon which reads the crontab and executes the commands at the right time is called cron.
• Crontab executes jobs automatically in backend on specified time interval. For scheduling one time
tasks you can use at command in Linux.
• Each user on your system can have a personal crontab.

• Linux crontab have six fields. 1-5 fields denotes time and 6’th fields are used for command/script

How to Add/Edit Crontab

By default it will edit crontab entries of current logged in user.


# crontab –e
$crontab –e
To edit other user crontab use command as below:
# crontab -u username –e
Schedule a cron to to create india directory in desktop of deepak.
P a g e | 76

Create a shell script file first


# vi abc.sh
mkdir /home/deepak /Desktop/india

# chmod 700 abc.sh


Now
# crontab –e
30 09 17 10 tue sh /home/deepak/Desktop/abc.sh

Time- 9:30 AM, 17th oct, Tuesday


1) Schedule a cron to execute at 10 pm daily.
This will be useful for scheduling database backup on daily basis.
# crontab -e
0 22 * * * /bin/sh backup.sh
2) Schedule a cron to execute twice a day.
command will execute at 5AM and 5PM daily. You can specify multiple time stamp by comma
separated.
Ans : 0 5,17 * * * /scripts/script.sh
3) Schedule a cron to execute on every minutes.
Ans: * * * * * /scripts/script.sh
4) Schedule a cron to execute on every Sunday at 5 PM.
This type of cron are useful for doing weekly tasks, like log rotation etc.
Ans: 0 17 * * sun /scripts/script.sh
5) Schedule a cron to execute on every 10 minutes.
These type of crons are useful for monitoring
Ans: */10 * * * * /scripts/monitor.sh
6) Schedule a cron to execute on selected months.
Some times we required to schedule a task to be executed for selected months only.
Ans: * * * jan,may,aug * /script/script.sh
P a g e | 77

chmod
To change the permissions of a file or directory. Use ls -l to see the permission settings.

Permission group:

1. Owner
2. Group
3. All Other Users
Permissions representation:

1st digit represent owner

2nd digit represent group

3rd digit represent all other users

Permission types

Read – 4

Write – 2

Execute – 1

Null permission (access denied) – 0


P a g e | 78

# mkdir dir1 or touch file1

# ls –l file1 or ls –l dir1

Q - How to set Permission ?

Ans : chmod 7 6 3 test

1. Give full permissions to all .


#chmod 777 test

2. Give permission to user only .

#chmod 700 test

3. Other way to assign permissions.

#chmod u+r test


#chmod g-w test
# chmod u+rw test
#chmod a+r test

Note: a = all ( u,g,o)

You might also like