Ldap – OS X Mounting Samba shares using logon script – Using Open LDAP

ldapmac-osxmac-osx-serversamba

Is it possible to mount a Samba share at logon using a standard OS X logon script, when using an Open LDAP directory for authentication?

Obviously you can get the username from the $1 variable, but can we temporarily capture the password to mount the share?

The share is to be mounted as the user's home directory, which is stored on the Samba share.

To pre-empt the obvious questions:

  • No we can't use Kerberos
  • We do use network account information in the LDAP schema for certain accounts, but can't here for this machine.
  • Yes we have to use Samba, not AFP/NFS
  • Keychain is no use as it is stored in ~/Library, which is in the very directory (~/) that needs to be mounted.

Best Answer

I understand I'm someway "bypassing" the question, but I'm not sure you have already evaluated alternative approaches.

Alternative approach/suggestion:

  • you can create an alias to the share
  • D&D the alias into the System prefereces -> Accounts -> Login items
  • you can connect and flag the "remember password" option to store it in you login keyring

This way you'll have the share auto-mounted on login, that is what you wanted I hope :)

Note that this is aware of the authentication back-end you use, it is a general solution from this point of view.

Furthermore, I experimented that you can avoid alias creation (that is quite ugly to me) if you can announce your samba share via Bonjour; if it is you can D&D the share without having to create the alias.