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

Self hosted runner asks for password #38

Closed
alexandru-calinoiu opened this issue Dec 22, 2021 · 5 comments
Closed

Self hosted runner asks for password #38

alexandru-calinoiu opened this issue Dec 22, 2021 · 5 comments

Comments

@alexandru-calinoiu
Copy link

When running in a self-hosted runner it asks for the password of the current user. Any ideas on how to work around it?

@maxim-lobanov
Copy link
Owner

It is by design behavior because command to switch Xcode should be run with sudo. If you will switch Xcode without this action, you will face with the same issue.
On Hosted Runners, we have passwordless sudo. (Link 1), (Link 2).

Probably, you can disable password for sudo on your self-hosted agent. I have seen a lot of self-hosted agents with disabled sudo but you should take security concern into account (how this agent is used, who has an access to it and etc)

@alexandru-calinoiu
Copy link
Author

Got it, thanks for the answer.

@vanyasem
Copy link

Github-provided runners allow full sudo access without password, while self-hosted runners usually require entering password in order to execute commands with sudo

Disabling password for executing commands with sudo is a major security risk, and I recommend against it
You can override the default sudo behavior for a single command, allowing only that command to be executed without being prompted for the password

In our case, the command in question is xcode-select

Execute sudo visudo, and add the following lines to the sudoers file:

## No pw for xcode-select
%admin ALL=(ALL) NOPASSWD: /usr/bin/xcode-select

See https://stackoverflow.com/a/63602993 for more details

@vanyasem
Copy link

#62 has a potential solution to change Xcode versions without xcode-select, hence eliminating the need for ``sudo` altogether. You can upvote the issue, and the attached pull request (#63) to indicate that it matters to you.

@vanyasem
Copy link

@maxim-lobanov I guess this could be added to the docs/mentioned in the README? Seems like a pretty common case for self-hosted runners, and the solution is basically a one-liner added to the sudoers file

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