Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Permissions of docker user's home directory #1406

Open
flylan opened this issue Apr 21, 2020 · 2 comments
Open

Permissions of docker user's home directory #1406

flylan opened this issue Apr 21, 2020 · 2 comments

Comments

@flylan
Copy link

flylan commented Apr 21, 2020

Guest system version: Windows 10 professional
Virtualbox version: 6.1.6 r137129
Vagrant version: 2.2.7
Boot2docker.iso version: v19.03.5

I use boot2docker as the virtual system of vagrant. I need to set config.ssh.insert_key = true to use Rsync's shared folder mode.
However, due to the directory permission problem of /home/docker, the docker user cannot create authorized_keys in this folder, so I hope you can help to set the user of /home/docker as docker user

chown -R docker:docker /home/docker

企业微信截图_15874383728073

@tianon
Copy link
Contributor

tianon commented Apr 21, 2020

Looks like we missed a few while updating /home/docker's contents -- try this patch:

diff --git a/Dockerfile b/Dockerfile
index 8b0e1b5..04a9d8e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -159,6 +159,7 @@ RUN tcl-tce-load bash; \
 	; \
 	echo 'source /etc/profile' > home/docker/.profile; \
 	echo 'source /etc/profile' > root/.profile; \
+	chown -R docker:staff home/docker; \
 # swap "docker" (and "root") user shell from /bin/sh to /bin/bash now that it exists
 	sed -ri '/^(docker|root):/ s!:[^:]*$!:/bin/bash!' etc/passwd; \
 	grep -E '^root:' etc/passwd | grep bash; \
@@ -500,6 +501,7 @@ RUN [ ! -f usr/local/etc/sshd_config ]; \
 	grep '^PermitUserEnvironment yes$' usr/local/etc/ssh/sshd_config; \
 	mkdir -p home/docker/.ssh; \
 	echo 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' > home/docker/.ssh/environment; \
+	chown -R docker:staff home/docker; \
 # acpid prep (looks in the wrong path for /etc/acpi)
 	ln -sT ../usr/local/etc/acpi etc/acpi; \
 	[ -z "$(ls -A etc/acpi/events)" ]; \

@flylan
Copy link
Author

flylan commented Apr 22, 2020

@tianon
I don't want to rebuild boot2docker.iso, because it needs energy to maintain. I hope the future version can fix this problem.I have noticed that boot2docker.iso has not released a new version for a long time. And tinycore Linux has released version 11. Will the next version fix this problem and apply tinycore 11?

Instead of rebuilding boot2docker.iso, I choose to generate the bootlocal.sh file at initialization time.My current solution is to create a bootlocal.sh file under /var/lib/boot2docker like:
#!/bin/sh
chown -R docker:docker /home/docker

So after I built boot2docker.box, other users can use Rsync to share folders through vagrant

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

No branches or pull requests

2 participants