iSteve (27th August 2008)
Hi,
We're having an issue with a new computer suite with Firefox. We are running Mac OS 10.5.4 and FFox 3. When a user logs in and launches FFox, they are told that a session is already running and FFox quits. We have found that if you delete the user's FFox Profile folder (inside ~/Library/Application Support/) FFox will open and work perfectly.
I have thought that we can use a LoginHook to delete the user's FFox profile on log in. However, the user does not have permission to run the script as themselves, but, if I run the script as root (which is what LoginHooks run as), the "current user" variable $1 becomes root, so the script tries to delete root's profile folder!!
Does anyone know how to run a script as root, but return the current logged in user as a variable? Also, does anyone know what the unix variable is to find the group of the current logged in user?
Thanks!
there's getgid and getuid to return the groupid and userid of the process, and there's also getegid to return the effective group of the process.
Not sure how to return a logged in user though, as you can have many.
What about running a script as the user and outputting to a file which you read in the other script?
Just looked on this site:
OS X commands
It lists a command "logname".
I checked it out and it does indeed return the name of the user logged in.
Whether its useful to you or not is a different matter.
Don't have a mac :P
Glad you found a solution though.
I've just come across this site which suggest that another user is trying to get the username into a variable ($1) Halfway down there is this statement...
Don't know if this is indeed an issue?Is the login hook being run on a local account? I seem to remember reading about login hooks breaking in 10.5 because of new issues with $1 failing to be passed to the script with network accounts, whereas everything works fine for a local account...
Here's the rest of the thread. Someone posted a possible script at the end to get the username variable. I have not confirmed it though.
Get user name from login script in 10.5 [Archive] - The macosxhints Forums
iSteve (27th August 2008)
Thanks for this. It's something I will look in to.
I've managed to solve my problem a different way though. We have a "unique" network set up which I have inherited this summer. The rogue Firefox profile folders were leftovers from a previous network set-up and were clashing in some way. I have just searched and deleted them from our homefolder servers en-mass. All our user accounts work fine now.
There are currently 1 users browsing this thread. (0 members and 1 guests)