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

mock must not ask for root password but suggests to add my user to mock group #244

Closed
vstinner opened this issue Apr 4, 2019 · 6 comments

Comments

@vstinner
Copy link

vstinner commented Apr 4, 2019

"mock -r fedora-rawhide-x86_64 --init" asks me for my root password, so I started to use "sudo mock ...". My colleague Miro asked me to never run mock as root. But I started to do that because it asks me for my root password... For me, it's obviously that such low-level container needs root access.

mock should fail with an error "you user <...> doesn't have the group mock". Maybe even running mock as root must fail with an error except if you pass a special option?

rpm -q mock: mock-1.4.14-1.fc29.noarch

@hroncok
Copy link
Contributor

hroncok commented Apr 4, 2019

We were discussing this with @vstinner and I was about to file this. Here is what I wrote:

Short description of the problem

Instead of informing to be part of the mock group, mock asks you for root password.

Output of rpm -q mock

mock-1.4.14-1.fc31.noarch

Steps to reproduce issue

(This can be done in rawhide mock for testing. Like in the Inception movie.)

  1. useradd nomocker
  2. su - nomocker
  3. groups - verify mock is not there
  4. mock init

Actual behavior:

$ mock init
You are attempting to run "mock" which requires administrative
privileges, but more information is needed in order to do so.
Authenticating as "root"
Password: 

Expected behavior

$ mock init
You don't appear to be part of the mock group.
Please add the nomocker user to the mock group in order to use mock.
If you've already done that, please log out and in again.
User can be added for example via:
$ sudo usermod -a -G mock nomocker

@xsuchy
Copy link
Member

xsuchy commented Apr 4, 2019

  1. It is documented setup https://github.com/rpm-software-management/mock/wiki#setup

  2. it cannot be (easily) done in mock as /usr/bin/mock is symlink to consolehelper which does the privilege elevation using PAM ( /etc/pam.d/mock ).

I will try to come up with some RFE proposal to consolehelper and then I will close this issue.

@hroncok
Copy link
Contributor

hroncok commented Apr 4, 2019

  1. It is. And I know that. However not everybody starts by reading the docs. If users just dnf install mock and mock init, it should point them to the documented setup or provide the information. Currently it asks for root password. I don't have a root password. Also, this makes people switch to sudo mock instead of adding themselves to the group or reading the docs.

  2. Understood.

@xsuchy xsuchy closed this as completed in 922b8a9 Apr 17, 2019
@xsuchy
Copy link
Member

xsuchy commented Apr 17, 2019

When you are not in a mock group, then mock prints:
You are not in the mock group. See https://github.com/rpm-software-management/mock/wiki#setup
and then asks you for root password.

@hroncok
Copy link
Contributor

hroncok commented Apr 17, 2019

Thanks

@vstinner
Copy link
Author

Thanks, the error message is now much better :-)

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