I am having difficulties figuring out why certain things are much more complicated on a mac terminal than a standard linux shell..

Say I have two local accounts, one administrator called "adm" and a standard user "usracc" and I want to be able to update the locate database with updatedb command. I need to simply run sudo updatedb, except usracc is not in the sudoers list.

Ok, I say and su adm then sudo updatedb which tells me that updatedb command is not found. So to recap:

  1. my regular user account is not on the sudoers list (this is actually intentional, as I dont want to compromise the system if the password for this account is compromised).

  2. my admin account can sudo but apparently not that particular command, which cannot be found for whatever reason.

  3. when I su to my admin account I see; shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied which gets repeated everytime I try to get content assist with the tab key..

so with the root account disabled, apple sort of forces you to give sudo privilages to user accounts to be able to do simple stuff, how exactly does that help with security? Or have I completely misunderstood something here?

1 Answer 1


You aren't carrying forward your shell environment into the su adm session. so if you echo $PATH in the usracc account and the adm account, you'll find that they aren't equal (which is why adm can't find the updatedb command). All you need to do is tell su that you want to carry forward your env (su -m adm should do it) or just add the path to updatedb.

Though on my box updatedb is called /usr/libexec/locate.updatedb and is a script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .