0

To be very specific:

Debian system:

I want to install Linuxbrew, when logged in as root, as a specific user.

Linuxbrew enjoys the niceness of being installed by the user, for the user's specific purposes. My goal is to, as root (definitely as root), execute the command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

as the user, so for all purposes, and intent, a specified user ran it.

the motivation is to run this command on behalf of, and as, the specified user so they may use Linuxbrew freely, but root user has provided it.

Note: I would like -simple- solutions for educational purposes. I am sure there's a variety of esoteric ways, but the less obfuscated, the better. this is a part of the solution. Simplicity, and readability.

Anthon
  • 79,293
NOP
  • 123

2 Answers2

1
su - username -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"'

I think it's obvious, but in case it isn't, replace 'username' with the name of the user you want to install Linuxbrew as.

EDIT: In hindsight, you could get a little bit more wild and use a for loop to install this for any user that has a home directory under /home

for u in `ls /home`; do su - $u -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"'; done
  • THAT'S what I was missing! the single quotes around the command >_< I saw the answer that I've been marked 'duplicate' for, but it kept throwing errors. Thank you! – NOP Oct 05 '15 at 12:52
  • also, thanks for the additional idea of using the for loop ;) – NOP Oct 05 '15 at 12:57
0

This isn't really how users work, however that doesn't matter as far as brew goes. Your actual question should be "how can I set up my homebrew install so a different user can administer it", you can find a very good answer here

Basically all that's needed is for that user to have write access to /usr/local, easiest way being giving the admin group write permissions and adding the user(s) to that group.

tolgraven
  • 121
  • 4
  • Who would end up owning the files by this path? I was concerned that this would require extra steps to ensure the intended parties have proper permissions and ownership. – NOP Oct 05 '15 at 12:53
  • Ownership isn't important, write access is. In any case you can always chown the dir later (whether to a group as I suggested, or a specific user) so you're never "locked" to whatever user ran the initial install command (except if they did a local install, obviously). – tolgraven Oct 06 '15 at 14:04