---
# System prepended metadata

title: Практическая 2

---

# Практическая 2 

## Задача к практической работе 2.1:

- Изучить работу всех утилит.
- Использовать при работе исключительно терминал.

### df

df 
![](https://i.imgur.com/oorKx6b.png)

df -all / df -a
![](https://i.imgur.com/7ydBRS4.png)

df -h 
![](https://i.imgur.com/hd79e5K.png)

df -H
![](https://i.imgur.com/TgDUFDW.png)

df -i
![](https://i.imgur.com/urYaah4.png)

df -k
![](https://i.imgur.com/oOtDYCm.png)

df -P
![](https://i.imgur.com/GSOSlx1.png)

df --total
![](https://i.imgur.com/ozlR5Tq.png)

df --output
![](https://i.imgur.com/KuBbTJB.png)

df --help
![](https://i.imgur.com/SNRQ92n.png)

df -x tmpfs
![](https://i.imgur.com/ScbfXTA.png)

df -x devtmpfs -x tmpfs
![](https://i.imgur.com/dS1TCA4.png)

df -t ext4
![](https://i.imgur.com/8q4O35S.png)

df -h /dev/sdb6
![](https://i.imgur.com/FdzXtxX.png)

df -h /home
![](https://i.imgur.com/eoxPvgg.png)

--

### du

du ~/Documents
![](https://i.imgur.com/8NdSLq3.png)

du ~/Documents ~/Pictures ~/.zshrc
![](https://i.imgur.com/uY73U0n.png)

du -a ~/Documents
![](https://i.imgur.com/u6pOfTv.png)

sudo du -h /var
![](https://i.imgur.com/svsqR5l.png)

sudo du -sh /var
![](https://i.imgur.com/5D88DV0.png)

sudo du -csh /var/log /var/lib
![](https://i.imgur.com/PFDzB17.png)

sudo du -h --max-depth=1 /var/lib
![](https://i.imgur.com/hrmMYYk.png)

sudo du -sh --apparent-size /var/lib
![](https://i.imgur.com/a8YtBb1.png)

sudo du -csh ~/Do*
![](https://i.imgur.com/hOZhbBp.png)

sudo du -h /var/ | sort -rh | head -5
![](https://i.imgur.com/jJkgoMf.png)

--

### free

free
![](https://i.imgur.com/ws4g6v0.png)

free -h
![](https://i.imgur.com/g5MjY5r.png)

free --mega
![](https://i.imgur.com/KYsApT6.png)

free -h -t
![](https://i.imgur.com/PnQSvB6.png)

free -s 5
![](https://i.imgur.com/JTQ9dF0.png)

free -s 5 -c 10
![](https://i.imgur.com/M8rVj3d.png)
![](https://i.imgur.com/MejGmib.png)

free -h --si -s 5 -c 4
![](https://i.imgur.com/pdJgSvb.png)

watch free -h
![](https://i.imgur.com/N9coLt9.png)
![](https://i.imgur.com/HMvGuVv.png)

--

### iostat

iostat
![](https://i.imgur.com/h3S2VeR.png)

iostat -c 
![](https://i.imgur.com/J8UB0Sw.png)

iostat -d
![](https://i.imgur.com/J3kJNYu.png)

iostat -h
![](https://i.imgur.com/rWd6RFA.png)

iostat -k
![](https://i.imgur.com/23sSBMX.png)

iostat -o JSON
![](https://i.imgur.com/W4wmASB.png)

iostat -p
![](https://i.imgur.com/CclDjxt.png)

iostat -x
![](https://i.imgur.com/uqTwOa8.png)

iostat -y
![](https://i.imgur.com/iKmssd1.png)

iostat -z 
![](https://i.imgur.com/DiJcllt.png)

sudo iostat 
![](https://i.imgur.com/s3JtKQe.png)

sudo iostat -h
![](https://i.imgur.com/3jje8bc.png)

sudo iostat /dev/nvme0n1
![](https://i.imgur.com/RHAjGUy.png)

sudo iostat -p /dev/nvme0n1
![](https://i.imgur.com/8PwPCQg.png)

sudo iostat -y -p /dev/nvme0n1 1
![](https://i.imgur.com/cz6TLFB.png)

сохраняю df -hl 
![](https://i.imgur.com/Yi7vQLr.png)

iostat -xk -t 10 | awk '// {print strftime("%Y-%m-%d %H:%M:%S"),$0}' >> iostat.log &
![](https://i.imgur.com/6tx47nt.png)

--

### mpstat

mpstat 
![](https://i.imgur.com/1HXD9WJ.png)

mpstat -A
![](https://i.imgur.com/yQjzsYQ.png)

mpstat -P ALL
![](https://i.imgur.com/2cUpfsP.png)

mpstat -P 0
![](https://i.imgur.com/qXhgngt.png)

mpstat -V
![](https://i.imgur.com/Q5vfroA.png)

mpstat --help 
![](https://i.imgur.com/cYE9kY6.png)

--

### vmstat

vmstat
![](https://i.imgur.com/Olma8w9.png)

vmstat -a 
![](https://i.imgur.com/lWIIQdx.png)

vmstat -f
![](https://i.imgur.com/pSFeO9N.png)

vmstat -d
![](https://i.imgur.com/YLrym9r.png)

vmstat -D
![](https://i.imgur.com/2QXzvMs.png)

vmstat --help
![](https://i.imgur.com/w6XGAsV.png)

wmstat 1
![](https://i.imgur.com/mAwjHO6.png)

--

### w

w
![](https://i.imgur.com/gzrpeDn.png)

w -h
![](https://i.imgur.com/YliyKcp.png)

w -u
![](https://i.imgur.com/D1MWx2O.png)

w -s
![](https://i.imgur.com/H1Pd2bc.png)

w -f
![](https://i.imgur.com/niB5Vmx.png)

w -i
![](https://i.imgur.com/EqoLS3G.png)

w -o
![](https://i.imgur.com/0CJYrwF.png)

w -V 
![](https://i.imgur.com/F2IFtIX.png)

--

### htop

sudo apt install htop
![](https://i.imgur.com/IzQ1xqg.png)

htop
![](https://i.imgur.com/UNn9XIL.png)

![](https://i.imgur.com/1on7Slw.png)

sudo htop -d 1
![](https://i.imgur.com/h1ByO3e.png)

sudo htop -t
![](https://i.imgur.com/yrV41Me.png)

## Задача к практической работе 2.2:

- Установить, настроить SSH-сервер, клиент.

sudo apt-get install ssh
![](https://i.imgur.com/Io2cWLS.png)

service ssh status
![](https://i.imgur.com/T8P1GI2.png)

cat /etc/ssh/sshd_config
![](https://i.imgur.com/WJzqSKt.png)

- Отключить доступ по root-пользователю.
- Сменить порт по умолчанию на любой другой.

nano /etc/ssh/sshd_config
![](https://i.imgur.com/XIMY9zo.png)

![](https://i.imgur.com/8otvVtC.png)

![](https://i.imgur.com/BkQrzg7.png)

![](https://i.imgur.com/jPaID2r.png)

systemctl restart ssh + ssh admins@test_host

![](https://i.imgur.com/8OZP2SJ.png)

![](https://i.imgur.com/1mNcs1b.png)

![](https://i.imgur.com/ADSxxgb.png)

- Подключиться к серверу linux c хостовой операционной системы через Putty. 

![](https://i.imgur.com/oBO7OkI.png)

## Задача к практической работе 2.3:

- Разобраться как работает доступ по ключам.

есть 

- Организовать аунтификацию к серверу linux через ключи.

Установила Debian 10. Сгенерировала ключи, они хранятся в /.ssh
![](https://i.imgur.com/QTzeD1L.png)

Скопировала ключ на сервер
![](https://i.imgur.com/WpPtQdG.png)

![](https://i.imgur.com/FE6nnyO.png)

Зашла на сервер 
![](https://i.imgur.com/Hb9yM2d.png)

- Организовать аунтификацию к серверу linux через ключи без пароля.

Зашла в файл и отключила пароль
![](https://i.imgur.com/AKuGjDS.png)

![](https://i.imgur.com/Y82zh9Q.png)

![](https://i.imgur.com/V2UN0l2.png)

## Задача к практической работе 2.4:

- Научитесь скачивать файлы с помощью утилиты wget.

cat /etc/*release
![](https://i.imgur.com/4FrEqEQ.png)

uname -a
![](https://i.imgur.com/muMMSD3.png)

whoami
![](https://i.imgur.com/9FStu7S.png)

uptime 
![](https://i.imgur.com/S1UzYvX.png)

ls -la /home
![](https://i.imgur.com/a95lotr.png)

sudo chmod o-rx /home/admins
![](https://i.imgur.com/yXZJ9ST.png)

ip neigh
![](https://i.imgur.com/um4nwf4.png)

sudo ss -tlnp
![](https://i.imgur.com/wY5rRex.png)

sudo -l
![](https://i.imgur.com/tafiHmZ.png)

sudo find / -user root -perm -4000 -exes ls -ldb {} \; 2> /dev/null
![](https://i.imgur.com/49D6lim.png)

Скачала файл 
![](https://i.imgur.com/salDk0s.png)

Распаковала
![](https://i.imgur.com/2L147sy.png)

Совпало 
![](https://i.imgur.com/tLGhZrj.png)

cd lynis + ls
![](https://i.imgur.com/TcxEMbW.png)

sudo ./lynis audit system
![](https://i.imgur.com/I9An9A7.png)

![](https://i.imgur.com/rttk1r0.png)

![](https://i.imgur.com/JUDLjUp.png)

sudo ./lynis show options 
![](https://i.imgur.com/wmtOSxJ.png)

![](https://i.imgur.com/Tu8GE4W.png)

![](https://i.imgur.com/2zUahzc.png)

- Научиться проверять пакеты на целостность.

dpkg -l
![](https://i.imgur.com/qqNYR5V.png)

dpkg -L coreutils
![](https://i.imgur.com/Q7EF05F.png)

/bin/dir --help 
![](https://i.imgur.com/EP0zfyj.png)

Переименовала
![](https://i.imgur.com/z7AMq6K.png)

Проверила
![](https://i.imgur.com/GPpVuaE.png)

Скачала 
![](https://i.imgur.com/klPDyAB.png)

debsums -ac/-cs coreutils 
![](https://i.imgur.com/q1mswnP.png)

![](https://i.imgur.com/2bHIKBx.png)

![](https://i.imgur.com/OuCItYD.png)

![](https://i.imgur.com/9lWl0dO.png)

Отсортировала 
![](https://i.imgur.com/hGxwWZs.png)

Посмотрела
![](https://i.imgur.com/XCv4ROy.png)

## Задача к практической работе 2.5:

- Научиться работать c .bashrc, .bash_profile и .bash_login.

Скачала
![](https://i.imgur.com/2plHBpp.png)

printenv
![](https://i.imgur.com/hZkzWci.png)

![](https://i.imgur.com/Pmpam6q.png)

env HOME=/home/admins
![](https://i.imgur.com/Qs0EwH0.png)

Поработала с TESTKALI
![](https://i.imgur.com/hkerllg.png)

![](https://i.imgur.com/RfoiWDl.png)

Перезапустила и проверила 
![](https://i.imgur.com/3VtYgJ3.png)

Вернула все обратно
![](https://i.imgur.com/A4SdI6n.png)

nano /etc/profile
![](https://i.imgur.com/byfC2LI.png)

Изменила 
![](https://i.imgur.com/ZExG7R2.png)

Перезапустила 
![](https://i.imgur.com/4QbtIZf.png)

После вернула к исходному состоянию 