Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start as root #7

Open
kopax opened this issue Mar 29, 2016 · 15 comments
Open

Start as root #7

kopax opened this issue Mar 29, 2016 · 15 comments

Comments

@kopax
Copy link

kopax commented Mar 29, 2016

for some reasons (describe below), I need to test as root user dropbox, is there a simple way to do that?

Reasons:

  • I have started a container with --volumes-from=another_data_container on host A.

  • another_data_container was writing file as uid 1000 gid 1000.

  • I have added a group with gid 1000 in dropbox, and added dropbox user into the group.

  • Into another_data_container, I have updated folders permissions using find . -type d -exec chmod g+rwx and files permissions usings find . -type f -exec chmod g+rw

  • I linked my dropbox account

  • file got synced to dropbox (without adding group permissions, dropbox wasn't allowed to upload those files)

  • I have started a container with --volumes-from=another_data_container on host B

  • Dropbox container from host B should download another_data_container files but I have the following error :

        dropbox status
        Syncing (34 files remaining)
        Downloading 34 files...
       Can't sync "myfile.txt" (permission denied)
    

Permissions of this file as been uploaded to dropbox with UID 1000/GID 1000 so for me it should work.

@janeczku
Copy link
Owner

--volumes-from=another_data_container

What volumes does another_data_container expose?
I hope just /dbox/Dropbox and not /dbox!

First check that the directory /dbox/Dropbox in another_data_container is owned by UID 1000/GID 1000 and that they have read/write/exec permissions for that folder.
Check that myfile.txt inside the folder is also owned by UID 1000/GID 1000.

Given that all the above checks out you should be able to run the dropbox container like this (No need to modify users/groups inside the container):

docker run -d --restart=always --name=dropbox \
-e DBOX_UID=1000 \
-e DBOX_GID=1000 \
--volumes-from=another_data_container \
janeczku/dropbox

@kopax
Copy link
Author

kopax commented Mar 29, 2016

another_data_container expose:

  • In Docker file : VOLUME /etc/myapp
  • At runtime : --volume /etc/myapp --volume /dbox/Dropbox/srv/docker/company/myapp-data/

The folder /dbox/Dropbox/srv/docker/company/myapp-data/ has been created by another_data_container using the following start.sh script as entrypoint:

#!/bin/bash
VOLUME_DROPBOX="/dbox/Dropbox/srv/docker/company/myapp-data"
VOLUME_MYAPP="/etc/myapp"
echo "Create company/myapp directory"
mkdir -p ${VOLUME_DROPBOX}
mkdir -p ${VOLUME_MYAPP}
echo "Create symoblic link from myapp to dropbox"
mkdir -p ${VOLUME_DROPBOX}${VOLUME_MYAPP}
ln -svf ${VOLUME_MYAPP} ${VOLUME_DROPBOX}${VOLUME_MYAPP}
echo "Container ready"
exit 0

I have verified that symbolic link inside my Dropbox container and files are present.

Also, permissions of /dbox/Dropbox is not UID 1000/GID 1000 but UID 200/GUID 200.

myfile.txt is owned by UID 1000/GID 1000 and located in /dbox/Dropbox/srv/docker/company/myapp-data/etc/myapp/myFile.txt.

I have tried your recommendation of fixing the UID/GID to 1000.

I still have the same errors when trying to downloading file : Can't sync "myfile.txt" (permission denied)

Even if it would have worked, It is not the best way to implement dropbox in my situation, I am planning to attach more than one volumes from more data containers to this Dropbox instance.

Data from other volumes can be from different group.

It could be nice if we could run Dropbox as root.

@janeczku
Copy link
Owner

I see. To give Dropbox super privileges (same as running as root) you should just pass DBOX_GID=0 (do not also set DBOX_UID to 0!). Try this:

docker run -d --restart=always --name=dropbox \
-e DBOX_GID=0 \
--volumes-from=another_data_container \
janeczku/dropbox

@kopax
Copy link
Author

kopax commented Mar 29, 2016

root@b803b686c1bb:/# dropbox status 
Syncing (34 files remaining)
Downloading 34 files...
Can't sync "myfile.txt" (permission denied)
root@b803b686c1bb:/# id dropbox
uid=1000(dropbox) gid=0(root) groups=0(root)

So far I have 3 suppositions left :

  • I am trying to write in a symbolic folder that point to /etc/myapp into the dropbox container and I don't have the right. (Wait !! super privilege give me the right to do anything so it can't be true)

  • Dropbox client issue.

  • Docker volumes miss usage.

    root@b803b686c1bb:/etc# ls -altr /etc/myapp
    total 8
    drwxr-xr-x  2 root root 4096 Mar 29 16:54 .
    drwxr-xr-x 53 root root 4096 Mar 29 17:19 ..
    

