How to Fix "Go Not Root Owned"

VS code doesn't open any more

Seems like you don't own root.

Try running:

sudo chown root:root /

Unable to install Go packages

godoc seems to be an exception to the general go get practice, because it installs to the go installation ($GOROOT/bin) instead of $GOPATH. So, if you really need to update godoc (why?), what you need to do is:

  1. Log in as root (or su, or sudo su, or ...)
  2. Set $GOPATH to your normal user $GOPATH ("/home/utkbansal/go")
  3. Update godoc, using go get -u golang.org/x/tools/cmd/godoc, or all tools
  4. Set the appropriate permissions on for your $GOPATH, i.e. chown -R utkbansal:utkbansal $GOPATH (still as root)

That should work I guess. BUT: Why would you want to update godoc? If you just want one specific tool that is not pre-installed, you should be able to go get it without root privileges.

Git can overwrites files owned by root (no sudo)

git checkout only does one thing with the existing file: it removes it, for which it only requires write permissions for the current directory.

After the file is remove, Git creates a new file owned by the current user and its default group, with 755 permissions if the tracked file is executable, 644 otherwise.



Related Topics



Leave a reply



Submit