LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ./java: Permission denied (https://www.linuxquestions.org/questions/linux-newbie-8/java-permission-denied-4175475553/)

djay_a 09-02-2013 06:10 AM

./java: Permission denied
 
Can't figure out the solution. PLease help.

[oracle@chnmct297942d bin]$ pwd
/home/oracle/database/db/tech_st/11.1.0/appsutil/jre/bin
[oracle@chnmct297942d bin]$ ls
ControlPanel java java_vm javaws jcontrol keytool orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200
[oracle@chnmct297942d bin]$ ./java -version
-bash: ./java: Permission denied
[root@chnmct297942d bin]# ls -ltr
total 740
-rwxrwxrwx. 1 oracle dba 6347 Apr 1 2009 jcontrol
-rwxrwxrwx. 1 oracle dba 76239 Apr 1 2009 javaws
-rwxrwxrwx. 1 oracle dba 24886 Apr 1 2009 java_vm
-rwxrwxrwx. 1 oracle dba 47116 Apr 1 2009 java
-rwxrwxrwx. 1 oracle dba 6347 Apr 1 2009 ControlPanel
-rwxrwxrwx. 1 oracle dba 189268 Apr 1 2009 unpack200

Regards,

bathory 09-02-2013 06:46 AM

Hi,

Most likely the filesystem where /home/oracle/database/db/tech_st/11.1.0/appsutil/jre/bin exists is mounted with the "noexec" option set.
Try to remount it removing "noexec" and see what happens

Regards

djay_a 09-03-2013 01:15 AM

Quote:

Originally Posted by bathory (Post 5020217)
Hi,

Most likely the filesystem where /home/oracle/database/db/tech_st/11.1.0/appsutil/jre/bin exists is mounted with the "noexec" option set.
Try to remount it removing "noexec" and see what happens

Regards

Here are fstab entries

[root@chnmct297942d ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Aug 21 16:43:43 2013
#
# 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_chnmct297942d-lv_root / ext4 defaults 1 1
UUID=90affd8f-2bc3-4a6e-978d-01e94cd57751 /boot ext4 defaults 1 2
/dev/mapper/vg_chnmct297942d-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_chnmct297942d-lv_swap 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

bathory 09-03-2013 03:00 AM

Hi,

From fstab looks like /home is mounted with the usual options, so you should be able to run commands. To verify that defaults are not changed somehow run:
Code:

cat /proc/mounts
Another thing to look at, is SELinux, as I guess you're running an RHEL based distro (because anaconda has created fstab). Try to disable it temporarily
Code:

setenforce 0
and see if you can run java from your homedir

djay_a 09-03-2013 05:05 AM

Here you go . ..

[root@chnmct297942d bin]# cat /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,relatime,size=3955588k,nr_inodes=988897,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev,relatime 0 0
/dev/mapper/vg_chnmct297942d-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /selinux selinuxfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,relatime,size=3955588k,nr_inodes=988897,mode=755 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
/dev/mapper/vg_chnmct297942d-lv_home /home ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=1752,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=1752,timeout=300,minproto=5,maxproto=5,indirect 0 0

Please let me know how to disable SELinux.

bathory 09-03-2013 06:25 AM

To disable SELinux temporarily run (as root)
Code:

setenforce 0

jpollard 09-03-2013 06:29 AM

Having world writable executables is a security failure... Even if it allowed you to execute it.

djay_a 09-03-2013 06:31 AM

Still same error.

[root@chnmct297942d bin]# setenforce 0
[root@chnmct297942d bin]#
[root@chnmct297942d bin]#
[root@chnmct297942d bin]# su - oracle
[oracle@chnmct297942d bin]$ pwd
/home/oracle/database/db/tech_st/11.1.0/appsutil/jre/bin
[oracle@chnmct297942d bin]$ ./java -version
-bash: ./java: Permission denied
[oracle@chnmct297942d bin]$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
[oracle@chnmct297942d bin]$ which java
/usr/bin/java
[oracle@chnmct297942d bin]$ ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 Sep 2 20:38 /usr/bin/java -> /etc/alternatives/java

djay_a 09-03-2013 06:45 AM

Quote:

Originally Posted by jpollard (Post 5020820)
Having world writable executables is a security failure... Even if it allowed you to execute it.

Hi Pollard,

I understand your concern but this is not production server but using for educational purposes.

bathory 09-03-2013 03:51 PM

Quote:

Still same error.

[root@chnmct297942d bin]# setenforce 0
[root@chnmct297942d bin]#
[root@chnmct297942d bin]#
[root@chnmct297942d bin]# su - oracle
[oracle@chnmct297942d bin]$ pwd
/home/oracle/database/db/tech_st/11.1.0/appsutil/jre/bin
[oracle@chnmct297942d bin]$ ./java -version
-bash: ./java: Permission denied
[oracle@chnmct297942d bin]$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
[oracle@chnmct297942d bin]$ which java
/usr/bin/java
[oracle@chnmct297942d bin]$ ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 Sep 2 20:38 /usr/bin/java -> /etc/alternatives/java
I cannot think for anything else. Maybe some directory upwards is not executable for user oracle.
Can root run ./java from that directory?


All times are GMT -5. The time now is 09:58 AM.