Solved

running command as root

Posted on 1997-03-17
1
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

695 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