Solved

running command as root

Posted on 1997-03-17
1
232 Views
Last Modified: 2013-12-16
Solaris 2.x:
Is there a way for a user to run a script, in which some commands are ran as root? Or for a user to run an entire script as root?
I want a user to be able to run some commands which only can be ran by the root, without having to give the root's password to the user...

Thank You.
0
Comment
Question by:jonie
1 Comment
 
LVL 3

Accepted Solution

by:
pc012197 earned 50 total points
ID: 1811853
That's what the setuid-flag is good for. Enter

chmod u+s <filename>

to allow any user to run <filename> as the owner of <filename>. If <filename> belongs to root, the command will be run as root.

Be careful, though, this is a dangerous feature, which may allow your users to hack your machine. DON'T create shell scripts which are suid root. Think carefully about which programs may be run as root safely, without giving the user too much power. Try to think of a way to avoid having your users run commands as root.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Solaris OS patch 3 28
Problem logging tar errors 11 35
unix example issues 18 49
Best way to split and output to csv in bash 2 30
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now