Any advices are well appreciated.

@janeczku
Copy link
Owner

What user/permissions is set for "myfile.txt" when you exec into the running dropbox container and check from there?

@janeczku
Copy link
Owner

Also paste owner/permission of /dbox and /dbox/dropbox from inside the running container!
Actually do that for every folder in the chain:

/dbox/Dropbox/srv/docker/company/myapp-data

@kopax
Copy link
Author

kopax commented Mar 29, 2016

myfile.txt is present, uid 1000 gid 1000, but it's only in the dropbox container that send, the container that just received doesn't receive because of the permissions.

From the dropbox container that send to dropbox.com :

root@4412dec5c962:/# ls -altr /dbox/Dropbox/srv/docker/company/myapp-data/etc/myapp/myapp/myapp.txt
-rw-r--r-- 1 dropbox dropbox 546 Jan  7 16:14 /dbox/Dropbox/srv/docker/company/myapp-data/etc/myapp/myapp/myapp.txt
root@4412dec5c962:/# ls -altr /dbox
total 24
-rw-r--r--  1 dropbox root  675 Nov 12  2014 .profile
-rw-r--r--  1 dropbox root 3515 Nov 12  2014 .bashrc
-rw-r--r--  1 dropbox root  220 Nov 12  2014 .bash_logout
drwxr-xr-x  2 dropbox root    6 Mar 10 23:40 base
drwxr-xr-x  6 dropbox root  114 Mar 10 23:40 .
drwxr-xr-x  3 dropbox root   67 Mar 10 23:40 .dropbox-dist
drwxr-xr-x 22 root    root 4096 Mar 29 17:19 ..
drwxr-xr-x  5 dropbox root 4096 Mar 29 17:20 .dropbox
drwx------  5 dropbox root 4096 Mar 29 17:20 Dropbox
root@4412dec5c962:/# ls -altr /dbox/Dropbox/
total 28
drwxr-xr-x 6 dropbox root  114 Mar 10 23:40 ..
drwxr-xr-x 3 dropbox root 4096 Mar 29 17:19 srv
-rwxrwxr-x 1 dropbox root   36 Mar 29 17:20 .dropbox
drwx------ 5 dropbox root 4096 Mar 29 17:20 .
drwxrwxr-x 3 dropbox root 4096 Mar 29 17:20 .dropbox.cache

From the container that should receive from dropbox.com:

root@218590ea6d92:/# ls -altr /dbox/   
total 24
-rw-r--r--  1 dropbox root  675 Nov 12  2014 .profile
-rw-r--r--  1 dropbox root 3515 Nov 12  2014 .bashrc
-rw-r--r--  1 dropbox root  220 Nov 12  2014 .bash_logout
drwxr-xr-x  2 dropbox root    6 Mar 10 23:40 base
drwxr-xr-x  6 dropbox root  114 Mar 10 23:40 .
drwxr-xr-x  3 dropbox root   67 Mar 10 23:40 .dropbox-dist
drwxr-xr-x  3 dropbox root 4096 Mar 29 18:16 Dropbox
drwxr-xr-x 22 root    root 4096 Mar 29 18:16 ..
drwxr-xr-x  5 dropbox root 4096 Mar 29 18:17 .dropbox
root@218590ea6d92:/# ls -altr /dbox/Dropbox/
total 28
drwxr-xr-x 6 dropbox root  114 Mar 10 23:40 ..
drwxr-xr-x 3 dropbox root 4096 Mar 29 18:28 srv
-rwxrwxr-x 1 dropbox root   36 Mar 29 18:28 .dropbox
drwx------ 5 dropbox root 4096 Mar 29 18:28 .
drwxrwxr-x 3 dropbox root 4096 Mar 29 18:28 .dropbox.cache

