Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Permission denied #278

Open
sorenwacker opened this issue Dec 9, 2019 · 10 comments
Open

Permission denied #278

sorenwacker opened this issue Dec 9, 2019 · 10 comments

Comments

@sorenwacker
Copy link

Why are all the permission denied issues here closed without a comment?

I am starting theia with:

docker run -it --init -p 3000:3000 -v "$(pwd):/home/project:cached" theiaide/theia:next

Then open an existing file and edit it. Then CTRL-s seemingly does nothing. When pressing save in the file menu also does nothing, but when I look into the stdout I see:

root ERROR Request setContent failed with error: EACCES: permission denied, open '/home/project/proteomics_tools/README.md' Error: EACCES: permission denied, open '/home/project/proteomics_tools/README.md'
root ERROR Error: Request 'setContent' failed
at Proxy. (http://localhost:3000/bundle.js:14:681815)
at e. (http://localhost:3000/bundle.js:19:155317)
at http://localhost:3000/bundle.js:19:153026
at Object.next (http://localhost:3000/bundle.js:19:153131)
at a (http://localhost:3000/bundle.js:19:151874)

@sorenwacker
Copy link
Author

It would be nice to get an error message when save failed. I had lost some edits due to this because I falsely assumed the file was saved.

@marcdumais-work
Copy link
Member

Hi @soerendip ,

Assuming we're not facing a new bug, the permission issue is a generic docker problem - your identity (linux uid) is different in the image vs on the host, and so most likely the user in the container does not have proper permissions to modify files mounted from your host.

You can see for yourself using command id -u on your host an in the docker container.

The easiest way to avoid this is to work directly in the container, not mounting your workspace from the host (i.e. omit the -v "$(pwd):/home/project:cached" part when starting your container ). Another option is to modify the image to create a user in the container that matches your host's user uid. This is not a generic solution however, and will work only for you, on a given host.

Finally, there is this user-proposed approach that I could not confirm works, but you might have better luck: #169 (comment)

It would be nice to get an error message when save failed. I had lost some edits due to this because I falsely assumed the file was saved.

Agreed - there should be an error message to let the user know when this happens. @vince-fugnitto could you search the main repo for such an issue, create one if none already exists?

@vince-fugnitto
Copy link
Member

Agreed - there should be an error message to let the user know when this happens. @vince-fugnitto could you search the main repo for such an issue, create one if none already exists?

There is a general issue to improve the filesystem to handle eaccess errors:
eclipse-theia/theia#915

@student020341
Copy link

I'm a linux noob but I'll chime in what I did just to get stuff running. Since users can't navigate out of the project folder the ide is running on, I set permissions 777 on the folder that contains the project.

@marcdumais-work
Copy link
Member

Hi @student020341

I'm a linux noob but I'll chime in what I did just to get stuff running. Since users can't navigate out of the project folder the ide is running on, I set permissions 777 on the folder that contains the project.

Thanks for sharing. Your solution is a good start. I'll just mention that if your goal is to interchangeably use the same workspace both on the host and in the theia docker image, you need to make sure your umask is set appropriately for both, else files/directories created on one could be read-only on the other.

more about umask

@realvictorprm
Copy link

For Linux users the most important bit to know is that the image running the IDE needs to use a non-root user which ideally should have the same ID as your user in the host system.

Moreover mount paths which don't exist in the host system yet are created by docker with sudo rights. Therefor create all paths before with the non root user to prevent any Permission Denied errors.

@onefork
Copy link

onefork commented Apr 16, 2020

I was building using the same uid/gid combi. This solution works quite well as long as you don't want to share the docker image.

In Dockerfile change the adduser line to:

ARG uid
ARG gid

RUN addgroup --gid $gid theia && \
    adduser --disabled-password --gecos '' --uid $uid --gid $gid theia && \
    adduser theia sudo && \
    echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers;

Then import the ids while docker build:

docker build . \
  --build-arg uid=$(id -u) \
  --build-arg gid=$(id -g) \
  --build-arg version=next \
  -t theia:next

@snowch
Copy link

snowch commented Aug 27, 2020

@onefork are you running on OSX or linux?

gid for me on OSX is 20 and I get the error: addgroup: The GID '20' is already in use.

@marcdumais-work
Copy link
Member

@onefork are you running on OSX or linux?

gid for me on OSX is 20 and I get the error: addgroup: The GID '20' is already in use.

Hi @snowch,

It looks like GID 20 already exists in the base Ubuntu docker image (GID below 1000 or something are reserved for system use IIRC on Linux), which is why you're not allowed to recreate it. Maybe it would work for you to just skip the addgroup command?

@xniti3x
Copy link

xniti3x commented Mar 26, 2021

workaround:
on host mashine
sudo chmod 777 /the folder you want to share with theia/
in this case try
sudo chmod 777 /home/project
sudo chmod 777 /home/*/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants