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

I don't have an option to execute brew cask as sudo user #43204

Closed
6 tasks done
xabim opened this issue Jan 26, 2018 · 5 comments
Closed
6 tasks done

I don't have an option to execute brew cask as sudo user #43204

xabim opened this issue Jan 26, 2018 · 5 comments

Comments

@xabim
Copy link

xabim commented Jan 26, 2018

General troubleshooting steps

Description of issue

In order to execute silent and unattended scripts I don't have an option to pass the password question and my script gets paused waiting for the password.

I want to know if there is a possibility to run sudo brew cask with a option like --run-as-sudo and maybe a warning but let the script continue without asking the sudo password

If I remove the root check the sudo command works, maybe we can relax this option and develop the above flag.

Output of your command with --verbose --debug

sudo brew cask reinstall teamviewer --verbose --debug
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

Output of brew cask doctor

brew cask doctor
==> Homebrew-Cask Version
Homebrew-Cask 1.5.2-8-g65e940f
caskroom/homebrew-cask (git revision f5732; last commit 2018-01-26)
==> macOS
10.13.3
==> SIP
Enabled
==> Java
N/A
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask (3902 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/universal-darwin9.0
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/bin/zsh"
@vitorgalvao
Copy link
Member

man -P 'less -p SUDO_ASKPASS' brew-cask
man -P 'less -p --askpass' sudo

@xabim
Copy link
Author

xabim commented Jan 29, 2018

I don't see how that solution can give me the privilege to execute the script unattended

If I execute the command line and the installation of brew as root (with or without sudo) I can't make it work, I don't see the ability to launch it without typing the sudo password at any time.

I use an agent to execute those scripts, and can be done with or without privileges.

@vitorgalvao
Copy link
Member

#19180.

Specifically #19180 (comment) and #19180 (comment).

@xabim
Copy link
Author

xabim commented Jan 29, 2018

Ok thanks, the issue there is that you have to type the password (at least one time), and we are deploying through an MDM tool, that executes scripts in a unattended way, I mean, you don't have the opportunity to type anything, and the other option is to write the admin pass in the script, and I found a big security issue there.

I only see two options:

  1. Create a user, give NOPASSWD rights with sudo and execute all the commands with that user (but I see a security issue there)
  2. Fork the repo and try to delete all the sudo checks, and install brew system-wide

Thanks for your time

@vitorgalvao
Copy link
Member

Your particular case is pretty specific, so we’re likely not going to support that more than we already do in the pointed feature.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants