I am running FC2 on my desktop. I am the only user other than root on
this machine.

I usually have a terminal open with tail -f /var/log/messages. In
.bashrc of root I have alias tm='tail -f /var/log/messages'.  So I su to
root and type tm at the prompt. I have other aliases too.

I thought I'd give sudo a try. So I did visudo and added this line:
spavri ALL=/usr/bin/tail -f /var/log/messages.

Now sudo tail -f /var/log/messages gives me the desired result.

But I am lazy. I don't want to type sudo tail -f /var/log/messages
everytime so I made an alias in .bashrc of the user and put in it:
alias tm='tail -f /var/log/messages'

But if I try to run sudo tm I get an error message saying:
[EMAIL PROTECTED] spavri]$ sudo tm
Password:
sudo: tm: command not found

I then made a one line shell script in $HOME/bin named tm with the
following (and chmodded it to 766) :
----------------------------------------
#!/bin/bash

/usr/bin/tail -f /var/log/messages
----------------------------------------
Then sudo tm gave the following errors:
[EMAIL PROTECTED] spavri]$ sudo tm
Sorry, user spavri is not allowed to execute '/home/spavri/bin/tm' as
root on carbon.pavri.net.
----------------------------------------
I then copied this script to /usr/bin and added the following line in
sudoers:
spavri ALL=/usr/bin/tm
----------------------------------------

This has solved my problem. I can now just type sudo tm and I get what I
want. I will later add the NOPASSWORD option. What I want to know is:

is there a more elegant way to do this ?
is there a security error here somewhere ?
is this all unnecessary ?

This is a single user machine with a dialup internet connection that I
use for something like 5 mins in a day.

regards,

Sharukh.
-- 
Dr. Sharukh K R Pavri.                          Homoeopath, Linuxer.
   He Who Hesitates Is Not Only Lost But Miles From The Next Exit


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to