LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-27-2011, 06:52 PM   #1
ahamed101
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 1
Help on sudoers and Runas_Alias


Hi All,

Thank you for your time. Request you to help with the sudoers issue I am facing.


I am trying to make use of Runas_Alias feature of sudoers. Some how I am not able to. Hope someone can help me. Thanks in advance.

I want the script /app2/run to be run as user "operator" when executed by the user engg. The /app2/run is just a sample script with "id" command in it for testing purpose. Anyways, here is the contents


Code:
$ cat run
#!/bin/ksh
echo "-----------------------------------------------"
id
echo "-----------------------------------------------"
In /etc/sudoers, I have the following entry


Code:
#
Runas_Alias OP=operator
engg         ALL =  (OP) NOPASSWD: /app2/run
I executed it using the -u option but no luck. I also tried giving the uid instead of username.


Code:
$ sudo -u operator ./run
sudo: unable to execute /app2/run: Permission denied
Is there anything I am doing wrong?

Here is my unix box version

Code:
$ uname -a
Linux  x86_64 GNU/Linux
Normal sudoers works, I mean if I have entry like


Code:
engg         ALL =  NOPASSWD: /app2/run
And on execution


Code:
$ sudo ./run
-----------------------------------------------
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),4(adm)
-----------------------------------------------

Thank You,
Ahamed

Last edited by ahamed101; 01-28-2011 at 10:41 PM.
 
Old 01-29-2011, 08:41 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Does the run script have execute permission?

Does the account that is supposed to execute the run script have permission to run it?

Try this just to see if this is the problem.
Code:
chmod a+x run
There are a lot of other ways that permission problems can arise. If the partition on which the script resides is mounted with the noexec option then the script cannot be directly executed but it can be sourced. Also, in your case, the operator account has got to have permission to see into the directory in which the run script resides. (Can operator see into the full path to the run script?) What would happen if the operator account did this?
Code:
ls /path/to/file
where /path/to/file is the path to the directory in which the file resides.

Last edited by stress_junkie; 01-29-2011 at 08:45 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with sudoers DrStrangepork Linux - Newbie 8 10-13-2009 07:53 AM
sudoers texerasmo Linux - General 3 08-04-2006 09:57 AM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM
sudoers usa1234 Linux - General 1 10-24-2004 03:07 PM
sudoers???? yenonn Slackware 6 02-10-2004 03:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration