Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

/els cdAss.

1. Login as centos (password is centos)


2. Find the present Directory

Pwd --"print working directory" (afișează directorul de lucru)

3. Print the / directory structure


Ls -R /

4. Print a few commands available in /bin and /sbin directory


Cd /b tab
Cd /bin
Ls
Cd ..

Ls /sbin
5. Locate the centos directory
Locate centos less
6. Print the permissions of centos directory
Pwd
Cd
Cd /home/
Ls -al

7. Create a new Directory test in centos directory

Mkdir test

Cd /

Cd /home/centos

Pwd

Ls

Mkdir test

Ls

8. Print the permissions of test directory

Ls -all

9. Copy the file /etc/resolv.conf in test directory

Cp /etc/resolv.conf /home/centos/resolv.conf

Ls
10. Rename the test directory to testing

Mv /home/centos/test /home/centos/testing/

ls

11. Delete the testing directory


Rmdir testing
ls
12. Change the permissions of centos directory to 775
Ls -all
13. Cd ..
14. Pwd - /home

Chmod centos 775

Cd centos/

Chmod centos

Chmod 775

Cd ..

Ls

Chmod 775 centos

Ls -all

15. Login as root user (password is centos)

Sudo su –

16. Change the permissions of /tmp directory to 700 sa fii in /


Cd /
Chmod 700 tmp
Pwd
Chmod 700 /tmp
Ls -all

17. Change the permissions of centos directory to 700 trebuie sa fii in root cu /

Cd /home/

Ls

Chmod 700 centos

Ls -all

18. c
19. Uname -r
20. Shutdown -h nowEExe
Assigment 2

1. Login as guest

2. Change directory to /
Cd / m
Pwd

3. List the contents of /home directory

Ls /home

4. Find the group to which guest belongs

Id -g guest

Id -g centos

5. Create a file syslinus in the home area of guest (hint: use touch command)

Cd

Cd /home/centos/

Ls

Pwd

Touch syslinus

Ls

6. Find the permissions of the file syslinus

Ls -all

7. Find the inode number of file syslinus (hint: ls –li)

Ls -li / tab

Ls -li /home/centos ta

Ls -li /home/centos/syslinus

8. Copy the file syslinus to syslinus1


Cp /home/centos/syslinus /home/centos/syslinus1

ls

9. Find the inode number of file syslinus1 (hint: ls –li)

Ls -li /home/centos/syslinus1

10. Move the file syslinus to syslinus2

Mv syslinus syslinus2

ls

11. Find the inode number of file syslinus2 (hint: ls –li)

Ls -li /home/centos/syslinus2

12. Move syslinus2 to syslinus

Mv syslinus2 syslinus

ls

13. Login as root

Sudo su -

14. Create a new user guest1 with same group as guest (hint: use GUI tool ApplicationsSystem
Settings Users and Groups)[More on this later in the course]
Startx
Systemctl start graphical.targetls

15. Create a new user guest2 with a different group than the group of guest (hint: use GUI tool
ApplicationsSystem Settings Users and Groups)

16. Find, what permissions should the file syslinus have, so that both guest1 and guest2 can
write into this file.

Assigment 3

Login as root (password is Asimov)

Sudo su -
Open two Text Mode Virtual Consoles and login as guest (password is guest123) and root. Switch
between different Text Mode Consoles and GUI Mode Console.

Ctrl plus Alt

startx

Write a few lines in Open Office Writer and save the document in Ms Word format

4. Update the OS

Yum update

Create a folder of your name on the desktop

Mkdir /home/student/Desktop

Use the Text Editor and write a few lines. Save the file on the Desktop

Vim Ana

7. Change the Desktop Background

Change background

Change the font to

Change the screen resolution toEdate

10. Find out the current run-level and how many daemons are running

runlevel

11. Remove a software package and install it again

Advance the Date by a day and time by an hour

Data –set = “06/06/2023”

Date –set = “19:00

Hwclock --systohc

”Find out the current CPU and Memory Utilization

Free

top

Lock the screen and unlock it

Take a screenshot of a terminal session and save it on your desktop

Gnome-screenshot –window –file ¬/Desktop/screenshot

Yum install gnome-screenshot


Change the language to

Access remote desktop of your friend

Assignment 4

1. Login as student (password is student)


2. Open Terminal and find out the shell you are using.

Echo $SHEEL

3. Change your shell to sh


Chsh -s /bin/sh
Chsh -s /bin/bash

4. Write a shell script (using vi editor) to create a directory test in your area and copy the
contents of /etc in test directory.

Cd /home/student/

Touch scripts.sh

Chmod +x script.sh

Ls

Vi scripts.sh

#!/bin/sh

Mkdir tilda/test

Cp -R /etc tilda/test

Ls

Cat script.sh

5. Move the contents of test directory in test1 directory

Cd /home/student/

Ls

Mv test/ test1/

Cd test1/

Ls

Cd ..

Pwd
6. Copy the test1 directory in /tmp

Cp -R test1/ /tmp/

Cd /tmp/

Ls

Cd test1/

Ls

