First lets create the logging script after sudo -s:
cat >>/usr/bin/logwatch
Paste this, then control-c when its pasted in the terminal, alternatively you can use a text editor..
#! /bin/bash
watch tail -n 80 /var/log/messages
Note: You can replace /var/log/messages with any log you choose, like a firewall log for instance.
Make /var/log/messages Readable and our script executable, for this I'll use chmod:
chmod 644 /var/log/messages
chmod +x /usr/bin/logwatch
Now append /usr/bin/logwatch to /etc/shells then save/exit
gedit /etc/shells
Now lets create the user that we can login via the TTY
adduser logwatch --shell /usr/bin/logwatch
Set a password, like "logwatch"
Now lets try this out, all you need to do now is simply press ALT-CTRL-F1 or any other TTY from F1-F6 then login as "logwatch" with password "logwatch", what will happen is the user will be logged into our /usr/bin/logwatch script and only be able to watch the log, so we can cycle between tty's and X
Here is a similar, simpler solution:
ReplyDeleteEterm -e tail -f /var/log/messages
No shell script, no logging in required.I have a hotkey set up in Fluxbox that runs the command.
Tim
Ubuntu Gutsy user