|
|
#1 |
|
Prospect
Join Date: Apr 2005
Posts: 16
|
searching system as root
I have an OS X box that has a few accounts on it, how would I search all accounts for a file?
Would I need to be root? How would I do this? Would I have to search from / after I am root? Thanks in advance. |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
You don't need to be root; you can use the "sudo" command to run "find" once with privileges to search other people's folders. It is far more secure to use sudo rather than becoming root.
Code:
sudo find /Users -name "insert_filename_here"
__________________
COMPUTER TYPE SOME SPECIFICATIONS I COPIED FROM THE BOX STUFF I INSTALLED ALL BY MYSELF "WITTY QUOTE" |
|
|
|
|
|
#3 |
|
Hall of Famer
Join Date: Aug 2005
Location: USA
Posts: 3,418
|
Maybe he wants to use Spotlight?
__________________
15" MacBook Pro (Mid 2010), 2.4 GHz Core i5, 10.6.5, 4GB RAM PowerMac G4 "Quicksilver", 733 MHz, 10.4.11, 1.5GB RAM iPod Touch 5G, 32GB, iOS 6.1.3 |
|
|
|
|
|
#4 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
Well, since he didn't say that, there's nothing wrong with what I posted.
What's your point?
__________________
COMPUTER TYPE SOME SPECIFICATIONS I COPIED FROM THE BOX STUFF I INSTALLED ALL BY MYSELF "WITTY QUOTE" |
|
|
|
|
|
#5 |
|
Triple-A Player
Join Date: Jan 2007
Posts: 72
|
Run the following command as root:
/usr/libexec/locate.updatedb It takes a while so be patient. When it finishes any user can search the whole filesystem instantly using the locate command, eg. locate filename |
|
|
|
|
|
#6 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
I strongly recommend against this. Exposing the entire file system to all users, without authorization, is probably not a good idea. Use find with sudo or Spotlight from the command-line with sudo.
__________________
COMPUTER TYPE SOME SPECIFICATIONS I COPIED FROM THE BOX STUFF I INSTALLED ALL BY MYSELF "WITTY QUOTE" Last edited by Mikey-San; 02-02-2007 at 12:03 PM. |
|||||||||||||||||||||||
|
|
|
|
|
#7 |
|
Prospect
Join Date: Apr 2005
Posts: 16
|
thanks guys, sudo worked perfectly.
Locate is not an option as I don't want to expose the entire harddrive ... If I was logged in as root (how do i do that exactly?) could I then run SPOTLIGHT and see the entire machine across profiles? |
|
|
|
|
|
#8 | |||||||||||||||||||
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,854
|
Apple disables the root user as a separate login by default. This adds a layer of security that you should be hesitant to disable. However, if you want to temporarily enable the root login, it can be done in NetInfo Manager. I would highly recommend that after you test it, you then disable the root user (also in NetInfo Manager) again. NetInfo Manager > Security > Enable/Disable Root User Trevor |
|||||||||||||||||||
|
|
|
|
|
#9 |
|
Prospect
Join Date: Apr 2005
Posts: 16
|
Is there a way that I can say:
Jump onto my terminal, login as root there, then proceed as root in the GUI until I no longer need that priveledge, jumping back onto terminal and logging out. Thanks again for the schoolin'. |
|
|
|
|
|
#10 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
This is a bad idea. What do you need to accomplish that you need to be logged in as root in the GUI? (This is a rhetorical question. Just use sudo.)
__________________
COMPUTER TYPE SOME SPECIFICATIONS I COPIED FROM THE BOX STUFF I INSTALLED ALL BY MYSELF "WITTY QUOTE" |
|||||||||||||||||||||||
|
|
|
|
|
#11 | |||||||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2007
Posts: 72
|
How can you say that locate is insecure (in huge red letters no less!) and recommend Spotlight in the same post? The locate db contains filenames, the spotlight db contains, well, everything and has several know security issues to boot. If I had some super-secret hidden folders, or if I didn't want users on my system to be able to find the location my .htaccess files I would just lock down the locate database with a chmod 600 and the locate command with a 500. If you know of any credible security threats from using locate please post them as I update my database nightly. |
|||||||||||||||||||||||
|
|
|
|
|
#12 |
|
Triple-A Player
Join Date: Oct 2006
Location: New Orleans
Posts: 186
|
You can use an application such as Pseudo to run things as root. If you need to run finder as root open /System/Library/CoreServices/Finder.app with Pseudo.
http://personalpages.tds.net/~brian_hill/pseudo.html
__________________
Home: Dual 2GHz G5 Tower/ 2 Gigs RAM / GeForce 6800 GT DDL Work: MacBook 2GHz Core Duo / 2 Gigs RAM |
|
|
|
|
|
#13 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
I did not say locate was insecure; I said locate with sudo was insecure. When you run the locate database update as root, all users will have access to the updated locate database entries for all users, without authentication, from that point on. (At least, this has been the case in the past.) If you use sudo with find or mdfind, it's one-shot. No one gets permanent, password-free access to find and mdfind results across user domains.
__________________
COMPUTER TYPE SOME SPECIFICATIONS I COPIED FROM THE BOX STUFF I INSTALLED ALL BY MYSELF "WITTY QUOTE" Last edited by Mikey-San; 02-05-2007 at 11:21 PM. |
|||||||||||||||||||||||
|
|
|
![]() |
|
|