java permission

when i type

java -version

it will return

bash: /usr/bin/java: Permission denied

so i run java with sudo and returned

openjdk version "1.9.0_00"                                                                                                                                                                       
OpenJDK Runtime Environment (build 1.9.0_00-b74) 
OpenJDK 64-Bit Server VM (build 1.9.0_00-b74, mixed mode)

my question is:
is it the right thing running java need root permission?
or i already messed up something?

Attention, this is from openSUSE 13.1, but I assume it is valid also for Tumbleweed.

henk@boven:~> java -version
java version "1.7.0_85"
OpenJDK Runtime Environment (IcedTea 2.6.1) (suse-24.21.1-x86_64)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)
henk@boven:~>

and

henk@boven:~> l /usr/bin/java
lrwxrwxrwx 1 root root 22 17 jan  2014 /usr/bin/java -> /etc/alternatives/java*
henk@boven:~> 

and

henk@boven:~> ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 41 17 jan  2014 /etc/alternatives/java -> /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java
henk@boven:~>

and

henk@boven:~> l /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java
-rwxrwxr-x 1 root root 6368 22 jul 14:17 /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java*
henk@boven:~>

As you see, java simply works for a normal user. And when you follow all the symlinks from /usr/bin/java to the end, you see that everybody has execution permission.

So, yes, I guess something is borked on your system.

PS. Please copy/paste the prompt, the command, the output and the next prompt in one mouse sweep. That is so much easier for you to do and for us to read then all that story telling: When I do …, then I get …

 the-laptop@linux-ek4g:~> l /usr/bin/java 
lrwxrwxrwx 1 root users 22 Dec 10  2013 /usr/bin/java -> /etc/alternatives/java* 
the-laptop@linux-ek4g:~> l /usr/bin/java 
lrwxrwxrwx 1 root users 22 Dec 10  2013 /usr/bin/java -> /etc/alternatives/java* 
the-laptop@linux-ek4g:~> ls -l /etc/alternatives/java 
lrwxrwxrwx 1 root root 41 Aug 21 15:51 /etc/alternatives/java -> /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java 
the-laptop@linux-ek4g:~> l /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java 
-rwxr--r-- 1 root root 8632 Aug 19 16:17 /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java*


maybe i have problem with installed jre-1.9.0 dont have x permission to other user

 the-laptop@linux-ek4g:~> l /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java 
-rwxr-xr-x 1 root root 8632 Jul 23 23:39 /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java*


but from jre 1.8.0 it has

sorry about that

-rwxr--r-- 1 root root 8632 Aug 19 16:17 /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java*

That is indeed not what to expect. But as I said, I do not uee Tumbleweed, thus it would be better if a Tumbleweed user that used the same java could comment.

PS, how did the green texts appear in de copy/paste? I never get that.

On 2015-08-22 17:06, Lit wrote:

> Code:
> --------------------
> the-laptop@linux-ek4g:~> l /usr/bin/java
> lrwxrwxrwx 1 root users 22 Dec 10 2013 /usr/bin/java → /etc/alternatives/java*
> the-laptop@linux-ek4g:~> l /usr/bin/java
> lrwxrwxrwx 1 root users 22 Dec 10 2013 /usr/bin/java → /etc/alternatives/java*
> the-laptop@linux-ek4g:~> ls -l /etc/alternatives/java
> lrwxrwxrwx 1 root root 41 Aug 21 15:51 /etc/alternatives/java → /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java
> the-laptop@linux-ek4g:~> l /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java
> -rwxr–r-- 1 root root 8632 Aug 19 16:17 /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java*
>
>
> --------------------


Tumbleweed:~ # l /usr/bin/java
lrwxrwxrwx 1 root root 22 Aug  6 00:41 /usr/bin/java -> /etc/alternatives/java*
Tumbleweed:~ # l /etc/alternatives/java
lrwxrwxrwx 1 root root 41 Aug  6 00:41 /etc/alternatives/java -> /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java*
Tumbleweed:~ # l /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
-rwxr-xr-x 1 root root 8632 Jul 23 17:39 /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java*
Tumbleweed:~ # java -version
openjdk version "1.8.0_51"
OpenJDK Runtime Environment (build 1.8.0_51-b16)
OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)
Tumbleweed:~ # su - cer
cer@Tumbleweed:~> java -version
openjdk version "1.8.0_51"
OpenJDK Runtime Environment (build 1.8.0_51-b16)
OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)
cer@Tumbleweed:~>

I don’t have the same java version as you. The above is the default in TW.

You don’t have execution permissions for group or others. Just change them.
Probably report bug to whoever packaged java 1.9


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

I assume that the OP also understands that changing them is a solution to the incident. But the important thing is of course understanding the root cause. Simply reporting a bug without further evidence that it is realy wrong in the RMP is a bit of an easy shortcut imho.

On 2015-08-22 21:46, hcvv wrote:

> I assume that the OP also understands that changing them is a solution
> to the incident. But the important thing is of course understanding the
> root cause. Simply reporting a bug without further evidence that it is
> realy wrong in the RMP is a bit of an easy shortcut imho.

Well, then verify the rpm contents :wink:


rpm -qfV /usr/lib64/jvm/jre-1.9.0-openjdk/bin/java


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

I just installed openjdk 1.9 to take a look at this on a TW.

Ran into the same issue, you can’t “read” the java version using a normal User account although you can if you execute the same command from a root console.

Unless something new is reported, I don’t know if this issue also applies to running a jar as a normal user (openjdk 1.9).
(Somewhere I’ve got an old standalone jar for testing but it’s not on my current machine)
Who knows, maybe it’s a new security loophole that’s been closed if it’s intentional.

TSU