Open pdcastro opened 4 years ago
Connects-to: #542
I fix this by adding balena /bin
directory in the secure_path
option in /etc/sudoers
Using : Linux 16.04.1-Ubuntu x86_64 x86_64 x86_64 GNU/Linux Kernel : 4.15.0-106-generic NPM : 6.14.4 Nodes : v10.20.0
After complete via NPM installation as per https://github.com/balena-io/balena-cli/blob/master/INSTALL.md#npm-installation
which balena
the path output will be added to the
secure_path
option in/etc/sudoers
As in my case
/home/sonix/.nvm/versions/node/v10.20.0/bin/
sudo visudo
locate Defaults secure_path
add the path at the end. With care without messing the original (unless youre a guru)
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/sonix/.nvm/versions/node/v10.20.0/bin/"
CTRL + X
to save thenYes
. In return resultingvisudo: /etc/sudoers.tmp saved
After this fix , resolve all the privileges and sudo:balena: Command not found
issue
Able to run balena
without sudo
@pdcastro I think we should close either this or #542 as duplicate, since they are the same issue.
As per product feedback (gsheet), "balena scan requires admin privileges but the message is messy and hard to understand".
Instead of the current message:
Implement dynamic privilege escalation. On Windows, a pop-up would be raised asking the user to click Yes (or similar) to authorize running the command with administrator permissions. I believe the CLI already does it for other commands: https://github.com/balena-io/balena-cli/blob/v11.30.17/lib/utils/sudo.ts#L73
Alternatively, perhaps the CLI could re-execute itself using the
runas
shell command: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771525(v=ws.11)If that's not easily / reasonably possible, then reword the message:
Perhaps avoid the howtogeek link by choosing a widely available method and explaining how to do it in very few sentences (1-2-3 steps?) on the CLI output itself. Be sure that this explanation is not printed in red-on-bue! See #1712