Strange file permission in docker container (question marks on permission bit and user bit) - linux

I write a Dockerfile and docker-compose.yml to build a custom image which combines beakerx and cling, which contents are below.
FROM beakerx/beakerx
MAINTAINER liudonghua123 <liudonghua123#gmail.com>
# not works
#RUN conda install xeus-cling notebook -c QuantStack -c conda-forge -y --quiet
USER root
# install gcc7
RUN add-apt-repository -y ppa:jonathonf/gcc-7.2
RUN apt-get update -y
RUN apt-get install -y gcc-7
# revert to beakerx user
USER beakerx
ARG CLING_FILENAME=cling_2018-09-04_ubuntu16
RUN echo "use ${CLING_FILENAME} for build"
# add the prebuild cling packages
ADD ${CLING_FILENAME}.tar.bz2 /home/beakerx
ENV PATH=/home/beakerx/${CLING_FILENAME}/bin:$PATH
USER root
RUN pip install --upgrade pip
# install steps, https://github.com/root-project/cling/tree/master/tools/Jupyter
RUN cd /home/beakerx/${CLING_FILENAME}/share/cling/Jupyter/kernel && pip install -e . && jupyter-kernelspec install --user cling-cpp17 && jupyter-kernelspec install --user cling-cpp1z && jupyter-kernelspec install --user cling-cpp14 && jupyter-kernelspec install --user cling-cpp11
RUN ln -s /usr/bin/gcc-7 /usr/bin/gcc
RUN echo "root:root" | chpasswd
RUN echo "beakerx:beakerx" | chpasswd
RUN chown -R beakerx:beakerx /home/beakerx/.local
RUN find /home/beakerx/.local -type d -exec chmod 755 {} \;
RUN find /home/beakerx/.local -type f -exec chmod 644 {} \;
RUN id
RUn ls -la /home/beakerx/.local
RUn ls -la /home/beakerx/.local/share
USER beakerx
and
version: '2'
services:
beakerx-cling-prebuild:
build: .
image: liudonghua123/beakerx-cling-prebuild:latest
ports:
- "28888:8888"
volumes:
- ./work:/work
restart: always
Some logs of docker-compose build were
Step 22/24 : RUN ls -la /home/beakerx/.local
---> Running in 95457585aed0
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 25 beakerx beakerx 4096 Sep 6 00:51 ..
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 share
---> affcb9f1ca94
Removing intermediate container 95457585aed0
Step 23/24 : RUN ls -la /home/beakerx/.local/share
---> Running in 15ea51bcc3bf
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ..
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 jupyter
---> 6f2ca28d4d21
Removing intermediate container 15ea51bcc3bf
Step 24/24 : USER beakerx
---> Running in 0ab6574079d7
---> 9561902b99ef
Removing intermediate container 0ab6574079d7
Successfully built 9561902b99ef
But When I run docker-compose up -d, I got PermissionError: [Errno 13] Permission denied: '/home/beakerx/.local/share' error. So I drive into the docker image.
ldh#ldh55:~/docker/cling/jupinger/beakerx-cling-prebuild$ docker run -it --entrypoint='' --rm liudonghua123/beakerx-cling-prebuild bash
beakerx#716d9a8334ca:~$ ls -la ~
total 108
drwxr-xr-x 25 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 11 root root 4096 Sep 6 00:51 ..
-rw-r--r-- 1 beakerx beakerx 220 Aug 31 2015 .bash_logout
-rw-r--r-- 1 beakerx beakerx 3771 Aug 31 2015 .bashrc
drwxr-xr-x 3 root root 4096 Mar 13 13:32 .config
-rw-r--r-- 1 beakerx beakerx 938 Mar 8 14:03 .gitignore
-rw-r--r-- 1 beakerx beakerx 53 Feb 27 2018 .jscsrc
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .local
drwxr-xr-x 3 root root 4096 Mar 13 13:32 .npm
-rw-r--r-- 1 beakerx beakerx 655 May 16 2017 .profile
-rw-r--r-- 1 beakerx beakerx 2285 Feb 27 2018 CONTRIBUTING.md
-rw-r--r-- 1 beakerx beakerx 11325 Feb 27 2018 LICENSE
-rw-r--r-- 1 beakerx beakerx 193 Feb 27 2018 NOTICE
-rw-r--r-- 1 beakerx beakerx 8682 Mar 12 14:27 README.md
-rw-r--r-- 1 beakerx beakerx 5821 Mar 12 20:04 StartHere.ipynb
-rw-r--r-- 1 beakerx beakerx 6 Mar 13 13:32 VERSION
drwxr-xr-x 16 beakerx beakerx 4096 Mar 12 20:11 beakerx
drwxr-xr-x 8 14806 2735 4096 Sep 5 07:44 cling_2018-09-04_ubuntu16
drwxr-xr-x 22 beakerx beakerx 4096 Feb 27 2018 doc
-rw-r--r-- 1 beakerx beakerx 81 Feb 27 2018 environment.yml
drwxr-xr-x 6 beakerx beakerx 4096 Feb 27 2018 js
-rwxr-xr-x 1 beakerx beakerx 927 Mar 13 12:42 setup.sh
beakerx#716d9a8334ca:~$ ls -la ~/.local/
ls: cannot access '/home/beakerx/.local/share': Permission denied
total 8
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 25 beakerx beakerx 4096 Sep 6 00:51 ..
d????????? ? ? ? ? ? share
beakerx#716d9a8334ca:~$ ls -la ~/.local/share
ls: cannot access '/home/beakerx/.local/share': Permission denied
beakerx#716d9a8334ca:~$
beakerx#716d9a8334ca:~$ su
Password:
root#716d9a8334ca:/home/beakerx# ls -la ~
total 28
drwx------ 4 root root 4096 Mar 13 13:27 .
drwxr-xr-x 77 root root 4096 Sep 6 01:06 ..
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
drwxr-xr-x 3 root root 4096 Mar 13 13:20 .conda
-rw-r--r-- 1 root root 38 Mar 13 13:20 .condarc
drwxr-xr-x 5 root root 4096 Mar 13 13:28 .gradle
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
root#716d9a8334ca:/home/beakerx# ls -la /home/beakerx/
total 108
drwxr-xr-x 25 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 11 root root 4096 Sep 6 00:51 ..
-rw-r--r-- 1 beakerx beakerx 220 Aug 31 2015 .bash_logout
-rw-r--r-- 1 beakerx beakerx 3771 Aug 31 2015 .bashrc
drwxr-xr-x 3 root root 4096 Mar 13 13:32 .config
-rw-r--r-- 1 beakerx beakerx 938 Mar 8 14:03 .gitignore
-rw-r--r-- 1 beakerx beakerx 53 Feb 27 2018 .jscsrc
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .local
drwxr-xr-x 3 root root 4096 Mar 13 13:32 .npm
-rw-r--r-- 1 beakerx beakerx 655 May 16 2017 .profile
-rw-r--r-- 1 beakerx beakerx 2285 Feb 27 2018 CONTRIBUTING.md
-rw-r--r-- 1 beakerx beakerx 11325 Feb 27 2018 LICENSE
-rw-r--r-- 1 beakerx beakerx 193 Feb 27 2018 NOTICE
-rw-r--r-- 1 beakerx beakerx 8682 Mar 12 14:27 README.md
-rw-r--r-- 1 beakerx beakerx 5821 Mar 12 20:04 StartHere.ipynb
-rw-r--r-- 1 beakerx beakerx 6 Mar 13 13:32 VERSION
drwxr-xr-x 16 beakerx beakerx 4096 Mar 12 20:11 beakerx
drwxr-xr-x 8 14806 2735 4096 Sep 5 07:44 cling_2018-09-04_ubuntu16
drwxr-xr-x 22 beakerx beakerx 4096 Feb 27 2018 doc
-rw-r--r-- 1 beakerx beakerx 81 Feb 27 2018 environment.yml
drwxr-xr-x 6 beakerx beakerx 4096 Feb 27 2018 js
-rwxr-xr-x 1 beakerx beakerx 927 Mar 13 12:42 setup.sh
root#716d9a8334ca:/home/beakerx# ls -la /home/beakerx/.local/
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 25 beakerx beakerx 4096 Sep 6 00:51 ..
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 share
root#716d9a8334ca:/home/beakerx# ls -la /home/beakerx/.local/share/
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ..
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 jupyter
root#716d9a8334ca:/home/beakerx# exit
exit
beakerx#716d9a8334ca:~$ ls -la ~/.local/share
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 .
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ..
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 jupyter
beakerx#716d9a8334ca:~$
Why the permission of ~/.local/share was a lot of question marks at the first sight, and when I run as root or return to the original user, it was correct.
I tried run start-notebook.sh manually, the first time it was failed, then the second time it was successfully.
beakerx#716d9a8334ca:~$ cd /usr/local/bin/
beakerx#716d9a8334ca:/usr/local/bin$ ls
start-notebook.sh start-singleuser.sh start.sh
beakerx#716d9a8334ca:/usr/local/bin$
beakerx#716d9a8334ca:/usr/local/bin$
beakerx#716d9a8334ca:/usr/local/bin$ start-notebook.sh
Execute the command
Traceback (most recent call last):
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/traitlets/traitlets.py", line 528, in get
value = obj._trait_values[self.name]
KeyError: 'runtime_dir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/envs/beakerx/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/notebook/notebookapp.py", line 1505, in initialize
self.init_configurables()
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/notebook/notebookapp.py", line 1209, in init_configurables
connection_dir=self.runtime_dir,
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/jupyter_core/application.py", line 99, in _runtime_dir_default
ensure_dir_exists(rd, mode=0o700)
File "/opt/conda/envs/beakerx/lib/python3.6/site-packages/jupyter_core/utils/__init__.py", line 13, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/opt/conda/envs/beakerx/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/beakerx/.local/share/jupyter/runtime'
beakerx#716d9a8334ca:/usr/local/bin$ ll /home/beakerx/.local/share/jupyter/runtime
ls: cannot access '/home/beakerx/.local/share/jupyter/runtime': Permission denied
beakerx#716d9a8334ca:/usr/local/bin$ ll /home/beakerx/.local/share/jupyter/
ls: cannot access '/home/beakerx/.local/share/jupyter/kernels': Permission denied
total 8
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ./
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ../
d????????? ? ? ? ? ? kernels/
beakerx#716d9a8334ca:/usr/local/bin$ ll /home/beakerx/.local/share/
total 12
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ./
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 ../
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 jupyter/
beakerx#716d9a8334ca:/usr/local/bin$ su
Password:
root#716d9a8334ca:/usr/local/bin# ls -l /home/beakerx/.local/share/jupyter/runtime
ls: cannot access '/home/beakerx/.local/share/jupyter/runtime': No such file or directory
root#716d9a8334ca:/usr/local/bin# ls -l /home/beakerx/.local/share/jupyter/
total 4
drwxr-xr-x 18 beakerx beakerx 4096 Sep 6 00:51 kernels
root#716d9a8334ca:/usr/local/bin# ls -l /home/beakerx/.local/share/
total 4
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 00:51 jupyter
root#716d9a8334ca:/usr/local/bin# ls -l /home/beakerx/.local/share/jupyter/kernels/
total 16
drwxr-xr-x 2 beakerx beakerx 4096 Sep 6 00:51 cling-cpp11
drwxr-xr-x 2 beakerx beakerx 4096 Sep 6 00:51 cling-cpp14
drwxr-xr-x 2 beakerx beakerx 4096 Sep 6 00:51 cling-cpp17
drwxr-xr-x 2 beakerx beakerx 4096 Sep 6 00:51 cling-cpp1z
root#716d9a8334ca:/usr/local/bin# exit
exit
beakerx#716d9a8334ca:/usr/local/bin$ id
uid=1000(beakerx) gid=1000(beakerx) groups=1000(beakerx)
beakerx#716d9a8334ca:/usr/local/bin$ start-notebook.sh
Execute the command
[I 01:20:56.433 NotebookApp] Writing notebook server cookie secret to /home/beakerx/.local/share/jupyter/runtime/notebook_cookie_secret
[W 01:20:56.567 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 01:20:56.647 NotebookApp] [beakerx] enabled
[I 01:20:56.736 NotebookApp] JupyterLab beta preview extension loaded from /opt/conda/envs/beakerx/lib/python3.6/site-packages/jupyterlab
[I 01:20:56.736 NotebookApp] JupyterLab application directory is /opt/conda/envs/beakerx/share/jupyter/lab
[I 01:20:56.971 NotebookApp] Serving notebooks from local directory: /usr/local/bin
[I 01:20:56.971 NotebookApp] 0 active kernels
[I 01:20:56.971 NotebookApp] The Jupyter Notebook is running at:
[I 01:20:56.971 NotebookApp] http://[all ip addresses on your system]:8888/?token=1b94f5bf7e14e4ed5defece6870addc630d81eb8aae85990
[I 01:20:56.971 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 01:20:56.972 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=1b94f5bf7e14e4ed5defece6870addc630d81eb8aae85990
If I modified Dockerfile (move up USER beakerx)
FROM beakerx/beakerx
MAINTAINER liudonghua123 <liudonghua123#gmail.com>
# not works
#RUN conda install xeus-cling notebook -c QuantStack -c conda-forge -y --quiet
USER root
# install gcc7
RUN add-apt-repository -y ppa:jonathonf/gcc-7.2
RUN apt-get update -y
RUN apt-get install -y gcc-7
# revert to beakerx user
USER beakerx
ARG CLING_FILENAME=cling_2018-09-04_ubuntu16
RUN echo "use ${CLING_FILENAME} for build"
# add the prebuild cling packages
ADD ${CLING_FILENAME}.tar.bz2 /home/beakerx
ENV PATH=/home/beakerx/${CLING_FILENAME}/bin:$PATH
USER root
RUN pip install --upgrade pip
# install steps, https://github.com/root-project/cling/tree/master/tools/Jupyter
RUN cd /home/beakerx/${CLING_FILENAME}/share/cling/Jupyter/kernel && pip install -e . && jupyter-kernelspec install --user cling-cpp17 && jupyter-kernelspec install --user cling-cpp1z && jupyter-kernelspec install --user cling-cpp14 && jupyter-kernelspec install --user cling-cpp11
RUN ln -s /usr/bin/gcc-7 /usr/bin/gcc
RUN echo "root:root" | chpasswd
RUN echo "beakerx:beakerx" | chpasswd
RUN usermod -aG sudo beakerx
RUN echo beakerx | sudo -S chown -R beakerx:beakerx /home/beakerx/
RUN echo beakerx | sudo -S find /home/beakerx/ -type d -exec chmod 755 {} \;
RUN echo beakerx | sudo -S find /home/beakerx/ -type f -exec chmod 644 {} \;
USER beakerx
RUN id
RUn ls -la /home/beakerx/.local
RUn ls -la /home/beakerx/.local/share
Then some errors occurred (ls -la /home/beakerx/.local).
Step 18/25 : RUN usermod -aG sudo beakerx
---> Using cache
---> 2b341f8539b9
Step 19/25 : RUN echo beakerx | sudo -S chown -R beakerx:beakerx /home/beakerx/
---> Running in 8adb3c593f96
---> bd6237aa0196
Removing intermediate container 8adb3c593f96
Step 20/25 : RUN echo beakerx | sudo -S find /home/beakerx/ -type d -exec chmod 755 {} \;
---> Running in 5dc9ff3d8d1b
---> 98d3338124ce
Removing intermediate container 5dc9ff3d8d1b
Step 21/25 : RUN echo beakerx | sudo -S find /home/beakerx/ -type f -exec chmod 644 {} \;
---> Running in 63a4ce864b75
---> 0ca175cb1663
Removing intermediate container 63a4ce864b75
Step 22/25 : USER beakerx
---> Running in 42f8c91f6930
---> 94e9f6099aa3
Removing intermediate container 42f8c91f6930
Step 23/25 : RUN id
---> Running in 6f24ee8ce894
uid=1000(beakerx) gid=1000(beakerx) groups=1000(beakerx),27(sudo)
---> 58627cedc9de
Removing intermediate container 6f24ee8ce894
Step 24/25 : RUN ls -la /home/beakerx/.local
---> Running in cfd7bdd70666
ls: cannot access '/home/beakerx/.local/share': Permission denied
total 8
drwxr-xr-x 6 beakerx beakerx 4096 Sep 6 03:08 .
drwxr-xr-x 43 beakerx beakerx 4096 Sep 6 03:09 ..
d????????? ? ? ? ? ? share
ERROR: Service 'beakerx-cling-prebuild' failed to build: The command '/bin/sh -c ls -la /home/beakerx/.local' returned a non-zero code: 1
ldh#ldh55:~/docker/cling/jupinger/beakerx-cling-prebuild$

This problem is related to the storage-driver bug, see https://github.com/moby/moby/issues/28391, https://github.com/moby/moby/issues/20240. Currently I can only change storage-driver to overlay, use the default aufs or recommended overlay2 will break.

If you came here after you copied a file or folder with "docker cp" using docker-ce 17.x, you can simply resolve the issue by restarting the docker service (make sure it really was stopped) or rebooting the whole system.
I have had that issue a few times and usually the file was back to normal after a reboot. I read in this thread that:
If you improperly mount a filesystem, the mount point of that
filesystem may show up with question marks.
. 'you' means docker in that case and restarting the service "remounts" the storage layer.

Related

Tomcat installed folder access is denied on linux

Please find below set of cmds & outputs
[ec2-user#ip-172-31-38-218 opt]$ ls -al
total 9416
drwxr-xr-x 3 root root 4096 Nov 7 13:52 .
dr-xr-xr-x 25 root root 4096 Nov 7 13:16 ..
-rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz
drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws
[ec2-user#ip-172-31-38-218 opt]$ sudo groupadd tomcatgrp
[ec2-user#ip-172-31-38-218 opt]$ sudo useradd -s /bin/false -g tomcatgrp -d /opt/tomcatfolder tomcatuser
[ec2-user#ip-172-31-38-218 opt]$ ls -al
total 9420
drwxr-xr-x 4 root root 4096 Nov 7 13:53 .
dr-xr-xr-x 25 root root 4096 Nov 7 13:16 ..
-rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz
drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws
drwx------ 2 tomcatuser tomcatgrp 4096 Nov 7 13:53 tomcatfolder
Now, when I run the cmd I am getting Permission denied as follows
[ec2-user#ip-172-31-38-218 opt]$ cd /opt/tomcatfolder/
-bash: cd: /opt/tomcatfolder/: Permission denied
Can you please help in resolving this above issue..?
I followed instructions of installing Tomcat from this link how-to-install-apache-tomcat-8-on-centos-7
It seems you are the ec2-user, but the directory is owned by tomcatuser and the permissions on the directory do now allow other users or groups to read it.
Try sudo chmod 755 /opt/tomcatfolder/ and then cd into it.
That will add read and execute permissions to the directory.

Docker "not found" for existing file

I am using Docker to build an electron node app and I'm getting some odd behavior. The build seems successful but when I run the electron app I get a "not found" error but the file does exist. I can ls the file and cat the file but cannot source/execute the file.
$ docker -v
Docker version 17.03.1-ce, build c6d412e
Dockerfile:
FROM node:alpine
RUN mkdir -p /usr/src
WORKDIR /usr/src
COPY package.json /usr/src
RUN npm install
COPY . /usr/src
RUN npm run build:linux
ENTRYPOINT "/usr/src/docker-entrypoint.sh"
This will result in the generation of this directory:
/usr/src/app/builds/app-linux-x64
With a bunch of files including an executable named app.
/usr/src/app/docker-entrypoint.sh: line 5: ./app: not found
It does exist.
/usr/src/app/builds/app-linux-x64 # ls -lah
total 124472
drwxr-xr-x 4 root root 4.0K Apr 28 20:07 .
drwxrwxr-x 1 root root 4.0K Apr 28 20:07 ..
-rw-r--r-- 1 root root 1.0K Apr 28 20:07 LICENSE
-rw-r--r-- 1 root root 1.6M Apr 28 20:07 LICENSES.chromium.html
-rw-r--r-- 1 root root 24.3K Apr 28 20:07 blink_image_resources_200_percent.pak
-rw-r--r-- 1 root root 15 Apr 28 20:07 content_resources_200_percent.pak
-rw-r--r-- 1 root root 9.7M Apr 28 20:07 content_shell.pak
-rw-r--r-- 1 root root 9.7M Apr 28 20:07 icudtl.dat
-rw-r--r-- 1 root root 2.8M Apr 28 20:07 libffmpeg.so
-rwxr-xr-x 1 root root 19.4M Apr 28 20:07 libnode.so
drwxr-xr-x 2 root root 4.0K Apr 28 20:07 locales
-rw-r--r-- 1 root root 334.7K Apr 28 20:07 natives_blob.bin
-rw-r--r-- 1 root root 136.6K Apr 28 20:07 pdf_viewer_resources.pak
drwxr-xr-x 2 root root 4.0K Apr 28 20:07 resources
-rw-r--r-- 1 root root 970.2K Apr 28 20:07 snapshot_blob.bin
-rwxr-xr-x 1 root root 76.7M Apr 28 20:07 app
-rw-r--r-- 1 root root 159.4K Apr 28 20:07 ui_resources_200_percent.pak
-rw-r--r-- 1 root root 6 Apr 28 20:07 version
-rw-r--r-- 1 root root 58.7K Apr 28 20:07 views_resources_200_percent.pak
I can ls it:
/usr/src/app/builds/app-linux-x64 # ls -lah app
-rwxr-xr-x 1 root root 76.7M Apr 28 20:07 app
But I cannot run it:
/usr/src/app/builds/app-linux-x64 # ./app
/bin/sh: ./app: not found
I had a similar problem myself which was solved by putting sh infront of the script to run. For you it would be:
ENTRYPOINT "sh" "/usr/src/docker-entrypoint.sh"

OSX Homebrew /usr/local permisions for node

I have installed homebrew without any problems.
The problem was to install node.. I got permission errors about /usr/local directory and symlinks.
So I did
sudo chown -R myuser /usr/local
then I istalled node without problems and then I did
sudo chown -R root /usr/local
I don't remember how was the owners in first place. I just followed some suggestions from stackoverflow to change the owner of /usr/local (a voice inside me says I did bad).
So when I run
brew doctor
I got some warnings and suggestions to chown some folders in /usr/local directory, so I did them. Then when I run
brew doctor
brew update
I get no warnings or errors anymore and looks fine (there was no updates to do after all).
My directories now looks like below. Can anyone confirm if is secure like that? How should be the owners in /usr/local ? Tt's okay to have it owned by my user as they say at github? Thanks.
myuser#iMac:/usr$ ls -la
total 8
drwxr-xr-x# 12 root wheel 408B Sep 30 23:52 ./
drwxr-xr-x 30 root wheel 1.1K Jan 23 17:51 ../
drwxr-xr-x 5 root wheel 170B Aug 23 03:51 X11/
lrwxr-xr-x 1 root wheel 3B Sep 30 23:43 X11R6# -> X11
drwxr-xr-x 3 root wheel 102B Aug 27 04:17 adic/
drwxr-xr-x 1055 root wheel 35K Jan 23 17:51 bin/
drwxr-xr-x 263 root wheel 8.7K Jan 23 17:52 lib/
drwxr-xr-x 186 root wheel 6.2K Jan 23 17:51 libexec/
drwxrwxr-x 22 root admin 748B Feb 7 12:28 local/
drwxr-xr-x 243 root wheel 8.1K Jan 23 17:51 sbin/
drwxr-xr-x 45 root wheel 1.5K Sep 30 23:43 share/
drwxr-xr-x 4 root wheel 136B Sep 17 09:03 standalone/
myuser#iMac:/usr$ cd local/
myuser#iMac:/usr/local$ ls -la
total 104
drwxrwxr-x 22 root admin 748B Feb 7 12:28 ./
drwxr-xr-x# 12 root wheel 408B Sep 30 23:52 ../
drwxr-xr-x 15 myuser admin 510B Feb 7 12:56 .git/
-rw-r--r-- 1 root admin 847B Feb 6 10:48 .gitignore
-rw-r--r-- 1 root admin 1.3K Feb 6 10:48 .travis.yml
-rw-r--r-- 1 root admin 291B Feb 6 10:48 .yardopts
-rw-r--r-- 1 root admin 3.1K Feb 6 10:48 CODEOFCONDUCT.md
-rw-r--r-- 1 root admin 2.5K Feb 6 10:48 CONTRIBUTING.md
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 Cellar/
-rw-r--r-- 1 root admin 1.2K Feb 6 10:48 LICENSE.txt
drwxr-xr-x 10 myuser admin 340B Feb 7 12:28 Library/
-rw-r--r-- 1 root admin 2.4K Feb 6 10:48 README.md
-rw-r--r-- 1 root admin 23K Feb 6 10:48 SUPPORTERS.md
drwxrwxr-x 9 root admin 306B Feb 7 12:28 bin/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 etc/
drwxr-xr-x 10 root wheel 340B Aug 3 2015 git/
drwxr-xr-x 20 root wheel 680B Dec 3 02:01 go/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 include/
drwxr-xr-x 4 myuser admin 136B Feb 7 12:28 lib/
drwxr-xr-x 3 root wheel 102B May 15 2015 n/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 opt/
drwxrwxr-x 5 root admin 170B Feb 7 12:28 share/
myuser#iMac:/usr/local$

linux PATH not working

I dont know why rbenv command do not work.. T^T
only work when 'cd /usr/local/.rbenv/bin && ./rbenv'
myggul#ubuntu:~$ echo $PATH
/usr/local/java/bin:/usr/local/.rbenv/bin;/home/myggul/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
myggul#ubuntu:~$ cd /usr/local/.rbenv/bin
myggul#ubuntu:/usr/local/.rbenv/bin$ ll
total 12
drwxrwxr-x 2 myggul myggul 4096 Jul 16 16:11 ./
drwxr-xr-x 7 myggul myggul 4096 Jul 16 16:11 ../
lrwxrwxrwx 1 myggul myggul 16 Jul 16 16:11 rbenv -> ../libexec/rbenv*
-rwxrwxr-x 1 myggul myggul 724 Jul 16 16:11 ruby-local-exec*
myggul#ubuntu:/usr/local/.rbenv/bin$ rbenv
The program 'rbenv' is currently not installed. You can install it by typing:
sudo apt-get install rbenv
myggul#ubuntu:/usr/local/.rbenv/bin$ cd ~
myggul#ubuntu:~$ rbenv
The program 'rbenv' is currently not installed. You can install it by typing:
sudo apt-get install rbenv
You have a semicolon in your PATH which should be a colon.

Cannot run ANY shell scripts even when root [duplicate]

This question already has an answer here:
bash: /bin/myscript: permission denied
(1 answer)
Closed 8 years ago.
when trying to run a teamspeak server and a minecraft server on a newly rented VPS I ran into some big troubles. Whenever I try to run a shell script even when root it does not work.
One script: spigot.sh
#!/bin/sh
BINDIR=$(dirname "$(readlink -fn "$0")")
cd "$BINDIR"
java -Xms5G -Xmx7G -XX:MaxPermSize=128M -jar spigot.jar
Error after trying to use this as root
root#vps23946:/home/user/minecraft# ./spigot.sh
-bash: ./spigot.sh: Permission denied
Error after trying to use this as user
user#vps23946:~/minecraft$ ./spigot.sh
-bash: ./spigot.sh: Permission denied
Results from ls -l
root#vps23946:/home/user/minecraft# ls -l
total 22616
drwxr-xr-x 16 user root 4096 Jun 6 22:39 backups
-rw-r--r-- 1 user root 2 Jun 7 13:54 banned-ips.json
-rw-r--r-- 1 user root 110 May 25 17:32 banned-ips.txt.converted
-rw-r--r-- 1 user root 229 Jun 7 13:54 banned-players.json
-rw-r--r-- 1 user root 267 May 25 17:32 banned-players.txt.converted
-rw-r--r-- 1 user root 1474 Jun 7 13:54 bukkit.yml
-rw-r--r-- 1 user root 610 Jun 7 13:54 commands.yml
drwxr-xr-x 2 user root 4096 Jun 6 19:56 crash-reports
drwxr-xr-x 2 user root 4096 Jun 7 13:54 C:\Users\Rory Finnegan\Desktop\Prep server\backups
drwxr-xr-x 6 user root 4096 Jun 7 14:25 flat
-rw-r--r-- 1 user root 2576 Apr 3 16:04 help.yml
drwxr-xr-x 2 user root 4096 Jun 7 13:54 logs
-rw-r--r-- 1 user root 415 Jun 7 13:54 ops.json
-rw-r--r-- 1 user root 191 May 28 19:02 ops.txt.converted
-rw-r--r-- 1 user root 0 Apr 3 16:05 permissions.yml
drwxr-xr-x 27 user root 4096 Jun 6 22:39 plugins
-rw-r--r-- 1 user root 768 Jun 7 13:54 server.properties
-rw-r--r-- 1 user root 23053543 May 30 15:48 spigot.jar
-rw-r--r-- 1 user root 122 Jun 7 13:36 spigot.sh
-rw-r--r-- 1 user root 2749 Jun 7 13:54 spigot.yml
-rw-r--r-- 1 user root 2404 Jun 7 14:07 usercache.json
-rw-r--r-- 1 user root 1588 Apr 3 16:04 wepif.yml
-rw-r--r-- 1 user root 783 Jun 6 16:21 whitelist.json
-rw-r--r-- 1 user root 250 May 3 19:31 white-list.txt.converted
drwxr-xr-x 7 user root 4096 Jun 7 14:25 world
drwxr-xr-x 6 user root 4096 Jun 7 14:25 world_nether
drwxr-xr-x 6 user root 4096 Jun 7 14:25 world_the_end
Second Script: ts3server_minimal_runscript.sh
#!/bin/sh
export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
D1=$(readlink -f "$0")
D2=$(dirname "${D1}")
cd "${D2}"
if [ -e ts3server_linux_x86 ]; then
if [ -z "`uname | grep Linux`" -o ! -z "`uname -m | grep 64`" ]; then
echo "Do you have the right TS3 Server package for your system? You have: ` uname` `uname -m`, not Linux i386."
fi
./ts3server_linux_x86 $#
elif [ -e ts3server_linux_amd64 ]; then
if [ -z "`uname | grep Linux`" -o -z "`uname -m | grep 64`" ]; then
echo "Do you have the right TS3 Server package for your system? You have: ` uname` `uname -m`, not Linux x86_64."
fi
./ts3server_linux_amd64 $#
elif [ -e ts3server_freebsd_x86 ]; then
if [ ! -z "`uname | grep Linux`" -o ! -z "`uname -m | grep 64`" ]; then
#
With these I get the same errors.
I am running Ubuntu Server 14.04
Scripts and programs must be executable to be invoked by name. Either use chmod to add the executable permission to the file (chmod a+x ./spigot.sh) or invoke an executable interpreter and pass in the script, e.g. /bin/sh ./spigot.sh
Try
chmod +x spigot.sh
and that will enable the script to be executed

Resources