Mac Thread, Login Hook question in Technical; Hi,
We're having an issue with a new computer suite with Firefox. We are running Mac OS 10.5.4 and FFox ...
26th August 2008, 01:53 PM #1
Login Hook question
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?
IDG Tech News
26th August 2008, 03:03 PM #2
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?
26th August 2008, 03:58 PM #3
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.
26th August 2008, 04:03 PM #4
Don't have a mac :P
Glad you found a solution though.
27th August 2008, 10:17 AM #5
Thanks - I'll have a look. Do you know if I can use this as a variable? I need to get a script to delete a path like - /Network/Server/mydomain.sch.uk/<group variable>/<current user variable>/Library/Application Support/Firefox
Originally Posted by HodgeHi
27th August 2008, 12:53 PM #6
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
Thanks to HodgeHi from:
iSteve (27th August 2008)
27th August 2008, 02:32 PM #7
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.
By googlemad in forum Windows Vista
Last Post: 30th April 2008, 05:32 PM
By brubakes in forum *nix
Last Post: 17th January 2008, 09:10 AM
By localzuk in forum Windows
Last Post: 23rd April 2007, 04:09 PM
By faza in forum Wireless Networks
Last Post: 18th September 2006, 10:06 AM
By CyberNerd in forum *nix
Last Post: 4th April 2006, 03:28 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)