Aerosol Posted March 23, 2015 Report Posted March 23, 2015 For the begin you should add the next code in a file named log_users:#!/bin/bash# Author razvan1# If have any issues send an PM on hackyard.net/forumFILE=/etc/bash.bashrcFILE1=/etc/rsyslog.d/bash.confFILE2=/etc/init.d/rsyslogFILE3=/etc/logrotate.d/rsyslogif [ -f $FILE ]; then echo "export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" )[$RETRN_VAL]"'" >> /etc/bash.bashrcelse echo "File $FILE does not exists" exit 0fiif [ -f $FILE1 ]; then echo "File $FILE1 exists. Delete it" exit 0else touch /var/log/commands.log echo "local6.* /var/log/commands.log" >> /etc/rsyslog.d/bash.conffiif [ -f $FILE3 ]; then sed '/"\var\log\messages"/a "\var\log\commands.log"' $FILE3else echo "File $FILE3 does not exists" exit 0fiif [ -f $FILE2 ]; then service rsyslog restartelse echo "File $FILE2 does not exists. Install? [y/N]" read -p "Install rsyslog? [y/N] " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] then apt-get install rsyslog -y else exit 0 fifiAfter proceed this step use the command chmod +x log_users to be able to run the script and enjoy it Author: razvan1@hy Quote