{"action":"created","issue":{"url":"https://api.github.com/repos/lxc/lxd/issues/714","labels_url":"https://api.github.com/repos/lxc/lxd/issues/714/labels{/name}","comments_url":"https://api.github.com/repos/lxc/lxd/issues/714/comments","events_url":"https://api.github.com/repos/lxc/lxd/issues/714/events","html_url":"https://github.com/lxc/lxd/issues/714","id":81339812,"number":714,"title":"Mounting directories r/w","user":{"login":"techtonik","id":515889,"avatar_url":"https://avatars.githubusercontent.com/u/515889?v=3","gravatar_id":"","url":"https://api.github.com/users/techtonik","html_url":"https://github.com/techtonik","followers_url":"https://api.github.com/users/techtonik/followers","following_url":"https://api.github.com/users/techtonik/following{/other_user}","gists_url":"https://api.github.com/users/techtonik/gists{/gist_id}","starred_url":"https://api.github.com/users/techtonik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techtonik/subscriptions","organizations_url":"https://api.github.com/users/techtonik/orgs","repos_url":"https://api.github.com/users/techtonik/repos","events_url":"https://api.github.com/users/techtonik/events{/privacy}","received_events_url":"https://api.github.com/users/techtonik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-05-27T08:10:49Z","updated_at":"2015-11-30T22:05:14Z","closed_at":null,"body":"#592 describes the way (actual at lest for 0.10) to mount directories read only:\r\n```\r\nlxc config device add contname sharename disk source=$PWD path=/home/pathinside\r\n```\r\nHow to mount them with write privileges?\r\n\r\n----\r\nThis command above mounts the folder nobody:nobody, and it is impossible to create anything in it. \r\n\r\n@stgraber mentions that this command supports three types of mounts:\r\n\r\n 1. partitions - `source=<partition UUID>\r\n 2. block devices - `source=/dev/blockdevice`\r\n 3. file or dir - `source=/host/file`\r\n\r\nThe actual for this issue (3) is mounted using \"bind mount\", and it looks like LXC requires some kind of access control like ownership to enable r/w for that. So, LXD needs to map directory owner from host to guest. So, how to do this?\r\n\r\nAnd also, from the user point of view that mapping is not always necessary. I'd be happy to operate with directory that has write and execution permissions for everybody. Is it possible to teach LXD/LXC to share directory in this way?\r\n\r\nOr it is possible to make automatic mapping from current user to root? Like:\r\n```\r\nlxc config device add contname sharename disk source=$PWD path=/home/pathinside rwmap=$USER:root\r\n```\r\n\r\n?\r\n\r\nIdeally, there should be something that is easy to memorize, and what could have dedicated help page.\r\n```\r\nlxd mount host=$PWD guest=/root/somename\r\n```"},"comment":{"url":"https://api.github.com/repos/lxc/lxd/issues/comments/160776588","html_url":"https://github.com/lxc/lxd/issues/714#issuecomment-160776588","issue_url":"https://api.github.com/repos/lxc/lxd/issues/714","id":160776588,"user":{"login":"srkunze","id":1389648,"avatar_url":"https://avatars.githubusercontent.com/u/1389648?v=3","gravatar_id":"","url":"https://api.github.com/users/srkunze","html_url":"https://github.com/srkunze","followers_url":"https://api.github.com/users/srkunze/followers","following_url":"https://api.github.com/users/srkunze/following{/other_user}","gists_url":"https://api.github.com/users/srkunze/gists{/gist_id}","starred_url":"https://api.github.com/users/srkunze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srkunze/subscriptions","organizations_url":"https://api.github.com/users/srkunze/orgs","repos_url":"https://api.github.com/users/srkunze/repos","events_url":"https://api.github.com/users/srkunze/events{/privacy}","received_events_url":"https://api.github.com/users/srkunze/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T22:05:14Z","updated_at":"2015-11-30T22:05:14Z","body":"> That'd be because LXC doesn't setup your groups on attach.\r\n\r\nIt may be just me but I have to admit I would except LXC doing this for me.\r\n\r\n> Unfortunately doing so requires knowledge of the distribution inside the container which LXC doesn't have, so I expect it's just not bothering to do nss initialization (init_groups()).\r\n\r\nThat sounds like another hook to me. Each image/container should tell the hypervisor where to find the triggers for group initialization.\r\n\r\n(Disclaimer: I am honestly surprised that group initialization is some sort of a separate/optional module; when I consider all the scripts/modules I know which simply assume proper setup of all additional groups...)"}}