Active Directory login scripts in Mac OS X - Part 1: Basic Approaches

4 Comments
  1. avatar
    prasanna 5 years ago

    I tried to execute a shell script while logon using login hook. It is working fine for root user. Is it possible to execute the shell script using non-root user.

    I tried with the login items by adding the shell script, but no luck.

    Is there any way to execute shell scripts while logon by non-root users

    0
  2. avatar
    stein 4 years ago

    I discovered that the hook running as root causes problems also. Primarily it changes the permisions and the user can’t see the folder on the desktop any longer because it is only available to root.

    And of course I don’t want to log into the server as root.

    According to this page

    http://support.apple.com/kb/Ht2420

    the short username is in $1 (you have to click more near the top to see it though)

    So I tried a script like
    #!/bin/sh
    su - $1
    txtUSER=$(whoami)
    mkdir /Users/$txtUSER/Desktop/Fdrive
    mount_smbfs //MY_SERVER/sys /Users/$txtUSER/Desktop/Fdrive
    mkdir /Users/$txtUSER/Desktop/Hdrive
    mount_smbfs //MY_SERVER/home/$txtUSER /Users/$txtUSER/Desktop/Hdrive
    KillAll Terminal
    exit

    This script will run (without the su -$1) fine when placed in the users login items.

    Note: To get the shortcuts to show on the desktop the user will need to go to finder -> preferences and check connected servers.

    Hope this helps someone else. Wished I could figure out how to switch users to run this command from the hook.
    --Stein

    0
  3. avatar
    Dave Hauss 5 months ago

    I am searching for a login script of OSX EL CAPITAN so that when a user logs into the MAC using the OSX server and profile manager, the ACTIVE DIRECTORY home folder is automatically mapped to the MAC home folder (documents, etc).  Is there a script somewhere I can use?

     

    Thanks .. Dave

    0
  4. avatar
    Israel 1 month ago

    This is great, but Im having an issue setting up an login item for domain users. I used Script Editor to create an alert message that will pop up when user login. I am using Profile manager to deploy it and run it.. I save the script as an app and placed it in the Applications folder.

    The message I want come up but only for local accounts, domain accounts fail to open it and when i check the apps folder, the application states that it is damaged or not complete. Unsure why when it runs under any local account just fine.

    Any ideas?

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

CONTACT US

Please ask IT administration questions in the forum. Any other messages are welcome.

Sending
© 4sysops 2006 - 2016

Log in with your credentials

or    

Forgot your details?

Create Account