![]() |
No write permissions for admin group
Just bought my new mac, so I'm not yet familiar with osx.
when I tried to install some application and copy a file to /usr/bin I got a window saying that I don't have permissions to do that although my account belong to admin group. I have found that most of the subdirs under / are owned by 'wheel' and not admin, and admin group don't have right permissions to those folders. what do can I do to fix that, and how can I remove the annoying admin password request each time I do almost anything? |
If you're copying files to /usr/bin, that's the first no-no. /usr/bin is a directory that can be overwritten by system updates at any time. Only the entity responsible for the operating system (in this case, Apple) should write to /usr/bin.
If you'd like to add command-line apps to your new Mac, that's no problem. Just 1. add /usr/local/bin to the front of your PATH in your shell's configuration file, for example in ~/.bashrc or ~/.bash_profile 2. create /usr/local/bin and copy your command-line apps that you would like to add there. That all said, if you need to copy files to a directory where you don't have permission, and you are in the admin group, then you would prepend sudo to the copy command, and when you are asked for your password, enter it (blind--nothing is echoed back to the screen). Note that when using sudo, it is asking for YOUR account password, not a special password such as the root user. Just don't put anything in /usr/bin. Trevor |
Not to say Trevor is wrong, his set up is pretty efficient and way more safe, but I have successfully put both scripts and binary files in /usr/sbin that are third party and they work just fine. Just make sure you know what you are doing because you do run the risk of crashing the whole system.
Trevor's method is best practice because it can only hose your user level preferences and not mess with the system. |
Yeah, I suppose I should clarify that adding command-line apps to /usr/bin (or /usr/sbin, or /bin, or any of the operating system's directories) will work, at least temporarily. It's just a bad idea. And if you REALLY want to do it, then you can using the sudo command explained in my post above.
But it's just easier in the long run to put your own stuff into it's own directory, and from long Unix tradition that directory is /usr/local/bin. Trevor |
Like for example, the jamf client which is on every single machine at work installs the binary into /usr/sbin. I don't put it there their pkg installer does. Never had a problem with it at all so far. Some of the problems are though if you start putting things in there with wrong permissions and ownership it can be looked at very bad practice.
I just like to put things in the standard $PATH so I can run them as I see fit, then again I am not an average user either. |
Quote:
Many things may "work"... but right is right. Protocol has many meanings, and they all apply here. jamf sounds somewhat presumptuous. clamXav is proper and polite. PATH=$(echo {,/usr{,/local}}/{,s}bin ~/bin |/usr/bin/sed 's@ @:@g') ;) |
Quote:
Quote:
And to leave the standard system dirs like /usr/bin to Apple. That way you know what comes with the standard install and what you installed after. |
Quote:
Then there is Adobe, and well, this is getting off topic so I will stop, but my point is I think there is valid reason to put certain things under the hood in OS X and not just refer to them in a user specific bash profile. |
Quote:
Quote:
|
It is like launchd because it is also designed to manage systems that do not have access to a OS X Server and may be part of a Windows domain. It can take over the whole system, black/white list processes, and much much more.
You can enable and disable services, it is a full on framework. Unless, I have it all mixed up. |
It may sound weird, but the there isn't 'local' directory under /usr. and since i don't have write permissions to /usr i can't create one. what is going on?
|
You need to use 'sudo' to get 'root' privileges to create the /usr/local directory.
sudo mkdir /usr/local |
Quote:
|
Quote:
The OS X boot process is, Power > POST > EFI/Firmware > launchd > loginwindow I know that launchd rules them all. I am not trying to argue with you guys, I know you, Hayne, Hal, & Trevor are all really smart people. I just think that there are valid reasons to put things in the under-the-hood Unix of OS X. |
Quote:
(or whatnot) in /System/Library somewhere? No matter, our point here is that: there's no "technical" advantage of trampling into /sbin. Had they created /usr/local/sbin and put their binaries there, it would work just the same. The only tricky issue being the $PATH definition... which may be why they did it that way. (i.e., part laziness and part "it will always work, because /sbin is in everyone's $PATH".) -- Both /sbin and /System are in Apple's domain however... and any given update could wipe out extraneous items there, at any time (without warning). The /usr/local area is normally left undisturbed at all times (else, that would be Apple's bad). |
I am not saying I disagree with any of those statements, I am just saying there are valid reasons. The JAMF binary has a long list of commands that uses the under the hood Unix of OS X.
Code:
bash-3.2# whereis jamf |
Quote:
I'm not saying they *will* mind you... but we sure can't be sure. ;) |
Quote:
In that time, many people much smarter than us worked with Unix, and over time discovered (often painfully) that there are some things that you can do, and some things that you just cannot do with it. One thing that was shown, over and over again, is that the end user must leave the directories used by the operating system alone. They are completely free to add their own tools as much as they want, but they need to put those tools into their own directories, not trampling on the operating system's directories. If it is true that each new generation thinks themselves smarter than the previous generations, and can get away with shortcuts and duct tape fixes, then it is also true that each new generation will have to learn for themselves, the hard way, of the wisdom of "the right way" to do it. Trevor |
In this case I am not the end user though, I am the systems administrator. This is for an enterprise environment and not an end user machine. I have this set up and working on over 6,500 macs. There is a deployment up in Minnesota with over 12,000 Macs doing pretty much the same thing that I am.
I have been tossing certain things in the standard $PATH for years now, and while everyone has always told me the same thing you guys have, I have not had any issues. Of course I toss things in there that I test like a billion times before I ever put it out in production. I also disable software update and don't allow end users to update anything that isn't approved and tested. I have tossed several custom shell scripts in the standard $PATH and then created launchd items that execute that path, like /usr/sbin/myscript.sh for example. I am just really playing devil's advocate here is all.:D |
Quote:
I'm a kernel developer for several unix based platforms, so I thought that I'll be just fine with OS X, but I find this whole thing really annoying. BTW what is this 'wheel' group? |
Quote:
If you want omnipotence, grab a root shell: sudo -s Quote:
It's the companion to uid = 0 (root), and only root shall be a member. Thus sayeth the [BSD] Unix Lord. ;) |
Quote:
An admin account is one which can attain root privileges temporarily (for one command) by using 'sudo'. The 'root' account is disabled by default in OS X since it is a security risk to be logged in as root - especially in a GUI. And all uses of 'sudo' are logged - which is an advantage. |
Note also that the 'sudo' command only prompts for a password if it has been more than (by default) 5 minutes since your last use of 'sudo'.
|
Quote:
Code:
%admin ALL=(ALL) ALLSo, as an administrator, you DO get root privileges, simply by using sudo. Sudo access is logged (another good security measure) in /var/log/system.log and /var/log/secure.log. Sudo usage also has some other security features built in. Quote:
Quote:
Trevor |
Quote:
Granted, there's no guarantee that Apple will erase non-Apple items in those areas, (quite the opposite in fact). It's just that --if/when it ever does happen-- they will be fully within their rights to do so. |
Quote:
He said he's already "annoyed" -- why let 5 minute time-stamps add to that frustration? A sudo -s shell will last until the user types control-D. ;) |
Quote:
It's not just something that runs scripts. It's the root parent process of all processes in Mac OS X. |
Quote:
As for the sudo thing. When I do extensive terminal work I use first authenticate using sudo -s which opens up a root session in terminal and I am not sure if there is any time out. |
Quote:
Quote:
I'm not getting into the /sbin argument, but you're making a lot of fundamentally flawed assumptions in this thread. |
Quote:
The "lot" of developers who write to the system directories are wrong. On the other hand, the developers who create directories like /opt are just fine. /usr/local is traditional, but not at all required. If developers want to create new directories like /sw (used by fink) and /opt, that's just fine. Trevor |
Quote:
But I don't recommend it as a general use anytime you need to run a few commands with 'root' privileges. A certain amount of "annoyance" is good - it reminds you that you are doing something that might break the system. And anything that slows you down when doing such things is good. |
Quote:
|
Yeah I agree with you Mikey, I am just saying it is possible. While I have read through a lot of the Apple white pages I have also seen countless developers put stuff where it doesn't belong. I think Apple does look out for this type of stuff to some extent, especially legit third party developers.
While, I know I have bad habits, I don't see Apple wiping out my scripts I put in /usr/sbin and there are certain reasons I don't like putting things in user folders, especially with things like 'repair permissions.' Also, Apple doesn't always make it easy, and some developers are clueless and I don't know everything. I just get by with what I can. |
Quote:
i do what needs doing and then control-D out of there). I was making that special recommendation to yonio... "a kernel developer for several unix based platforms," who found "this whole thing really annoying". :) -- sudo alone only gets us so far. We cannot do this for example: sudo cd /var/db/dslocal/nodes/Default [so it's either type long pathnames or...] |
| All times are GMT -5. The time now is 10:18 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.