Monday, June 24, 2013

creating symbolic link, Permission denied

The situation is: ls -ltr /opt/oracle/
java -> /usr/lib/jvm/java-1.6.0-sun-1.6.0.45.x86_64

where /usr/lib/jvm/java-1.6.0-sun.x86_64 -> /usr/lib/jvm/java-1.6.0-sun-1.6.0.45.x86_64 and I issue
ln -s /usr/lib/jvm/java-1.6.0-sun.x86_64 /opt/oracle/java
because I want /opt/oracle/java to point to /usr/lib/jvm/java-1.6.0-sun.x86_64 and not to /usr/lib/jvm/java-1.6.0-sun-1.6.0.45.x86_64 (I need an extra level of indirection)
The funny thing is that I get a:
ln: creating symbolic link `/opt/oracle/java/java-1.6.0-sun.x86_64' to `/usr/lib/jvm/java-1.6.0-sun.x86_64': Permission denied
This is because PROBABLY the ln command goes ahead resolving /opt/oracle/java, and to avoid a recursive situation it backs up.
Just do an "unlink /opt/oracle/java" before the ln, and you will be fine.

No comments: