Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when user doesn't have root sudo, install should print the commands to run with root privileges #602

Open
dcaillibaud opened this issue Aug 22, 2024 · 3 comments

Comments

@dcaillibaud
Copy link

Root privilege with sudo is common on ubuntu but it's not the only linux distribution !

"Normal" users without sudo are common, with admin task done with a lot of others way (root ssh access, root password, other admin user…).
In that case, a mkcert -install fails (it loops on asking the sudo password that doesn't exists), it should ask if user wants to try another sudo pass or give the root password or print the commands that needs to be run by root.

@iamprogrammerlk
Copy link

I think you can install CA manually by using Firefox.
Go to Settings on Firefox then Search Certificate, click on the View Certificate button then Import.

You can find the rootCA.pem installed location by running mkcert --CAROOT.

@h43z
Copy link

h43z commented Jan 14, 2025

mkcert does not run with sudo if the Uid == 0 (https://github.com/FiloSottile/mkcert/blob/master/main.go#L383C1-L385C3).

So you should be able to run mkcert -install as root just fine.

But If you want to install the CA it for a specific non-root user, run it as root (from a root shell) but temporarily overwrite the HOME variable.

HOME=/home/some-non-root-user mkcert -install
chown some-non-root-user /home/some-non-root-user/.local/share/mkcert/rootCA*.pem

@dcaillibaud
Copy link
Author

Yes, I found this digging in the install script, but it wasn't so easy.

I open this issue to suggest an install script improvement, giving the choice to print this command, or printing it if sudo fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants