sudosh is a sudo shell, filter and can be used as a login shell.
Sudosh records all keystrokes and output and can play back the session as just like a VCR.
Sudosh records all keystrokes and output and can play back the session as just like a VCR.
Установка:
$ wget https://github.com/squash/sudosh2/archive/master.zip
$ unzip master.zip
$ cd ./sudosh2-master
$ env CFLAGS="-D_GNU_SOURCE" ./configure
$ make install
$ make install
Настройка:
Создаем папку для хранения логов-записей:
$ mkdir /var/log/sudosh/
Даем права на нее:
$ chmod 733 /var/log/sudosh/
В конец файла /etc/shells добавляем "/usr/local/bin/sudosh":
$ grep "/usr/local/bin/sudosh" /etc/shells || echo "/usr/local/bin/sudosh" >> /etc/shells
В /etc/sudosh.conf меняем default shell = /bin/bash:
sed -i "s|default shell.*|default shell = /bin/bash|g" /etc/sudosh.conf
Добавляем в окружение путь к sudosh:
$ echo "export PATH=\${PATH}:/usr/local/bin" > /etc/profile.d/sudosh.sh
sed -i "s|default shell.*|default shell = /bin/bash|g" /etc/sudosh.conf
Добавляем в окружение путь к sudosh:
$ echo "export PATH=\${PATH}:/usr/local/bin" > /etc/profile.d/sudosh.sh
В /etc/passwd изменяем shell по-умолчанию на sudosh:
$ usermod -s /usr/local/bin/sudosh USERNAME
Должно получиться так (пример):
$ usermod -s /usr/local/bin/sudosh USERNAME
Должно получиться так (пример):
USERNAME:x:1002:1002::/home/USERNAME:/usr/local/bin/sudosh
==============================
Собрать RPM-пакет:
yum install rpm-build gcc make
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
wget -P ~/rpmbuild/SOURCES/ https://github.com/squash/sudosh2/archive/master.zip
unzip -j ~/rpmbuild/SOURCES/master.zip sudosh2-master/sudosh.spec -d ~/rpmbuild/SPECS/
Исправляем в SPEC-файле следующие параметры:
%define version master
%define release 1.0.6.el6
Source: https://github.com/squash/sudosh2/archive/master.zip
rpmbuild -ba /root/rpmbuild/SPECS/sudosh.spec
==============================
Собрать RPM-пакет:
yum install rpm-build gcc make
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
wget -P ~/rpmbuild/SOURCES/ https://github.com/squash/sudosh2/archive/master.zip
unzip -j ~/rpmbuild/SOURCES/master.zip sudosh2-master/sudosh.spec -d ~/rpmbuild/SPECS/
Исправляем в SPEC-файле следующие параметры:
%define version master
%define release 1.0.6.el6
Source: https://github.com/squash/sudosh2/archive/master.zip
rpmbuild -ba /root/rpmbuild/SPECS/sudosh.spec