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

setup_checks.sh: add sudo to iw call #872

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niziak
Copy link

@niziak niziak commented Dec 19, 2020

No description provided.

@kueblc
Copy link
Collaborator

kueblc commented Dec 20, 2020

Hi @niziak thanks for the PR!

Can you explain why this call need to be made as root? On my machine I can run iw list as user.

@wutje
Copy link

wutje commented Dec 22, 2020

On my Debian 10 machine iw returns not found, sudo iw works.

@niziak
Copy link
Author

niziak commented Dec 22, 2020

Yes. On Debian iw is installed in /usr/sbin/ and default user $PATH doesn't include sbin's paths.

@kueblc
Copy link
Collaborator

kueblc commented Dec 23, 2020

Interesting, thanks for the explanation!

Since the actual problem is that it is missing from PATH, would it make sense to update the PATH env variable? This way we can minimize the need for escalated privileges. Happy to hear your thoughts.

@wutje
Copy link

wutje commented Dec 24, 2020

On my Debian 10 machines iw is in /sbin, not /usr/bin. And a normal user is allowed to execute it.

@niziak
Copy link
Author

niziak commented Dec 25, 2020

Since the actual problem is that it is missing from PATH, would it make sense to update the PATH env variable? This way we can minimize the need for escalated privileges. Happy to hear your thoughts.

Yes, problem is in PATH variable. iw can be executed by unrpivileged user.
Debian's /etc/profile file:

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

Perhaps this workaround can be universal for everyone:

$(whereis -b iw | awk '{print $2}')

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

Successfully merging this pull request may close these issues.

3 participants