Cd ..

7. Write, the date of Creation/Modification, ownership, group and permissions of test1


directory

Ls -l test1/

8. Tar and gzip the contents of test1.


Tar -czvf test1.tgz test1/
ls

9. Move the test1.tgz into your area and Untar it

Mv test1.tgz /home/student/

Cd ..

Cd /home/student/

Ls

Pwd

10. Write the names of all the files in test1 directory and its subdirectories which have as in their
name into a file asname (ls -al test1 > /tmp/asname)

Tar -xzvf test1.tgz

11. Delete the test1 directory using rm command and see if you find it in Trash

Rm -r test1/

Locate trash
Locate Trash

Cd /usr/share/dbus-1

12. Use find command and locate command to find the location of passwd command

Find passwd

Find -name passwd

13. Find out the number of commands in /bin

Ls -l /bin | wc

14. Create a command to create new users (Use useradd command. See the man page of
useradd for command options). Use chmod to give it appropriate permission so that only
student user can run this command
Cd /home/student
Vi script.sh

Las prima linie doar dupa scriu


Ls

15. Compute the MD5 Checksum of kernel file

Md5sum / tab

Md5sum /boot/vmlinuz-4.18

Assignment 5

1. Login as guest (password is guest123)

2. Find out the disk usage of /etc directory

Du -sh /etc/

3. Find out the disk free space of / partition

Df -h /

4. Create two users guest1 and guest2. guest1 should have his home directory in /users/guest1
and guest2 should have home directory in /home/guest2.
Sudo useradd -d /users/guest1 -m guest1

Sudo useradd -d /home /guest2 -m guest2

5. Set their passwords to guest123.

Passwd guest1

Sudo su –

Passwd guest1

Passwd guest2

6. Start an FTP server on your machine. (Use service vsftpd start). Try to ftp from other
machines using guest1 and guest2 accounts.
Yum install vsftpd
Systemctl status vsftpd

Ssh 192.168.0.102
Ssh guest1@192.168.0.101
logout

7. Use ssh and telnet to access your friends machine using guest1 and guest2 accounts
8. Ssh 192.168.0.102
9. Ssh guest1@192.168.0.101
10. logout

telnet 101

logout

11. Delete the users guest1 and guest2 and remove their home directories.

Userdel -r guest1/2

Cd /home

12. Find out the total CPU utilization and Memory Utilization

top

13. Find out the PPID and PID of httpd process


Ps -ef bara verticala grep httpd
2316

14. Kill the httpd process

Kill httpd
Kill 2316

15. Traceroute to www.google.com and find out the round trip time to reach google server.
Yum install traceroute
Traceroute www.google .com

16. Use tcpdump to capture all packets on your Ethernet Interface

Ifconfig

Tcpdump – I enp0s3 -w capture.pcap

17. Find out the Default Gateway of your machine


Route -n

18. Find out the IP address of www.intel.com

Nslookup www.intel.com

19. Find out the uptime of your system

uptime

20. Check if the server www.google.ro is reachable on the network.

Ping www.google.ro

Assignment 6

1. Install, check the status and turn on the following services: crond, gpm, httpd, clamav,
iptables/firewalld, mysqld/mariadb, postfix and sshd

Sudo su –

Yum install httpd

Yum install crond

Yum search crond

Yum install clamav

Yum install firewalld

Yum install mysqld

Yum install postfix

Yum install sshd

Yum install mariadb

Yum install crond


Status crond

Systemctl status gpm

Systemctl start hhtpd

Systemctl start mariadb

Yum -y install mariadb

Systemctl start mariadb

Systemctl start sshd

2. Open the following services in firewall: http, https, ntp and ssh

Firewall-cmd –add-service=http/hhtps/ntp/ssh

3. Prepare the installation and install Wordpress Content Management System


4. Set up a daily cron job that update the clamav virus database midnight at 00:01

Locate clamav

Locate crondtab

Cd /etc/cron.daily/

Vim clamdscan

Crontab

5. Set up a daily cron job that scan the content of Apache document directory at 00:03; the
output of scanning will be send by e-mail at root@hostname/root@ip_address
6. Set up a daily cron job at 00:05 that make a backup of Wordpress database in /var/backup/
directory; the resulted file will be compressed by gzip and will have a name like this: wpdb-
05-10-2020.sql.gz
7. Set up a daily cron job at 00:10 that clear RAM memory cache, buffer and swap
8. Modify the current hour at 00:00 and test all the cron tasks (4-7); almost all errors are send
by e-mail to root@hostname
Assignment 7

Sudo su –

Ifconfig

Ip addr show

Ex 3 startx

Ex 4

Cd / etc/sysconfig/network-scripts

Ls

Vi en..

Ping ip

Ifconfig

Ping 8888

Ex 5

Locate crontab

Sudo su –

Locate cron

Locate cron.daily

Cd /etc/cron.daily/

Ls

Touch backup_script.sh

Ls

Chmod +x backup_script.sh

Ls

7 tcpdump –version
Yum remove tcpdump

Yum install tcpdump

tcpdump –version

You might also like