@janeczku
Copy link
Owner

Exec to one of the containers where dropbox is running. Then run:

usermod -s /bin/bash dropbox
su dropbox
cat /dbox/Dropbox/srv/docker/company/myapp-data/etc/myapp/myapp/myapp.txt
cat /etc/myapp/myapp/myapp.txt

@kopax
Copy link
Author

kopax commented Mar 29, 2016

No files is synchronized

@kopax kopax closed this as completed Mar 29, 2016
@janeczku
Copy link
Owner

No files is synchronized

Et bien? Ca me dit rien. T'as effectue les activites decrites ci-dessus?

@kopax
Copy link
Author

kopax commented Mar 30, 2016

me@master-01:~$ docker exec -ti 0488dcb4782a bash
root@0488dcb4782a:/# usermod -s /bin/bash dropbox
root@0488dcb4782a:/# su dropbox     
dropbox@0488dcb4782a:/$ cat /dbox/Dropbox/srv/docker/myapp/myapp-data/etc/myapp/myapp/myapp.txt
id=1
dropbox@0488dcb4782a:/$ cat /etc/myapp/myapp.txt        
id=1

Je ne comprends pas bien le sens de ce test.
Ce que je veux dire, c'est qu'effectuer ces commandes sur le client qui à servi à synchroniser sur dropbox, c'est normal que les fichiers soient présent (puisqu'il sont sur dropbox).
Tandis que c'est normal que le fichier ne soit pas présent sur le client qui réceptionne, puisqu'il rencontre d'abord le problème de droit.

@janeczku
Copy link
Owner

Je ne comprends pas bien le sens de ce test.
Tandis que c'est normal que le fichier ne soit pas présent sur le client qui réceptionne, puisqu'il rencontre d'abord le problème de droit.

I think we had a misunderstanding here. I thought the Can't sync "myfile.txt" (permission denied) error occurs on the sending client. But apparently the file is uploaded to Dropbox successfully, but cannot be downloaded, right? Looks like a Dropbox problem.

@kopax
Copy link
Author

kopax commented Mar 31, 2016

I reopen this issue because it is not solved.

For Dropbox, it's the client which is not up to date.

For you and for me, it is Dropbox client the problem.

Mise à jour par : Benedict, 30 mars 8:57 AM:

Bonjour Monsieur,

Merci de nous avoir contacté. Je comprends que vous recevez une message d'erreur avec un fichier dans votre Dropbox.

Après avoir vérifié votre compte, il semble que vous utilisez une ancienne version de l'application Dropbox sur votre ordinateur. Le problème que vous rencontrez devrait disparaître une fois que l'application est mise à jour.

Pour mettre à jour l'application, suivez ces instructions :

  1. Quittez l'application Dropbox depuis le menu Dropbox. Faites un clic droit sur l'icône Dropbox et sélectionnez "Quitter"

  2. Téléchargez la version actuelle de Dropbox en visitant le site Internet de Dropbox :

https://www.dropbox.com/downloading

  1. Lancez l'installateur

  2. Pendant le processus d'installation, il vous sera demandé si vous avez déjà un compte. Entrez l'adresse e-mail et le mot de passe du compte Dropbox que vous souhaitez synchroniser.

