Here's an excerpt from the Karaf 4 /deployments/karaf/bin/karaf script:
OURPWD=${PWD} cd "$(dirname "${1}")" || exit 2 LINK=$(readlink "$(basename "${1}")") while [ "${LINK}" ]; do echo "link: ${LINK}" >&2 cd "$(dirname "${LINK}")" || exit 2 LINK=$(readlink "$(basename "${1}")") done REALPATH="${PWD}/$(basename "${1}")" cd "${OURPWD}" || exit 2 echo "${REALPATH}"
It saves the initial directory path in OURPWD and attempts to cd back to it later on. On Openshift this starts as /home/jboss. But since we'll be running under an arbitrary UID, the cd switch back to /home/jboss fails:
Executing /deployments/karaf/bin/karaf server ... /deployments/karaf/bin/karaf: line 31: cd: /home/jboss: Permission denied /deployments/karaf/bin/karaf: line 55: ./inc: Permission denied