Help creating a logout script to delete specific users Keychain

Discussion in 'Mac Programming' started by Miles.Kelly97, Jul 5, 2016.

  1. Miles.Kelly97 macrumors newbie

    Joined:
    Nov 24, 2015
    Location:
    Tunbridge Wells
    #1
    Hi guys


    I was wondering if you could help me out, I have been reading into creating a log out script that will delete a users Keychain.

    I am finding lots stuff saying that login/logout hooks are now deprecated but they are still functional in El Cap.


    However my question is in regards the script itself. I was going to create a logout shell script following the advice from this page http://www.amsys.co.uk/2015/02/delete-keychains-logout/?nabe=5737850786545664:0 but I want to make this specific to one user, I don't want the keychains of our normal users to be affected. This script would be attached to our Freelance account. This would save me time in clearing up after freelancers have used our kit.


    Any advice/help would be much appreciated

    Thanks

    Miles K
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Might it be less hassle to use a guest account for the freelancers?
     
  3. Miles.Kelly97 thread starter macrumors newbie

    Joined:
    Nov 24, 2015
    Location:
    Tunbridge Wells
    #3
    I have thought about using the Guest User account however I have always thought it is a bit risky if they were to bring some work down onto their desktop and to not save it back to the server, once they have logged out we will lost some business critical work...
     
  4. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #4
    I see your point.

    Maybe you could use rsync to synchronise the guest's desktop folder with a folder in /Users/Shared. You could use a launch agent to schedule it, say every hour or whatever?
     
  5. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #5
    Can't you use a conditional statement for this like :

    Code:
    if [ "$USER" == 'freelancer' ]; then
            do your stuff
    fi
     

Share This Page