Si votre Dropbox était déjà synchronisée avant de réinstaller, la ré-indexation des fichiers ne prendra que très peu de temps et la synchronisation devrait recommencer rapidement.

Merci d'utiliser Dropbox et n'hésitez pas si vous avez d'autres questions.

Cordialement,
Benedict

Please not that the client crash on every docker instance, after 10 to 20 minutes.
I wonder if this bug is related to my sync issue that make all client buggy ?
(I haven't talk about yet for that reason.)


CONTAINER ID        IMAGE                                                    COMMAND                 CREATED             STATUS                           PORTS                               NAMES
d9b613d19bf9        janeczku/dropbox:3.14.7        "/root/run"             13 minutes ago      Exited (143) 4 minutes ago                                           mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.47586df0-ee51-4c01-9500-4d34f80a4e48
e4a8a9dbab46        janeczku/dropbox:3.14.7        "/root/run"             26 minutes ago      Exited (143) 17 minutes ago                                          mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.681c0849-1e61-410b-829c-cf03bf5f626b
3588d58c3103        janeczku/dropbox:3.14.7        "/root/run"             40 minutes ago      Exited (143) 31 minutes ago                                          mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.e0cff757-9151-42d6-914d-c86606c9629d
5d56a3006262        janeczku/dropbox:3.14.7        "/root/run"             53 minutes ago      Exited (143) 44 minutes ago                                          mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.b53628b1-b977-4690-9f0f-f6616860ed3a
2a1ab50bd133        janeczku/dropbox:3.14.7        "/root/run"             About an hour ago   Exited (143) 53 minutes ago                                          mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.b5e0e9cc-acd4-4fd9-807e-20c7b44b218c
2ed05ba54add        janeczku/dropbox:3.14.7        "/root/run"             About an hour ago   Exited (143) About an hour ago                                       mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.5cb06610-9d66-474d-8a15-caad2c745cf0
653142e5c3f1        janeczku/dropbox:3.14.7        "/root/run"             About an hour ago   Exited (143) About an hour ago                                       mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.5f6fa4e1-8cd9-4a6e-a051-f7202e4e5f97
fc808e8ad433        janeczku/dropbox:3.14.7        "/root/run"             About an hour ago   Exited (143) About an hour ago                                       mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.f27aa4bd-9589-4c73-a889-62e7fe5a90f9
2fad25d02041        janeczku/dropbox:3.14.7        "/root/run"             About an hour ago   Exited (143) About an hour ago                                       mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.3c4ede5a-c70f-42a2-8cf8-0ad951996489
12b4d63ac5d9        janeczku/dropbox:3.14.7        "/root/run"             2 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.15b85e8e-5a84-4eb0-a948-9a2bd83ad844
ac5a26c5a32a        janeczku/dropbox:3.14.7        "/root/run"             2 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.e3d80499-79d6-4584-9d17-3f5f9582cc59
21718c9af1e6        janeczku/dropbox:3.14.7        "/root/run"             2 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.fe90823e-06cd-4955-9d86-c3052f68707a
55ba07af3f0e        janeczku/dropbox:3.14.7        "/root/run"             2 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.9fc5e2c0-6a2c-48b2-9725-f01692b483bf
39f49092fcbe        janeczku/dropbox:3.14.7        "/root/run"             2 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.456a3414-fdc1-4e4c-ae0b-fb7371071716
d377dda069fd        janeczku/dropbox:3.14.7        "/root/run"             3 hours ago         Exited (143) 2 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.dfdb887f-cc84-4cc7-9509-bbbca3887d06
53c888a5f155        janeczku/dropbox:3.14.7        "/root/run"             3 hours ago         Exited (143) 3 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.c88e5650-6e69-46fb-93e6-1013e83d7920
49a2e5ed19d4        janeczku/dropbox:3.14.7        "/root/run"             3 hours ago         Exited (143) 3 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.8f197edf-3195-443d-8c70-4da19faf1285
680f9548e5e5        janeczku/dropbox:3.14.7        "/root/run"             3 hours ago         Exited (143) 3 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.81a1b46f-56a3-4c98-b4c0-44d511026848
1be6fbfedf59        janeczku/dropbox:3.14.7        "/root/run"             3 hours ago         Exited (143) 3 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.5be0c9db-13e5-4bfc-8460-2f96ddfb08b8
36b40fb954ba        janeczku/dropbox:3.14.7        "/root/run"             4 hours ago         Exited (143) 3 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.1b428d25-3f41-4051-868c-936540ed21f3
362970d103e6        janeczku/dropbox:3.14.7        "/root/run"             4 hours ago         Exited (143) 4 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.faa801c7-9d7f-4613-a4b5-1d884705b6e2
ccccaa0ff9d7        janeczku/dropbox:3.14.7        "/root/run"             4 hours ago         Exited (143) 4 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.75317063-8b7b-408b-a804-b99918925d20
db3a5721381f        janeczku/dropbox:3.14.7        "/root/run"             4 hours ago         Exited (143) 4 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.ca0482b4-f74c-4792-b60d-f0f1e2af7dbe
0afe6c55d77e        janeczku/dropbox:3.14.7        "/root/run"             5 hours ago         Exited (143) 4 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.af1021c5-2958-438d-a6f1-9a5ba4dfbbce
90a344e369b0        janeczku/dropbox:3.14.7        "/root/run"             5 hours ago         Exited (143) 5 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.0ae14f21-70d5-4459-8e77-fb19489ff10f
18fe863bece3        janeczku/dropbox:3.14.7        "/root/run"             5 hours ago         Exited (143) 5 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.a7cfe445-2b69-4956-92f0-6d4ade5182ce
ceff23f4abce        janeczku/dropbox:3.14.7        "/root/run"             5 hours ago         Exited (143) 5 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.ab91234b-8c56-4eb6-9320-ccde75d49f35
ce0411271b74        janeczku/dropbox:3.14.7        "/root/run"             5 hours ago         Exited (143) 5 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.3b10d1f2-5a69-45e8-b587-58df77d64817
a9ae3115666c        janeczku/dropbox:3.14.7        "/root/run"             6 hours ago         Exited (143) 5 hours ago                                             mesos-3f12cd06-ef23-4d6c-b6b1-4b2366e94829-S2.c0d9f73f-c7d4-410a-92a7-a5ae0f93291f

Please do not close the issue until we haven't found the source of the problems.
This because your Dropbox is first on hub.docker.io and people might need to know what are the current encountered issue.

So far I see this possibles issues :

  • Dropbox wrong version (we need to check for new version, wasn't the version bumped 15 days ago? Did it get upgraded by Dropbox meanwhile ?)
  • Dropbox current version issue (we should be able to reproduce the bug on your host)
  • Unstable docker container (We still need a reason)
  • Is working with symlink between data containers not recommended ? (We need a demo)

@kopax kopax reopened this Mar 31, 2016
@kopax
Copy link
Author

kopax commented Mar 31, 2016

Dropbox current linux version available is 3.16.1.
Error is related to the client builded in this image.
Keeping open the issue is legit isn't it ?

@janeczku
Copy link
Owner

Dropbox current linux version available is 3.16.1.

The image has the latest version:

$ docker logs dropbox
dropboxd(3.16.1) started...

I just had another idea: Apparently dropbox writes error reports to the /tmp folder (see here). With the current image this does not work though.

  1. Please run this development image for the receiving client: janeczku/dropbox:devel.
  2. After you see the error Can't sync "myfile.txt" (permission denied) you exec to the container
  3. Check if there are any files like/tmp/dropbox_errorXXXX.txt and copy/paste the content here.
docker run -d --name=dropbox \
-e DBOX_GID=0 \
--volumes-from=another_data_container \
janeczku/dropbox:devel

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

No branches or pull requests

2 participants