{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/che/issues/3265","repository_url":"https://api.github.com/repos/eclipse/che","labels_url":"https://api.github.com/repos/eclipse/che/issues/3265/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/che/issues/3265/comments","events_url":"https://api.github.com/repos/eclipse/che/issues/3265/events","html_url":"https://github.com/eclipse/che/pull/3265","id":193213425,"number":3265,"title":"CHE-3264 - Starting the che server as an user","user":{"login":"snjeza","id":388609,"avatar_url":"https://avatars.githubusercontent.com/u/388609?v=3","gravatar_id":"","url":"https://api.github.com/users/snjeza","html_url":"https://github.com/snjeza","followers_url":"https://api.github.com/users/snjeza/followers","following_url":"https://api.github.com/users/snjeza/following{/other_user}","gists_url":"https://api.github.com/users/snjeza/gists{/gist_id}","starred_url":"https://api.github.com/users/snjeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snjeza/subscriptions","organizations_url":"https://api.github.com/users/snjeza/orgs","repos_url":"https://api.github.com/users/snjeza/repos","events_url":"https://api.github.com/users/snjeza/events{/privacy}","received_events_url":"https://api.github.com/users/snjeza/received_events","type":"User","site_admin":false},"labels":[{"id":192367928,"url":"https://api.github.com/repos/eclipse/che/labels/kind/enhancement","name":"kind/enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/eclipse/che/milestones/19","html_url":"https://github.com/eclipse/che/milestones/5.0.0-M9","labels_url":"https://api.github.com/repos/eclipse/che/milestones/19/labels","id":2140536,"number":19,"title":"5.0.0-M9","description":"","creator":{"login":"bmicklea","id":7644938,"avatar_url":"https://avatars.githubusercontent.com/u/7644938?v=3","gravatar_id":"","url":"https://api.github.com/users/bmicklea","html_url":"https://github.com/bmicklea","followers_url":"https://api.github.com/users/bmicklea/followers","following_url":"https://api.github.com/users/bmicklea/following{/other_user}","gists_url":"https://api.github.com/users/bmicklea/gists{/gist_id}","starred_url":"https://api.github.com/users/bmicklea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmicklea/subscriptions","organizations_url":"https://api.github.com/users/bmicklea/orgs","repos_url":"https://api.github.com/users/bmicklea/repos","events_url":"https://api.github.com/users/bmicklea/events{/privacy}","received_events_url":"https://api.github.com/users/bmicklea/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":0,"state":"open","created_at":"2016-11-16T21:59:47Z","updated_at":"2016-12-06T10:52:49Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-12-02T20:43:41Z","updated_at":"2016-12-06T14:13:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eclipse/che/pulls/3265","html_url":"https://github.com/eclipse/che/pull/3265","diff_url":"https://github.com/eclipse/che/pull/3265.diff","patch_url":"https://github.com/eclipse/che/pull/3265.patch"},"body":"### What does this PR do?\r\n\r\nFixes #3264 \r\n\r\n### What issues does this PR fix or reference?\r\n\r\n#3264 \r\n\r\nThe following is an example of starting che as the \"test\" user:\r\n\r\n```\r\ndocker run -p:8080:8080 \\\r\n        --name che \\\r\n\t--rm \\\r\n\t-u `id -u test` \\\r\n        -e CHE_USER=test \\\r\n        -v /var/run/docker.sock:/var/run/docker.sock \\\r\n        -v /tmp/data:/data \\\r\n\t-v /etc/group:/etc/group:ro \\\r\n\t-v /etc/passwd:/etc/passwd:ro \\\r\n           eclipse/che-server:ver\r\n```\r\n\r\n- as the \"user\" user (the same as without the patch):\r\n\r\n```\r\ndocker run -p:8080:8080 \\\r\n           --name che \\\r\n           --rm \\\r\n           -v /var/run/docker.sock:/var/run/docker.sock \\\r\n           -v /tmp/data:/data \\\r\n           eclipse/che-server:ver\r\n```\r\n\r\nTo check which user has started che, enter the following:\r\n\r\n```\r\ndocker exec che id\r\n```\r\n\r\n\r\nThe \"test\" user has to be in the docker group.\r\nWorkspaces are still started as the \"user\" user.\r\n\r\nBTW, the patch also fixes several issues related to permissions when the che server starts the first time.\r\n\r\nTo start a workspace (with the codenvy/ubuntu_jdk8 image, for instance) as an user, we could do the following: \r\n\r\n- the user has to have NOPASSWD sudo privilege. It runs the \"CMD sudo /usr/sbin/sshd -D && tail -f /dev/null\" command\r\nThis can be done by creating the sudo group and adding the user to it (in the base OS).\r\n\r\n- the user has the /home/user base directory with required artifacts (tomcat, maven, etc.)\r\nWe can solve this issue by creating the following script:\r\n\r\n```\r\nCHE_USER=`id -un`\r\nif [ \"$CHE_USER\" != user ]; then\r\n  sudo chown -R ${CHE_USER}:docker /home/user\r\n  sudo ln -s /home/user `eval echo \"~${CHE_USER}\"`\r\nfi\r\n```\r\n\r\nThe script should be run immediately after starting the workspace and before starting some other agent.\r\nIf this idea is acceptable, I can also create a patch to start the workspace as an user.\r\n\r\nSigned-off-by: Snjezana Peco <snjezana.peco@redhat.com>"},"comment":{"url":"https://api.github.com/repos/eclipse/che/issues/comments/265159201","html_url":"https://github.com/eclipse/che/pull/3265#issuecomment-265159201","issue_url":"https://api.github.com/repos/eclipse/che/issues/3265","id":265159201,"user":{"login":"l0rd","id":606959,"avatar_url":"https://avatars.githubusercontent.com/u/606959?v=3","gravatar_id":"","url":"https://api.github.com/users/l0rd","html_url":"https://github.com/l0rd","followers_url":"https://api.github.com/users/l0rd/followers","following_url":"https://api.github.com/users/l0rd/following{/other_user}","gists_url":"https://api.github.com/users/l0rd/gists{/gist_id}","starred_url":"https://api.github.com/users/l0rd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l0rd/subscriptions","organizations_url":"https://api.github.com/users/l0rd/orgs","repos_url":"https://api.github.com/users/l0rd/repos","events_url":"https://api.github.com/users/l0rd/events{/privacy}","received_events_url":"https://api.github.com/users/l0rd/received_events","type":"User","site_admin":false},"created_at":"2016-12-06T14:13:23Z","updated_at":"2016-12-06T14:13:23Z","body":"@snjeza: user `test` should belong to the docker group. [That's always required when running docker as non-root user](https://docs.docker.com/engine/installation/linux/ubuntulinux/#/manage-docker-as-a-non-root-user)."}}
{"actor":{"display_login":"l0rd"}}