{"action":"created","issue":{"url":"https://api.github.com/repos/tmuras/moosh/issues/138","repository_url":"https://api.github.com/repos/tmuras/moosh","labels_url":"https://api.github.com/repos/tmuras/moosh/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/tmuras/moosh/issues/138/comments","events_url":"https://api.github.com/repos/tmuras/moosh/issues/138/events","html_url":"https://github.com/tmuras/moosh/issues/138","id":136215496,"number":138,"title":"moosh uses homedir of user, even when sudo is used","user":{"login":"usernamenumber","id":188349,"avatar_url":"https://avatars.githubusercontent.com/u/188349?v=3","gravatar_id":"","url":"https://api.github.com/users/usernamenumber","html_url":"https://github.com/usernamenumber","followers_url":"https://api.github.com/users/usernamenumber/followers","following_url":"https://api.github.com/users/usernamenumber/following{/other_user}","gists_url":"https://api.github.com/users/usernamenumber/gists{/gist_id}","starred_url":"https://api.github.com/users/usernamenumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/usernamenumber/subscriptions","organizations_url":"https://api.github.com/users/usernamenumber/orgs","repos_url":"https://api.github.com/users/usernamenumber/repos","events_url":"https://api.github.com/users/usernamenumber/events{/privacy}","received_events_url":"https://api.github.com/users/usernamenumber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-24T23:01:28Z","updated_at":"2016-03-16T12:16:59Z","closed_at":null,"body":"It looks like it's best practice to run moosh as the owner of your Moodle install, e.g. `sudo -u www-data moosh ...`. \r\n\r\nHowever, the `home_dir()` function in `includes/functions.php` just grabs the value of `$HOME` which in an example like the above is still set to the original user's homedir. As a result, moosh ends up attempting to access `/home/$my_user/.moosh/` as `www-data`, which of course gets a permission error.\r\n\r\nAm I missing something?  "},"comment":{"url":"https://api.github.com/repos/tmuras/moosh/issues/comments/197291211","html_url":"https://github.com/tmuras/moosh/issues/138#issuecomment-197291211","issue_url":"https://api.github.com/repos/tmuras/moosh/issues/138","id":197291211,"user":{"login":"usernamenumber","id":188349,"avatar_url":"https://avatars.githubusercontent.com/u/188349?v=3","gravatar_id":"","url":"https://api.github.com/users/usernamenumber","html_url":"https://github.com/usernamenumber","followers_url":"https://api.github.com/users/usernamenumber/followers","following_url":"https://api.github.com/users/usernamenumber/following{/other_user}","gists_url":"https://api.github.com/users/usernamenumber/gists{/gist_id}","starred_url":"https://api.github.com/users/usernamenumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/usernamenumber/subscriptions","organizations_url":"https://api.github.com/users/usernamenumber/orgs","repos_url":"https://api.github.com/users/usernamenumber/repos","events_url":"https://api.github.com/users/usernamenumber/events{/privacy}","received_events_url":"https://api.github.com/users/usernamenumber/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T12:16:59Z","updated_at":"2016-03-16T12:16:59Z","body":"That sounds like a good compromise to me. Maybe add an option to moosh that\nallows the user to explicitly say where `.moosh` should be located, and\nmention that in the warning message?\nOn Mar 15, 2016 1:47 PM, \"Tomasz Muras\" <notifications@github.com> wrote:\n\n> Documentation update is always a good idea. I think I should add run-time\n> check to see if my home dir (whatever that may be) is writeable - and then\n> at least advice users.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/tmuras/moosh/issues/138#issuecomment-196944821>\n>\n"}}