[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how to run script shell with specific uid and gid ?

Posted on 2008-10-15
2
Medium Priority
?
432 Views
Last Modified: 2013-12-12
hello,
I have make one script shell, and i want this script shell are start with specific user.
add "su deploy" in my script is not good because avec this line is executed the script stop imediatly
and other solution :
#!/bin/sh
exec 2>&1
exec envuidgid deploy /home/deploy/deploy/run

generate error : "envuidgid: fatal: unable to run /home/deploy/deploy/run: exec format error"
I think is not possible to exec script shell with this solution, this solution work only with programe.

have you one solution ?

and it's possible after have exec this "ssh deploy@www1:~/script_distant"
close this ssh conection for exec next line of my script shell ??

thank you
thierry
0
Comment
Question by:thierry91
[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
2 Comments
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 800 total points
ID: 22725287
sudo is the best option for this (assuming you have it installed on your system)

You would create a sudo entry in sudoers (with the visudo command) like:

User_Alias     DEPLOYUSERS = user1,user2,user3
DEPLOYUSERS = ALL = (deploy) NOPASSWD:  /home/deploy/deploy/run

Then your calling script would simply be

sudo -u deploy /home/deploy/deploy/run
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 1200 total points
ID: 22727780
When you run the script, are you calling it from root account? If yes then

su user1 -c "/path/to/script args"

this will let you run the script as user user1 ( with group ids of which this user is a member)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

650 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