Abhishek J NA Lab
Abhishek J NA Lab
COLLEGE
ATTINGAL
…………………………………………
LABORATORY RECORD
Certified that this is the bonafide record of experiment done
by Miss/Mr...................................of...........................Year/Semester
(RollNo.........................of....................................................Branch)
in the.........................................during the year........................
Name of Subject......................................................
Reg No................................................................
Theory :
Date :
Theory:
F A M I L IA R IS A T IO N O F F O R
P E R M IS S IO N F O R A U T H E N T IC A T IO N
A N D A U T H O R IS A T IO N
5. create 6 users
# s u d o u s e ra d d u s e rn a m e
6. change password of all users
#sudo passwd u s e rn a m e
Procedure:
Open Linux sever and enter a command and enter lsblk command
#lsblk
3 ) To create partitions in a particular hard disk, start Fdisk command and
select hard disk
# sudo fdisk /dev/sdb
4 ) To see available option in fdisk, type m.
5 ) Then enter #p command to print partition information. In the beginning the
partition list will be empty
6 ) To create a new partition type n. Default partition table is MBR.
7 ) Add three primary partitions and one extended partition
and create 3 logical partitions.
* First create primary partition and give +2G.
* Second create primary partition of +1G size.
* Third partition also a primary with +500m size.
* Then create extended partition and three
logical partitions
8 ) For Creating primary partition type p in partition type.
9 ) For creating extended partition type e in partition type.
10 ) Use default value partition number
11 ) Use default value for First sector
12 ) Choose appropriate value for Last sector (Example +2G for
2GB partition)
13 ) Repeat steps 8-12 to create additional partitions
14 ) Type w to save the partition information.
15 ) The next step to create file system. mkfs command is used for this purpose
Use Mkfs.ext4 /dev/sdb1 command to create file system in
sdb1 partition.Using the same command create file systems in
other partitions also
16 ) The next step is mouting the partition againt a mount point. Follow the
below steps
Create a mount point for each partition using mkdir command
(eg: mkdir /mnt/documents)
mount the directories against each partition using mount command
(eg: mount /dev/sdb1 /mnt/documents)
17 ) To automatically mount all the partitions during booting, modify fstab file and
add allthe mount points and corresponding partition. Follow the below steps
a ) #nano /etc/fstab.
b ) Add each partitions into the file using the format
Partition namemount point file system defaults 0 0
(ex: /dev/sdb1/mnt/documentsext4defaults 0 0 )
18 ) Reboot the server and check whether the partitions are mounted
or not.This completes the partitioning of harddisk using
fdisk utility.
Result: Hard disk partioning Using fdisk has been successfully completed.
Experiment No : 05
Inside fstab
/dev/sdc4 swap swap defaults 0 0
6.#lsblk for seeing the mount
Procedure:
1) Configure NAT and Host-only adapter in virtual machine.
Add additional host-only adapter from tools->network
manager option in Virtual Box management tool
Setup default gate for new host-only adapter
Host-only-adapter#2 ->configure
manually ->192.168.100.1/255.255.255.0 -> apply
2 ) From setting of virtual machine Select Network
* select Adapter 1tab
* Check Enable Network adapter option
* Select NAT in Attached to option
* Select Adapter 2 tab
* Check Enable Network adapter option
* Select Host-only Adapter Attached to option
* Select newly created host-only adapter in Name option
(VirtualBox Host-Only Ethernet Adapter 2).
3 ) Start Linux server and find yaml file(network configuration file)available in
/etc/netplan directory.
4 ) Open/Edit the yaml file using nano
#Cd /etc/netplan
#Sudo nanofilename.yaml(ex:00-installer-config.yaml)
Enter the following to that file and save and exit from nano
network:
ethernets:
enp0s3:
dhcp4:true
enp0s8:
dhcp: no
addresses: [192.168.100.10/24]
nameservers:
addresses: [8.8.8.8]
version:2
5 ) Apply configuration changes using command
#sudo netplan apply
6 ) Confirm ip address configuration using
ip a command.
7 ) Check network connection between host and
internet using ping command
8 ) Between server and internet using ping google.com
9 ) Between server and host machine using ping
host-ip-address.
10 ) Check connection between host and server
from host machine using ping server-address
6) To check the network configuration, ping the ip address which got from
commandprount.
#ping 192.168.100.10
Date :
INSTALLATION OF SSH IN LINUX SERVER
Aim: installation of SSH.
Procedure:
1 ) Configure network with NAT and Host-only-adapter
2 ) Check the presence of SSH.
#sudo systemctl status ssh
3 ) If SSH is not present install SSH.
#sudo apt update
#sudo apt install ssh
Then check status of ssh.
4 ) Check port used by SSH
#sudo ss -ltn
5 ) Check Ubuntu firewall status
#sudo ufw status
6 ) If Ubuntu firewall is inactive enable it.Using the
command below
#sudo ufw enable
7 ) Then enable rules for port 22/tcp
#ufw allow 22/tcp
8 ) Check Ubuntu firewall status again
#sudo ufw status
9 ) Make sure port 22/tcp is existing.
* Install OpenSSH client in windows
10 ) Go to apps & features -> optional features -> add a feature
* Choose OpenSSH Client and click install
* Windows will download and install openSSH Client
* Once insalled, it will appear in installed features lis
* Open command prompt (cmd) in windows
* Connect to Linux sever using ssh username@ipaddress
(of sever).
* Download and Enter ip address [192.168.100.10] in putty.
Then check the network configuration by list or make file
in one and check status in both.
In command prompt..
Result : ssh is installed and output is verified.
Experiment no.10
Date:
Procedure:File compression helps to reduce file size and share files efficiently. And compressed
files are also easier to copy to remote servers. Also compress older and rarely used files and save
Them for future use which helps you conserve disk space.
Tar
The tar command is used to create an archive, grouping multiple files in a single file.Its name
Syntax
This command creates an archive named archive.tar with the content of file1 and file2:
C stands for create. The f option is used to write to file the archive. The v is providing details
Of the files that have been archived.
• To remove the original files after creating an archive, use the –remove-files flag.
• Tar is often used to create a compressed archive, gzipping the archive. This is done
using the z option:
This is just like creating a tar archive, and then running gzip on it.
• To extract files from a compressed archive in the current folder, use:
• To unarchive a gzipped archive, use gunzip , or gzip -d , and then unarchive it, but tar -
xf will recognize it’s a gzipped archive
Gzip (GNU zip) is a compressing tool, which is used to truncate the file size. By default
original file will be replaced by the compressed file ending with extension (.gz).
Compress a file using the gzip compression protocol using the gzip command.
Gzip filename
This will compress the file, and append a .gz extension to it. The original file is deleted.
To prevent deleting files, you can use the -c option and use output redirection to write
the output to the filename.gz file:
Or
Gzip -k filename
There are various levels of compression. The more the compression, the longer it will take to
compress (and decompress). Levels range from 1 (fastest, worst compression) to 9 (slowest,
better compression), and the default is 6.
Gzip -1 filename
• Compress multiple files by listing them:
Gzip -r a_folder
• The -v option prints the compression percentage information. Example to used along
with the -k option:
Gzip -d filename.gz
• The compression ratio or how much the original file has compressed, use -l option.
Gzip -l filename.gz
Gunzip
The gunzip command is basically equivalent to the gzip command, except the -d option is always
enabled by default.
Gunzip filename.gz
This will gunzip and will remove the .gz extension, putting the result in the
Filename file.
• If that file exists, it will overwrite that.
Gunzip -k filename.gz
Gunzip -r directory
• List the Compressed File Contents, use the -l option
Gunzip -l filename.gz
Result:
Successfully executed File compressing mechanisam using tar Gzip and gunzip.