LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-03-2014, 09:32 AM   #1
papo483
LQ Newbie
 
Registered: Oct 2014
Posts: 5

Rep: Reputation: Disabled
RedHat Problem to run script: Permission denied


Hi,

I have problem to run script with sudo as user "ttadmin". The user is owner of the file, the permissions should be set correctly, but still "Permision denied".
I have no idea where the root problem lies. Can someone help?

System description:
Code:
[user@server ~]$ uname -a
Linux server 2.6.32-431.29.2.el6.x86_64 #1 SMP Sun Jul 27 15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[user_at_server ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Problem:
Code:
[root_at_server linux8664]# sudo -u ttadmin /var/broadworks/tmp/tt/linux8664/setup.sh
sudo: unable to execute /var/broadworks/tmp/tt/linux8664/setup.sh: Permission denied
Running script as root user works:
Code:
[root_at_server linux8664]# ./setup.sh
WARNING: You are about to install TimesTen as root. TimesTen daemon processes will
        run with root privileges. See the TimesTen Installation Guide for additional
        information.

Are you sure that you want to install as root? [ no ] no
System configuration check output:
Code:
[root_at_server ~]# ls -ltr /var/broadworks/tmp/tt/linux8664/
total 412
-rwxr-xr-x 1 ttadmin bwadmin  34886 May 23  2013 uninst.sh
-rwxr-xr-x 1 ttadmin bwadmin  5623 May 23  2013 setup.sh
-rwxr--r-- 1 ttadmin bwadmin 114937 May 23  2013 README.html
drwxr-xr-x 2 ttadmin bwadmin  4096 Sep 27  2013 LINUX8664
-rwxr-xr-x 1 ttadmin bwadmin 245007 Sep 27  2013 install.pl

[root_at_server linux8664]# lsattr
--------------- ./setup.sh
--------------- ./LINUX8664
--------------- ./install.pl
--------------- ./README.html
--------------- ./uninst.sh

[root_at_server linux8664]# getfacl setup.sh
# file: setup.sh
# owner: ttadmin
# group: bwadmin
user::rwx
group::r-x
other::r-x

[root_at_server linux8664]# ls -Z
-rwxr-xr-x ttadmin bwadmin ?                                install.pl
drwxr-xr-x ttadmin bwadmin ?                                LINUX8664
-rwxr--r-- ttadmin bwadmin ?                                README.html
-rwxr-xr-x ttadmin bwadmin ?                                setup.sh
-rwxr-xr-x ttadmin bwadmin ?                                uninst.sh

[root_at_server linux8664]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#enforcing - SELinux security policy is enforced.
#permissive - SELinux prints warnings instead of enforcing.
#disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#targeted - Only targeted network daemons are protected.
#strict - Full SELinux protection.
SELINUXTYPE=targeted

[root_at_server linux8664]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Tue Jul 15 10:59:30 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VG_LOCAL_STORAGE-LV_ROOT /                      ext3    defaults        1 1
UUID=280a06e3-47ad-4643-8ece-859a87cdfa8f /boot                  ext3    defaults        1 2
/dev/mapper/VG_LOCAL_STORAGE-LV_TMP /tmp                    ext3    defaults        1 2
/dev/mapper/VG_LOCAL_STORAGE-LV_VAR /var                    ext3    defaults        1 2
/dev/mapper/VG_LOCAL_STORAGE-LV_LOG /var/log                ext3    defaults        1 2
/dev/mapper/VG_LOCAL_STORAGE-LV_VOL1 /vol1                  ext3    defaults        1 2
UUID=a973d42e-407b-40ad-9a8c-b17abfc7c32c swap                    swap    defaults        0 0
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0

[root_at_server linux8664]# cat /etc/mtab
/dev/mapper/VG_LOCAL_STORAGE-LV_ROOT / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
/dev/mapper/VG_LOCAL_STORAGE-LV_TMP /tmp ext3 rw 0 0
/dev/mapper/VG_LOCAL_STORAGE-LV_VAR /var ext3 rw 0 0
/dev/mapper/VG_LOCAL_STORAGE-LV_LOG /var/log ext3 rw 0 0
/dev/mapper/VG_LOCAL_STORAGE-LV_VOL1 /vol1 ext3 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
Thanks
 
Old 10-03-2014, 09:43 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What's the first line of setup.sh?
 
Old 10-03-2014, 12:42 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Can you do other stuff as sudo -u ttadmin? Maybe the user you are trying to do this from doesn't have sudo privileges or the correct sudo privileges to execute ttadmin's files.
 
Old 10-04-2014, 10:12 AM   #4
papo483
LQ Newbie
 
Registered: Oct 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
What's the first line of setup.sh?
I do not have access to the server currently. I'll give answer on Monday.
 
Old 10-04-2014, 10:15 AM   #5
papo483
LQ Newbie
 
Registered: Oct 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Can you do other stuff as sudo -u ttadmin? Maybe the user you are trying to do this from doesn't have sudo privileges or the correct sudo privileges to execute ttadmin's files.
I will try "sudo -u ttadmin ls". The user I am trying to run "sudo -u ttadmin /../setup.sh" is "root".

"sudo -u ttadmin ls -ltr" works in directory where setup.sh resides.

Last edited by papo483; 10-06-2014 at 01:29 AM.
 
Old 10-06-2014, 01:24 AM   #6
papo483
LQ Newbie
 
Registered: Oct 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
What's the first line of setup.sh?
The first line is:
Code:
#!/bin/sh
then
Code:
PATH=/usr/bin:/bin:/usr/etc:/etc:/sbin:/usr/sbin:/usr/ucb:$PATH
export PATH
 
Old 10-06-2014, 02:36 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I would try sh -x setup.sh as ttadmin - or sudo -u ttadmin /bin/sh -x -c /var/broadworks/tmp/tt/linux8664/setup.sh and check the result (it will not solve this issue just will print some debug info)
 
Old 10-07-2014, 08:34 AM   #8
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
what is that users line in visudo

https://access.redhat.com/documentat...e/ch02s03.html
 
Old 10-07-2014, 08:59 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Moved: This thread is more suitable in <RedHat> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 10-07-2014, 09:24 AM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Perhaps that directory is in a filesystem mounted with the "noexec" option. You would still be able to run that script by directly invoking the shell:
Code:
sudo -u ttadmin /bin/sh /var/broadworks/tmp/tt/linux8664/setup.sh
But that could still fail later if that script tries to execute something else in that filesystem.

Another thing to look at is whether user "ttadmin" has execute permission in all directories leading to /var/broadworks/tmp/tt/linux8664/.

Last edited by rknichols; 10-07-2014 at 09:26 AM. Reason: Another thing...
 
Old 10-09-2014, 10:16 AM   #11
papo483
LQ Newbie
 
Registered: Oct 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
The whole problem lied in wrong permission set in umask set for root user. The script expect umask for root to
be set to "022" but in our case it was "027".
After we changed umask to "022" installation was successfull.
 
  


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
impossible situation. root is Permission denied to run a script with 777 permissions lleb Linux - General 11 01-01-2014 06:06 PM
Unable to run program, Permission denied smartgupta Solaris / OpenSolaris 3 08-11-2009 01:49 AM
permission problem when run php script by apache Barq Linux - Server 9 05-11-2009 03:03 AM
RedHat NFS 'permission denied' problem Thom Fitzpatrick Linux - Server 8 01-18-2008 10:41 AM
crontab failure: permission denied trying to run script hedpe Linux - Software 5 05-03-2005 07:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 03:05 PM.

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