zhaofengli/colmena

Prevent apply-local without root access by default

Closed this issue ยท 4 comments

Hey ๐Ÿ‘‹ Loving colmena so far, thanks so much for this tool.

I'm wondering about the behavior for apply-local, and whether it should enforced that root access is required by default, rather than just a warning.

Would it make more sense for colmena apply-local to have a flag such as --without-root for the rare case when this behavior is desired?

Not a big deal either way, I've just carelessly run colmena apply-local several times without root access and wondered why my build as failed :)

Context: we do have flag --sudo https://colmena.cli.rs/unstable/features/apply-local.html?highlight=sudo#local-deployment

so the idea here is to always try sudo?

Ah yea this serves the same purpose, just a different approach. My thinking was that the default behavior should be to either attempt to elevate or fail without sudo, since almost all the time, the user would need root access in order for this command to be useful.

A flag is nice, when you know it exists :)

I guess, since sudo is more or less dangerous to interact with without user consent, by default we don't try/use it but give out warnings (? Not sure whether we have one) and provide this flag as an option.

If we do not have such warning/suggestions on failure we should add one, otherwise I would prefer to keep current behavior.


I did a quick test without sudo and it seems colmena will have an immediate notice:

[WARN ] Colmena was not started by root. This is probably not going to work.
[WARN ] Hint: Add the --sudo flag.

yep there are warnings :) I think i'll close this... thinking more about the behavior I think how it is now makes the most sense, and realistically this command will be either behind an alias or a build script most of the time anyway