Pull to refresh

bash редактируем приветствия сервера Linux

Редактируем стандартное приветствия Linux/Bash


2018_02_05_16_50_16

1. Установим дополнительные пакеты «figlet»

sudo apt-get install figlet -y  

переходим в каталог суперпользователя…

cd /root/ 

Редактируем файл .bashrc
(добавим дополнения в низ после #fi)

nano .bashrc

echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Добро пожaлывать"$(tput sgr 0)"$(tput setaf 2)===================="$(tput sgr 0)
figlet harbarhab
echo "Точное время на сервере $(date)"

echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Место на HDD"$(tput sgr 0)"$(tput setaf 2)========================"$(tput sgr 0)
echo "Место на дисках HDD:"
df -h | sed -n '/^\/dev/p'

echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Полный объем HDD"$(tput sgr 0)"$(tput setaf 2)====================="$(tput sgr 0)
echo "Полный объем HDD:"
df -h

echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Свободно ОЗУ"$(tput sgr 0)"$(tput setaf 2)========================"$(tput sgr 0)
echo "Свободно ОЗУ"
free -m
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Загрузка системы"$(tput sgr 0)"$(tput setaf 2)===================="$(tput sgr 0)
uptime
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Кто на сервере "$(tput sgr 0)"$(tput setaf 2)======================="$(tput sgr 0)
w
who
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Имя Хоста"$(tput sgr 0)"$(tput setaf 2)==========================="$(tput sgr 0)
echo "Имя хоста сервера $(tput setaf 3)$(hostname -f)$(tput sgr 0)"
pwd
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Ошибки Буферизация Ядра"$(tput sgr 0)"$(tput setaf 2)===================="$(tput sgr 0)
dmesg |grep error
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Попытки Bruteforce"$(tput sgr 0)"$(tput setaf 2)=================="$(tput sgr 0)
lastb
echo "$(tput setaf 2)===================="$(tput sgr 0)"$(tput setaf 1)Дата смены пароля "$(tput sgr 0)"$(tput setaf 2)=================="$(tput sgr 0)
passwd -S aa
passwd -S root
echo "$(tput setaf 1)start ok "$(tput sgr 0)

alias ahc='echo -n >/home/aa/.bash_history && echo -n >/root/.bash_history && history -c -w && echo Готово!!!!!'

image

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

— Свободное место на HDD;
— Полный объем HDD;
— Свободно ОЗУ;
— uptime системы;
— Кто подключен;
— Имя хоста;
— Дата смены пароля…
Tags:
Hubs:
You can’t comment this publication because its author is not yet a full member of the community. You will be able to contact the author only after he or she has been invited by someone in the community. Until then, author’s username will be hidden by an alias.