Re: Can I change group and permissions on the messages file?



Bit Twister <BitTwister@xxxxxxxxxxxxxxxx> wrote in
news:slrnehedhl.3s6.BitTwister@xxxxxxxxxxxxxxx:

Do a
chmod 400 /var/log/messages
and run the cron job early. What is the the daily cron job you ask?

$ cat /etc/crontab
# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly

Ok, let's run it
nice -n 19 run-parts --report /etc/cron.daily
ls -al /var/log/messges

Uh well, I used webmin to add the script as a daily task and it does not
show up the way you show it, it does show up with a crontab -l though.

[root@ohmster log]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
[root@ohmster log]#


[root@ohmster log]# crontab -l
# 55 0 * * * cat /root/scripts/netdown.txt | smbclient -M leesh #5
minute warning for internet shutdown.
# 59 0 * * * cat /root/scripts/1min.txt | smbclient -M leesh #Notify
user internet goes off in 1 minute.
# 55 0 * * * /root/scripts/closeinet #Warn and then close internet
connection for LAN computer 192.168.0.5
# 0 1 * * * /sbin/iptables -I FORWARD 1 -s 192.168.0.5 -j DROP #Stop
Internet connectivity for LAN computer 192.168.0.5
# 0 16 * * * /sbin/iptables -D FORWARD -s 192.168.0.5 -j DROP #Restore
Internet connectivity for LAN computer 192.168.0.5
@daily /root/scripts/change_messages_perms #A simple script to change the
permissions on /var/log/messages to allow ohmster to view the file.
[root@ohmster log]#

FYI, all that stuff that is now commented out was to put an internet
schedule on a guest's computer. I had friends stay here for a month and
they had a 17 year old daughter. I gave her a computer but the mom wanted
a schedule for Internet access on it or else the kid woud do nothing else
all day but sit at the computer. The cron job worked remarkably well and
only allowed Internet access for that computer from 4:00 PM until 1:00
AM. That is what the mom wanted and that is what the cron jobs did. I had
it setup to broadcast warning messages via Windows Messenger Service to
her computer too, letting her know that the Internet would stop in 5
minutes so hurry and finish up. That was pretty neat but they are gone
now. I guess I will copy that stuff to a text file for safekeeping and
take it out of the cron entries now.

So I did change the messages file to 400 and used webmin to run the cron
job now and guess what, it did work and I got a 640 on the messages file!

[root@ohmster log]# ls -la messages
-r-------- 1 root ohmster 628238 Sep 24 22:21 messages

Ran webin to execute the daily cron job of updating the permissions on
the messages file.

[root@ohmster log]# ls -la messages
-rw-r----- 1 root ohmster 628238 Sep 24 22:21 messages
[root@ohmster log]#

Way to go bit, that is another one down.
--
~Ohmster
theohmster at comcast dot net
Put "messageforohmster" in message body
to pass my spam filter.
.



Relevant Pages