Hi
My UNIX is Solaris 8 and/or freeBSD
My script is added to the user profile for monitoring
My script is simple:
script /"`date`".log
who i am
clear
thank you
Main Topics
Browse All TopicsHow can I run script with root privileges?
How can I make a script that any user can run it? This script makes log files that stored on the root volume [no one of the user can read it more modified these logs]
I don’t want to use su command inside the script as I store the current user info inside these log files
thank you
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
http://www.gentoo.org/doc/
paranoidcookie, I think the issue is allowing the user to create and write to a file from a given script, but not be able to remove / modify them. I agree that setuid flags can be a security issue.
I seem to remember reading about freeBSD having an append only mode for log files, specifically for this kind of thing, but I've never used it...
I read it in Andrew Lockhart's excellent Network Security Hacks (http://www.amazon.co.uk/e
Hi liddler
I already try the setuid bit (the sticky bit) chmod a+s mon.ssh before posting my question
But when I run it as a user I got permission denied error message. so can i do?
Hi paranoidcookie
I want to user to run the script as root so that they can’t delete their log [if they are doing something wrong and do not want to be tracked]
I think there will be no security hole as the script will be invisible to the users.
OK,
File must be owned by root
chown root mon.sh
then
chmod a+s mon.sh
also you need the shell at the beginning of the script.
Also I'd tidy up the date format, your's has spaces in it, not easy to housekeep..
..Also, try not to put log file in /, you never want to fill that disk, the standard is to use /var
So this worked for me:
#!/usr/bin/ksh
script /var/"`date +%d-%m-%y_%H:%m`".log
who i am
clear
ls -l mon.sh
-rwsr-sr-x 1 root other 72 Oct 5 11:20 mon.sh
AFAIK Solaris no longer allows SUID-root scripts, just SUID-binaries, for security reasons.
I'm not shure for FreeBSD.
a discussion can be read at http://www.experts-exchang
On Solaris you can use ndd, IIRC there is a switch to allow SUID scripts (sorry can't remember), and there is a trick using /dev/fd instead of the hashbang mechanism, can't remember too ('cause I'm security paranoid:)
Dear all thank you for your help
liddler thank you for your comments, I used chmod and chown but still don’t have permission. I think ahoffmann is correct Solaris no longer allows SUID-root scripts, just SUID-binaries, for security reasons.
gheist give us the correct answer, we don’t have to reinvent the weal. I will use syslog thank you
Business Accounts
Answer for Membership
by: liddlerPosted on 2004-10-04 at 07:20:43ID: 12217500
I'm not entirely sure what you are after, I think the application you want is sudo udo/
http://www.courtesan.com/s
This allows non root users to run commands with elevated privilidges.
If you can be more specific - Unix version, exaclt how you are interacting with the logs etc