Занятие 2. Администрирование Linux
Практическая работа №2.1
1. Команда df в linux
Показывает сведения о файловой системе, на которой расположен каждый из файлов, или обо всех файловых системах:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Посмотрим доступное пространство на всех примонтированных разделах и информацию о них:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Более читаемый формат:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Информация обо всех файловых системах известных ядру, которые были смонтированы:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Можно использовать опцию -x для фильтра:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Можно указать файловую систему, которую нужно отображать:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
С помощью опции -i можно посмотреть информацию про состояние inode в файловой системе:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Вывести объем доступного пространства в каталоге:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
2. Команда du в Linux
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
При выполнении без какой-либо опции du отображает использование диска для данного файла или каталога и каждого из его подкаталогов в байтах:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Использование дискового пространства каждым файлом в каталоге:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Отобразить только пространство, занимаемое данным каталогом, в удобочитаемом формате:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Сообщить только общий размер указанного каталога, а не подкаталогов:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Объединенный размер каталогов:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Отобразить использование диска подкаталогами n-уровня:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Получить размер всех каталогов, начинающихся с «Do»:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Использование du с другими командами:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
3. Команда free в Linux
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Отображает информацию о памяти и подкачке в килобайтах:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Просмотреть информацию в удобочитаемом формате:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Отображает строку, показывающую итоги столбца:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Непрерывно печатать результат:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Анализ памяти каждые 5 секунд 4 цикла в удобном формате со степенью 1000Гб:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
4. iostat
Установка:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Запуск:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Просмотр данных в удобном формате:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Просмотр данных по нужному устройств:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Можно посмотреть статистику по каждому разделу устройства:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Автоматическое обновление данных каждую секунду:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Без суммирования всех данных с момента запуска операционной системы:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Профилирование нагрузки на файловую систему с помощью iostat.
Для начала нужно сохранить df -hl:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Получение лог файла и ввод лога:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
5. mpstat
Отображение всей информации:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Показать статистику CPU индивидуального процессора (или) ядра:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Отображение статистически о конкретном CPU или ядре:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Показать версию утилиты:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
6. vmstat:
Краткуая информация о различных ресурсах системы и связанных с ними неполадках, приводящих к снижению производительности:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
активная/неактивная память:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
количество вилок с момента загрузки:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
статистика диска:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
общая статистика диска:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
7. Утилита/команда " w "
Выводит краткую сводку о работающих в системе в данный момент пользователях (залогиненных пользователях), а также о том, какие процессы у них запущены:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Не выводить заголовок у таблицы:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Игнорировать имена пользователей при определении времени текущего процесса и времени CPU:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Использовать сокращенный формат вывода:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Включить или выключить вывод поля from:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Выводить в поле from IP-адрес вместо имени хоста:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Выводить информацию в старом формате:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Вывести версию утилиты w:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
8. Утилита htop
Установка:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Просмотреть все процессы в Linux:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Ускорить или замедлить частоту обновления htop (каждую секунду):
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Вывести процессы в виде дерева:

Практическая работа №2.2. Установка и настройка сервера SSH в Linuxh
1. Установка пакетов SSH

Проверим автоматический запуск SSH-сервер в режиме демона:

2. Настройка SSH
Поменяем порт соединения (чтобы он не сканировался роботами). Отключим парольный доступ и root-доступ:

Для применения сделанных настроек перезапустим SSH-сервер:

Попробуем зайти на сервер с Ubuntu:

3. Настройка и использование клиента SSH
Создадим алиас для пользователя alexa:

Подключимся к серверу от имени пользователя:

4. Для генерации ключей используется утилита ssh-keygen:
Сгенерируем ключ:

Скопируем открытый ключ на сервер:

Мы запустили защищённый сеанс удалённого управления.
Практическая работа №2.3. Установка и настройка SSH-authorized_keys
1. Создание ключей SSH
Сгенерируем на локальном компьютере пару ключей SSH:

2. Как скопировать открытый ключ на ваш сервер

3. Аутентификация на сервере с использованием ключей SSH

Нам удалось войти в свою учетную запись через SSH без ввода пароля, это означает, что мы успешно настроили для своей учетной записи аутентификацию на базе ключей SSH.
4. Отключение аутентификации с помощью пароля на серверe
Отключим вход по паролю и перезапустим сервер:

Практическая работа №2.4. Сбор информации о Linux и WGET
1.Базовый сбор информации
Начнём со сбора информации о дистрибутивах:

По ядру linux можно понять следующее:

Имя пользователя для эффективного идентификатора пользователя:

Посмотрим когда и сколько система работала:

Посмотри права директории /home:

Чтобы ограничить права другим пользователям делаем следующее:

Посмотрим с какими компьютерами происходит обмен данными:

Какие сервисы и с какими портами запущены:

Посмотрим список прав пользователя:

2.Суидные файлы
Сбор информации:

Скачаем инструмент аудита безопасности:

Разархивируем скаченный пакет:

Проверим контрольную сумму:

Переходим в директорию lynis:

Запускаем утилиту lynis:

Вывод report-отчёт:

3. Проверка целостностей пакетов
Просмотрим пакеты в системе:

Посмотрим установленные утилиты:

Симитируем подмену или правку кода программы:

Проверем файл:

Посмотрим, когда и с какими файлами проводилась работа:

По одному конкретному пользователю:


cjGjGS8.png)
Практическая работа №2.5. Переменные окружения в Linux .bashrc, .bash_profile и .bash_login
1. Просмотр списка системных переменных окружения
Раскроем список всех переменных окружения:

2. Запуск команд с указанием нового значения переменной окружения
Можно самостоятельно на время изменить опцию любого параметра:

Установка и удаление локальных переменных окружения:

Добавление и удаление пользовательских переменных
Рассмотрим классы переменных, которые хранятся в конфигурационных файлах:

Отредактируем пользовательскую конфигурацию:

Создание и удаление системных переменных окружения
Откроем конфиурационный файл системных переменных окружения:

Проверяем изменения:
