+ Post New Thread
Results 1 to 7 of 7
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 ...
  1. #1

    Join Date
    Jan 2007
    Location
    The Console
    Posts
    236
    Thank Post
    22
    Thanked 29 Times in 23 Posts
    Rep Power
    22

    Login Hook question

    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!

  2. #2
    kesomir's Avatar
    Join Date
    Mar 2008
    Location
    London
    Posts
    288
    Thank Post
    15
    Thanked 28 Times in 23 Posts
    Rep Power
    18
    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?

  3. #3

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,190
    Thank Post
    299
    Thanked 215 Times in 185 Posts
    Rep Power
    56
    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.

  4. #4
    kesomir's Avatar
    Join Date
    Mar 2008
    Location
    London
    Posts
    288
    Thank Post
    15
    Thanked 28 Times in 23 Posts
    Rep Power
    18
    Don't have a mac :P

    Glad you found a solution though.

  5. #5

    Join Date
    Jan 2007
    Location
    The Console
    Posts
    236
    Thank Post
    22
    Thanked 29 Times in 23 Posts
    Rep Power
    22
    Quote Originally Posted by HodgeHi View Post
    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/<group variable>/<current user variable>/Library/Application Support/Firefox

  6. #6

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,190
    Thank Post
    299
    Thanked 215 Times in 185 Posts
    Rep Power
    56
    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

  7. Thanks to HodgeHi from:

    iSteve (27th August 2008)

  8. #7

    Join Date
    Jan 2007
    Location
    The Console
    Posts
    236
    Thank Post
    22
    Thanked 29 Times in 23 Posts
    Rep Power
    22
    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.

SHARE:
+ Post New Thread

Similar Threads

  1. Disclaimer before login
    By googlemad in forum Windows Vista
    Replies: 2
    Last Post: 30th April 2008, 04:32 PM
  2. reconnect on login
    By brubakes in forum *nix
    Replies: 2
    Last Post: 17th January 2008, 08:10 AM
  3. Login very slow
    By localzuk in forum Windows
    Replies: 7
    Last Post: 23rd April 2007, 03:09 PM
  4. Login Times
    By faza in forum Wireless Networks
    Replies: 12
    Last Post: 18th September 2006, 09:06 AM
  5. CUPS login
    By CyberNerd in forum *nix
    Replies: 6
    Last Post: 4th April 2006, 02:28 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •