Faire du mobile sans OSX-Server

Théoriquement, il devrait être possible de faire sous Snow Leopard comme sous Leopard (http://www.supported.de/downloads/make_mobile) pour rendre mobile un compte d’utilisateur normal, avec un simple serveur AFP et non un OSX-Server complet…

Prenons par exemple un ordinateur nommé MacMini qui exporterait ses répertoires d’utilisateur par AFP, et essayons de créer sous OSX un utilisateur mobile pour un $USER, qui sur le serveur aurait le suffixe _mobile pour ne pas perdre des fichiers avant que tout fonctionne bien…

(Le $ signifie une ligne de commande, le # un commentaire)

pastedGraphic.pdf

1. Mark the account as mobile, including its auth

# useless

# defaults write mcxMobility skipAddlEnableCheck 1

$ USER=”myusername”

$ sudo defaults write /Library/Preferences/com.apple.loginwindow mobileAccountActions ‘{ $USER = { archiveDeletedHome = 0; createAtLogin = 1; deleteAtLogout = 0; deleteHomeWithAccount = 0; }; }’

$ UUID=$( dscl localhost -read /Search/Users/$USER generateduid | awk ‘{ print $2 }’)

$ AUTH_AUT=”;LocalCachedUser;/NetInfo/root:$USER:$UUID”

$ dscl localhost -delete /Search/Users/$USER authentication_authority

$ dscl localhost -merge /Search/Users/$USER authentication_authority “$AUTH_AUT”

$ dscl localhost -merge /Search/Users/$USER original_authentication_authority “;ShadowHash;”

$ dscl localhost -merge /Search/Users/$USER preserved_attributes “dsAttrTypeStandard:HomeDirectory” “dsAttrTypeStandard:NFSHomeDirectory” “dsAttrTypeStandard:AuthenticationAuthority”

2. Define how to access the server

$ dscl localhost -merge /Search/Users/$USER original_home “/Network/Servers/MacMini/Users/$USER_mobile”

$ dscl localhost -merge /Search/Users/$USER original_home_loc “<home_dir><url>afp://MacMini/Users</url><path>$USER_mobile</path></home_dir>”

#HomeDirectory is the server export path

#NFSHomeDirectory is the local mount point

#OriginalHomeDirectory is mandatory for login/logout

$ dscl localhost -merge /Search/Users/$USER original_home “/Network/Servers/$FQDN_SERVER$PATH_TO_SHARE_ON_SERVER/$USER”

$ dscl localhost -merge /Search/Users/$USER original_home_loc “<home_dir><url>afp://$FQDN_SERVER/$SHARE</url><path>$USER</path></home_dir>”

$ dscl localhost -create /Search/Users/$USER copy_timestamp `date +%Y-%m-%eT%H:%M:%SZ`

3. Define what mobility means (ie which files are copied)

$ scp osxserver:/System/Library/CoreServices/ManagedClient.app/Contents/Resources/CinchDefaults.plist ~/Library/Preferences/com.apple.HomeSync

#In this file:

#syncedFolders are automatically synced in the background or on request.

#excludedItems are not automatically synced in the background or on #request.

#syncedPrefFolders are only synced at login/logout

#excludedPrefItems are not synced at login/logout

$ plutil -convert binary1 -o ~/Library/Preferences/com.apple.HomeSync.plist ~/Library/Preferences/com.apple.HomeSync

$ rm ~/Library/Preferences/com.apple.HomeSync

4. Add the client menu icon

Double click on /System/Library/CoreServices/Menu Extras/HomeSync.menu to add the menu item.

  1. Start the sync

Should works ??

pastedGraphic_1.pdf

Personellement, je me suis arrêté à ce simple essai, vu que j’ai OSX-Server, et qu’il ne fonctionne pas si mal – excepté bien sur les pertes de synchronisation qui font que les fichiers créés sur le client ne sont pas rajoutés sur le serveur !

À titre d’exemple, voici le CinchDefaults.plist pour mieux comprendre les valeurs par défaut sous Snow Leopard.

En voyant ça, j’ai rajouté dansexcludedItems : ~/.bash_history ~/.dropbox ~/Dropbox et ~/.ssh

pastedGraphic_2.pdf

<?xml version=”1.0″ encoding=”UTF-8″?>

<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd“>

<plist version=”1.0″>

<dict>

<key>excludedAlways</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/FileSync</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Mirrors</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Logs/MirrorAgent.log</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Logs/FileSyncAgent.log</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.FileSyncUI.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.homeSync.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.mcxMenuExtras.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.account</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Cleanup At Startup</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.FileSync</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.fseventsd</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.mcxlc</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Spotlight-V100</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.TemporaryItems</string>

</dict>

<dict>

<key>comparison</key>

<string>is</string>

<key>value</key>

<string>.com.apple.timemachine.supported</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>.afpDeleted</string>

</dict>

</array>

<key>excludedItems</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.SymAVQSFile</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trash</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trashes</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Documents/Microsoft User Data</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/NAVMac800QSFile</string>

</dict>

</array>

<key>excludedItems-10.4.3</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trash</string>

</dict>

</array>

<key>excludedPrefItems</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.SymAVQSFile</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trash</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trashes</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Documents/Microsoft User Data/Entourage Temp</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Application Support/SyncServices</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Application Support/MobileSync</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Caches</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Calendars/Calendar Cache</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Logs</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Mail/AvailableFeeds</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Mail/Envelope Index</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/Macromedia/Flash Player</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Printers</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/PubSub/Database</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/PubSub/Downloads</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/PubSub/Feeds</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Safari/Icons.db</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Safari/HistoryIndex.sk</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/iTunes/iPhone Software Updates</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>IMAP-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>Exchange-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>EWS-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>Mac-</string>

</dict>

</array>

<key>excludedPrefItems-10.4.3</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Application Support/SyncServices</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Caches</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Logs</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/ByHost</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Printers</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Safari/Icons</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>IMAP-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>Mac-</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.dock.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.iChatAgent.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.sidebarlists.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/com.apple.systemuiserver.plist</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Preferences/loginwindow.plist</string>

</dict>

</array>

<key>excludedPrefItems-10.5</key>

<array>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.SymAVQSFile</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trash</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/.Trashes</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Application Support/SyncServices</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Caches</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Logs</string>

</dict>

<dict>

<key>comparison</key>

<string>fullPath</string>

<key>value</key>

<string>~/Library/Printers</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>IMAP-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>Exchange-</string>

</dict>

<dict>

<key>comparison</key>

<string>startsWith</string>

<key>value</key>

<string>Mac-</string>

</dict>

</array>

<key>syncedFolders</key>

<array>

<dict>

<key>path</key>

<string>~</string>

</dict>

</array>

<key>syncedPrefFolders</key>

<array>

<dict>

<key>path</key>

<string>~/Library</string>

</dict>

<dict>

<key>path</key>

<string>~/Documents/Microsoft User Data</string>

</dict>

</array>

</dict>

</plist>

Advertisements

About guylhem

guylhem.com
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s