Operating System - HP-UX
1833345 Members
4497 Online
110051 Solutions
New Discussion

lsof problem --> /sbin/sh: lsof: Execute permission denied.

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

lsof problem --> /sbin/sh: lsof: Execute permission denied.

Just installed the 64-bit version of lsof after trying the 32 bit version.

Getting the following error:
/sbin/sh: lsof: Execute permission denied.

Here's my directory and file permissions:
# ll /usr/local/bin/lsof
-rwxr-sr-x 1 bin sys 252940 Jul 3 12:40 /usr/local/bin/lsof


# ll -d /usr/local/bin
drwxr-xr-x 6 bin bin 5120 Sep 17 14:32 /usr/local/bin

# ll -d /usr/local
drwxrwxrwx 16 bin bin 1024 Sep 17 13:42 /usr/local

# id root
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users),104(ctxuser),600(mqm),202(ARCserve),222(crituser),500(dba),700(ctxadm),701(citrix),777(powerview),105(iplant)
#

# which lsof
/usr/local/bin/lsof
#

Any ideas?

Jack...
15 REPLIES 15
Cheryl Griffin
Honored Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Does this work:
# ./lsof /etc/services
or
# /usr/local/bin/lsof /etc/services

Cheryl
"Downtime is a Crime."
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

No, I tried this also.

jack...
A. Clay Stephenson
Acclaimed Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

First are you running lsof as root? Does it work then?
It should run as root regardless of the setting of the setuid and setgid bits.

Secondly my lsof executable is quite a bit smaller than yours (~156k) but I compiled from source so that may be fine.
If it ain't broke, I can fix that.
Cheryl Griffin
Honored Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Jack,
Where did you get the lsof from? I found another report of this error and it was a problem with how the 64 bit files were compiled. Downloading a clean copy fixed the problem.

You can download and compile it yourself or find one precompiled:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x07980559ff7cd4118fef0090279cd0f9,00.html Look for attachment

ftp://coast.cs.purdue.edu/pub/tools/unix/sysutils/lsof/
http://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof/binaries/hpux/B.11.11/

Cheryl
"Downtime is a Crime."
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

No, it does not run as root. I also attempted using a different login. Same problem.

jack...
Deshpande Prashant
Honored Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Hi
Do you have any security software on your system that blocking you use of this.?
Try removing SGID bit, with plain 755 permission on lsof file.

Thanks.
Prashant.
Take it as it comes.
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

I pulled the binary from perdue and got the following:

lsof_4.64: WARNING: compiled for HP-UX release B.11.11; this is B.11.00.
lsof_4.64: FATAL: pst_status_size should be: 1176; is 920
lsof_4.64: FATAL: pst_vminfo_size should be: 1240; is 1096
lsof_4.64: FATAL: pst_static doesn't contain pst_filedetails_size
lsof_4.64: FATAL: pst_static doesn't contain pst_socket_size
lsof_4.64: FATAL: pst_static doesn't contain pst_stream_size
lsof_4.64: FATAL: pst_static doesn't contain pst_mpathnode_size
lsof_4.64: FATAL: pst_static doesn't contain pst_fileinfo2_size


Oh well. I'll go back and try changing the security to 755.

jack...
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Changing permission to 755 didn't help.

Don't know if this is useful.
file lsof returns the following:

lsof: ELF-32 executable object file

--------------
Here's the ll listing again...

-rwxr-xr-x 1 bin sys 252940 Jul 3 12:40 /usr/local/bin/lsof


Ted Ellis_2
Honored Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

your operating system is 64 bit.. correct?
A. Clay Stephenson
Acclaimed Contributor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Did you by any chance load the Itanium version rather than PA-RISC?
If it ain't broke, I can fix that.
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

It is 64-bit

getconf KERNEL_BITS returns 64.

I pullled the lsof_4.64.gz version.

jack...

Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

I'm an idiot when attempting to compile the source.

Here's what I got with the ./Configur hpuxgcc option:

[10064]root@chldevh:/tmp/lsof-4.64 # ./Configure hpuxgcc
Configuring /dev/kmem-based HP-UX lsof

*****************************************
* *
* NOTICE! Configuring for 64 bit HP-UX *
* *
*****************************************

Testing /usr/local/bin/gcc for 64 bit support

***************************************************
* *
* !!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!! *
* *
* APPARENTLY GCC CANNOT BUILD 64 BIT EXECUTABLES. *
* A COMPILER MUST BE USED THAT CAN. SEE 00FAQ *
* FOR MORE INFORMATION. *
* *
***************************************************


----------------------------------------------------------

Here's what I get with a normal compile, system doesn't have HP compiler:

[10065]root@chldevh:/tmp/lsof-4.64 # ./Configure hpux
Configuring /dev/kmem-based HP-UX lsof

*****************************************
* *
* NOTICE! Configuring for 64 bit HP-UX *
* *
*****************************************

Looking in /stand/vmunix for ipis_s with /usr/contrib/bin/q4 ...

!!!ERROR!!! /usr/contrib/bin/q4 failed and produced the following output.

q4: (warning) no modules in the crashdump or no INDEX file
q4: (error) vmunix not pxdb'd

!!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!
Configure can't use /usr/contrib/bin/q4 to examine the ipis_s
structure. You must do that yourself, report the result in
the HPUX_IPC_S_PATCH environment variable, then repeat the
Configure step. Consult the Configure script's use of
/usr/contrib/bin/q4 and the 00XCONFIG file for information
on ipis_s testing and the setting of HPUX_IPC_S_PATCH.
!!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!

----------------------------------------------------------

I guess I need to find a 64-bit gcc compiler?

jack...
Patrick Chim
Trusted Contributor
Solution

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

Hi Jack,

I have the same error before when I compile the lsof in 11i and used it by other user.

At last, I set the set-user-ID bit and all is OK, i.e. chmod u+s lsof

-rwsr-xr-x 1 root sys 159744 Mar 6 2002 /usr/local/bin/lsof

Regards,
Patrick
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

111111 000000000000000000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 00000 0000
111111 000000000000000000

A big 10. Thanks Patrick. I was ready to give up.


jack...
Jack C. Mahaffey
Super Advisor

Re: lsof problem --> /sbin/sh: lsof: Execute permission denied.

For those readers who might want the single chmod command for setting the security, the following command will work:
chmod 4555 lsof

Security will be set to -r-sr-xr-x

jack...