[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

running command as root

Posted on 1997-03-17
1
Medium Priority
?
250 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 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