Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 396 forks source link

[Ubuntu 16.04 LTS]: draft unable to write logs without sudo #611

Closed squillace closed 6 years ago

squillace commented 6 years ago

ubuntu 16.04, draft rc2 based on https://github.com/Azure/draft/commit/b66329c163c67dc8c7f9a3560573f0c9d42ce560 isn't able to write logs to /home//.draft/logs/: permission denied. Looks like this:

image

and with sudo:

image

bacongobbler commented 6 years ago

Can you show the output of ls -al /home/ralph | grep draft for me?

squillace commented 6 years ago
drwxr-xr-x  6 root  root         4096 Mar 22 18:02 .draft
-rw-rw-r--  1 ralph ralph    13607255 Mar 22 16:54 draft-canary-linux-amd64.tar.gz
-rw-rw-r--  1 ralph ralph    12373698 Mar  8 17:57 draft-v0.10.1-linux-amd64.tar.gz
squillace commented 6 years ago

I can torch the Mar 8 version....?

bacongobbler commented 6 years ago

aha! Yes you can, but I think I found the root of your issue.

Your $DRAFT_HOME directory was created with root permissions, perhaps by running sudo draft init the first time.

First, let's get you running again, and then figure out next steps to handle this better.

Can you try the following:

sudo chown ralph:ralph /home/ralph/.draft

That should reset the user/group permissions in $DRAFT_HOME back to the expected user permissions. once that's done, you should be able to run all draft commands without requiring sudo.

Now, as for the fix, it looks like when sudo draft init is called, we are still assuming that $HOME is /home/ralph instead of /root (the default home of the root user). We should identify and fix up that particular issue.

squillace commented 6 years ago

you did in fact find it. resolved also #612 and #613 as well.