Solved

how to run script shell with specific uid and gid ?

Posted on 2008-10-15
2
427 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 200 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 300 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This article was originally published on Monitis Blog, you can check it here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sourc…
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

717 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