iSteve Posted August 26, 2008 Posted August 26, 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!
kesomir Posted August 26, 2008 Posted August 26, 2008 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?
HodgeHi Posted August 26, 2008 Posted August 26, 2008 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.
kesomir Posted August 26, 2008 Posted August 26, 2008 Don't have a mac Glad you found a solution though.
iSteve Posted August 27, 2008 Author Posted August 27, 2008 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. 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///Library/Application Support/Firefox
HodgeHi Posted August 27, 2008 Posted August 27, 2008 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... 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... Don't know if this is indeed an issue? 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 1
iSteve Posted August 27, 2008 Author Posted August 27, 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now