Configure TextEdit To Save Files As Plain Text

Set plain text in TextEdit as the default format to save files in using the defaults command to write the RichText key into as an integer of 0, as follows: defaults write RichText -int 0 To remove the key: defaults delete RichText

Manage File Shares In OS X Yosemite Server

File Services are perhaps the most important aspect of any server because file servers are often the first server an organization purchases. This has been changing over the past few years, with many a file being hosted by cloud solutions, such as Box, Dropbox, Google Drive, and of course, iCloud. But many still need a terrestrial server and for predominantly Apple environments, a Server app running on OS X Yosemite isn’t exactly a bad idea. There are a number of protocols built into OS X Yosemite Server dedicated to serving files, including AFP, SMB and WebDAV. These services, combined comprise the File Sharing service in OS X Yosemite running the Server app. Note: I’ve got another article looking into FTP a little further but those are basically what I’ll stick to here. File servers have shares. In OS X Yosemite Server we refer to these as Share Points. By default: • File Sharing has some built-in Share Points that not all environments will require. • Each of these shares is also served by AFP and SMB, something else you might not want (many purely Mac environments might not even need SMB). Or if you have iOS devices, you may only require WebDAV sharing. • Each share has permissions that Apple provides which will work for some but not all. In short, the default configuration probably isn’t going to work for everyone. Therefore, before we do anything else, let’s edit the shares to make them secure. The first step is to create all of your users and groups (or at least the ones that will get permissions to the shares). This is done in Server app using the Users and Groups entries in the List Pane. Once users and groups are created, open the Server app and then click on the File Sharing service in the SERVICES list in the List Pane. Here, you will see a list of the shares on the server. Files1 If you’re just getting started, let’s go ahead and disable the built-in share by clicking on Groups in the list of shares and then clicking on the minus button on the screen. As mentioned, shares can be shared out using different protocols. Next, we’re going to disable SMB for Public, simply as an example. To do so, double-click on Public and then uncheck the SMB protocol checkbox for the share. Files2 When you’ve disabled SMB, click on the Done button to save the changes to the server. Editing shares is really that easy. Next, we’re going to create a new share for iPads to be able to put their work, above and beyond the WebDAV instance automatically used by the Wiki service. To create the share, first we’re going to create a directory for the share to live in on the computer, in this case in the /Shared Items/iPads directory.


Then from the File Sharing pane in Server app, click on the plus sign (“+”).


At the browse dialog, browse to the location of your iPad directory and then click on the Choose button. Files5 At the File Sharing pane, double-click on the new iPads share. Note that there’s a new checkbox here called Encrypt connections. If you check this, you cannot use AFP and WebDAV. Files6 At the screen for the iPads share, feel free to edit the name of the share (how it appears to users) as it by default uses the name of the directory for the name of the share. Then, it’s time to configure who has access to what on the share. Here, use the plus sign (“+”) in the Access section of the pane to add groups that should be able to have permission to access the share. Also, change the groups in the list that should have access by double-clicking on the name of the group and providing a new group name or clicking on the plus sign to add a user or group. Files7 The permissions available in this screen for users that are added are Read & Write, Read Only/Read and Write. POSIX permissions (the bottom three entries) also have the option for No Access, but ACLs (the top entries comprise an Access Control List) don’t need such an option as if there is no ACE (Access Control Entry) for the object then No Access is assumed. If more granular permissions are required then click on the name of the server in the Server app (the top item in the List Pane) and click on the Storage tab. Here, browse to the directory and click on Edit Permissions. Files8 As can be seen, there are a number of other options that more granularly allow you to control permissions to files and directories in this view. If you make a share a home folder, you can use that share to store a home folder for a user account provided the server uses Open Directory. Once a share has been made an option for home folders it appears in both Workgroup Manager and the Server app as an available Home Folder location for users in that directory service. Once you have created all the appropriate shares, deleted all the shares you no longer need and configured the appropriate permissions for the share, click on the ON button to start the File Sharing service. Files9 To connect to a share, use the Connect to Server dialog, available by clicking Connect to Server in the Go menu. A change that happened back in Mavericks is that when you enter an address, the client connects over SMB by default (which is even better now that those connections can be encrypted). If you’d like to connect via AFP ‘cause you’re all old school, enter afp:// in front of the address and then click Connect. The File Sharing service can also be controlled from the command line. Mac OS X Server provides the sharing command. You can create, delete and augment information for share points using sharing. To create a share point for AFP you can use the following command: sharing -a -A So let’s say you have a directory at /Shares/Public and you want to create a share point called PUBLIC. You can use the following command: sharing -a /Shares/Public -A PUBLIC Now, the -a here will create the share for AFP but what if you want to create a share for other protocols? Well, -F does FTP and -S does SMB. Once created you can disable the share using the following command: sharing -r PUBLIC To then get a listing of shares you can use the following command: sharing -l You can also use the serveradmin command to manage file shares as well as the sharing service. To see settings for file shares, use the serveradmin command along with the settings option and then define the sharing service: sudo serveradmin settings sharing Sharing settings include the following: sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbName = "iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:afpIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:webDAVName = "iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbEncrypted = no sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbDirectoryMask = "0755" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:afpName = "iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbCreateMask = "0644" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:nfsExportRecord = _empty_array sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:path = "/Volumes/Macintosh HD/Shared Items/iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbUseStrictLocking = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbIsGuestAccessEnabled = no sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:name = "iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbInheritPermissions = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:ftpName = "iPads" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbIsShared = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:afpIsShared = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:smbUseOplocks = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:webDAVIsShared = yes sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:dsAttrTypeNative\:sharepoint_group_id = "E500829F-6589-4A34-9D3B-C7FDC71400B4" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:mountedOnPath = "/" sharing:sharePointList:_array_id:/Volumes/Macintosh HD/Shared Items/iPads:isIndexingEnabled = no To see settings for the services use the serveradmin command with the settings option followed by the services: afp and smb: sudo serveradmin settings afp AFP settings include: afp:maxGuests = -1 afp:afpTCPPort = 548 afp:clientSleepTime = 24 afp:replyCacheQuantum = 32 afp:maxConnections = -1 afp:sendGreetingOnce = no afp:reconnectTTLInMin = 1440 afp:clientSleepOnOff = yes afp:loginGreeting = "" afp:errorLogPath = "/Library/Logs/AppleFileService/AppleFileServiceError.log" afp:errorLogTime = 0 afp:activityLogTime = 7 afp:errorLogSize = 1000 afp:kerberosPrincipal = "afpserver/LKDC:SHA1.5776019F497F854DBA581884DE3A1AC7BBF69E22@LKDC:SHA1.5776019F497F854DBA581884DE3A1AC7BBF69E22" afp:recon1SrvrKeyTTLHrs = 168 afp:idleDisconnectOnOff = no afp:reconnectFlag = "no_admin_kills" afp:activityLog = yes afp:reconnectKeyLocation = "/private/etc/AFP.conf" afp:loginGreetingTime = 1315436086 afp:adminGetsSp = yes afp:fullServerMode = yes afp:idleDisconnectMsg = "" afp:updateHomeDirQuota = yes afp:activityLogPath = "/Library/Logs/AppleFileService/AppleFileServiceAccess.log" afp:authenticationMode = "standard_and_kerberos" afp:admin31GetsSp = no afp:shutdownThreshold = 3 afp:TCPQuantum = 1048576 afp:allowSendMessage = yes afp:idleDisconnectTime = 10 afp:loggingAttributes:logOpenFork = yes afp:loggingAttributes:logDelete = yes afp:loggingAttributes:logCreateDir = yes afp:loggingAttributes:logLogin = yes afp:loggingAttributes:logLogout = yes afp:loggingAttributes:logCreateFile = yes afp:tickleTime = 30 afp:specialAdminPrivs = no afp:noNetworkUsers = no afp:idleDisconnectFlag:adminUsers = yes afp:idleDisconnectFlag:registeredUsers = yes afp:idleDisconnectFlag:usersWithOpenFiles = yes afp:idleDisconnectFlag:guestUsers = yes afp:recon1TokenTTLMins = 10080 afp:guestAccess = yes afp:allowRootLogin = no afp:activityLogSize = 1000 afp:afpServerEncoding = 0 afp:createHomeDir = yes To see a run-down of some of the options for afp, see this article I did previously. Additionally, for a run-down of smb options, see this one.

Changes in Mountain Lion Server

Mountain Lion Server is now available on the OS X App Store and as with the last few updates there are some things missing that you might be expecting and depending on. First up, three major services are gone: Podcast Producer, RADIUS and dhcp. You can still do dhcp as you always did with OS X client as those features work on OS X Server, but the more granular controls available in OS X Server are now gone. The biggest impact of dhcp is probably in testing NetBoot services when there are network issues and you need to prove to network admins that it’s the network and not your server… I had written an article before about FTP still being in OS X Server from the command line, but now it’s back in the GUI, which should make many an administrator happy. NAT is also gone from the GUI, but natd and natutil are still available from the command line. Might as well just use the Sharing System Preference pane for such things though… Server Admin is now gone (long live Server Admin!) and Workgroup Manager is now a download to be performed and installed following installation. Support for Managed Preferences is gone, even though most manifests technically still work. Many services also got some pretty nice updates. These include:
  • Calendar – There are a few updates on the client side, but not on the server side. Most notably, the option to publish calendars is now gone. If you used that, it’s time to get used to manually exporting, copying to a share and then distributing links. This is going to likely cause more use of the Calendar server itself, to some degree. Also, it’s not iCal or iCal Server, it’s now Calendar and Calendar server. Seems to me that this isn’t obviously an Apple-centric naming structure as with most other things they do, but sometimes you’re gonna’ have that…
  • Contacts – Nope, it’s not called Address Book server, it’s the Contacts service. Same with the client side application.
  • DNS – DNS management is moved into the Server application. You can also now restrict who you do lookups for in the GUI. Under the hood very little changes.
  • File Sharing – Nothing really changes with file sharing, except the wiki integration described in the Wiki section in a little bit.
  • Firewall – The firewall option is gone, as is the ipfilter at the command line, but pf is easy to configure from the command line.
  • FTP – It’s a quick and easy single share solution from the GUI. Using the sharing command there’s still tons available to administrators.
  • Mail – Authentication mechanisms and domains are in the GUI, but very little changes otherwise.
  • Messages – The service name has changed from iChat to Messages in the GUI but is still jabber from the command line. The big change with this service is that the client side is now able to leverage iCloud to instant message mobile devices as well. Therefore, the text messaging component is client-side and has no impact on the jabber service itself.
  • NetInstall – The “NetInstall” service is NetBoot. It can host NetRestore or NetInstall images, but the heavy lifting for that stuff is done in System Image Utility. And the output of the SIU commands are now more scriptable through the automator command line interface. The NetInstall screen is now in Server app and is a good port from Server Admin in that it’s similar in look and feel to the NetBoot screen in Server Admin. A feature that isn’t in the GUI is diskless NetBoot, which is fine because I documented how to do it when I realized it would be an issue for a few customers.
  • Open Directory – Given that Server Admin is gone, something had to happen with Open Directory. The Open Directory screens have been moved to Server app where it’s fast to setup and tear down Open Directory. Open Directory based Users and Groups are also created through the Server App, although Workgroup Manager can be downloaded and used still. Immediately following upgrades, the add and remove users buttons are gone for previously stand-alone hosts. Also the Manage Network Accounts option is now gone from Server app, replaced with the traditional ON button supplied by Apple for other services.
  • Profile Manager – This deserves its own post, which is in the queue, but suffice it to say that while you can’t tell when looking in Server app, there are a number of upgrades to Profile Manager.
  • Software Update – Management of the service is moved from Server Admin to Server app. There are now fewer options in the GUI, but the same in the command line. Cascading is a little different.
  • Time Machine – Time Machine server is the same… The versions option from the Time Machine Server preference pane is gone and the layout is a little changed, but the server component is identical in functionality as well as look and feel.
  • VPN – Unless you add another supported VPN protocol there’s not much to do after fixing most issues in 10.7.4. Except fixing the last issue with search bases, seemingly resolved as it’s working for me pretty well.
  • Websites – There are more options in the GUI for new sites. The default site appears twice (once for 80 and once for 443), but there are more options, such as the Web App functionality that comes with a default Python “Hello World” app. Also the server is still called web from the serveradmin command line, but is now called Websites through the GUI.
  • Wiki – The wiki has themes again, although they’re just color schemes. And you can create your own custom banners and upload, which brings back two of the most common feature requests from people that hack the look and feel of the wiki in versions previous to Lion. But the most substantial aspect of the Wiki to change to me is the document management options, available to users in WebDAV or through the portal. This allows for a very mobile-friendly file management tool. Blogs and wikis for the most part stay the same and have a very clean upgrade process from Lion. The command line tools also feature some new options for indexing, etc., which many will find helpful.
  • Xsan – cvadmin, cvlabel, cvversions, etc are now stored in /System/Library/Filesystems/acfs.fs/Contents/bin/ and Xsan has its own entry in the Server app. Despite hearing people question its future, I’ve never seen as many questions flying around about how to do things with Xsan than I do now. Storage sales are up, monkey chatter on the web is up, deployments are being booked and Xsan looks here to stay. The Server app only really shows you a status of things, but the Xsan Admin app is now embedded in the Server app and available through the Server app Tools directory.
Configuring Websites in Server app
The Alerts options are much more robust in Mountain Lion than they were previously. You  can now get alerts on a myriad of things, incuding certs, disks, space, storage quotas, virus detection, network changes and software updates.
Configuring Alerts in Mountain Lion Server
The Server commands also moved and in fact the whole file and folder structure mostly fit nicely inside of the Server app. There are certain things that haven’t been dealt with in this regard such as NetBoot’s library, but for the most part Apple is getting Server to the point where it’s very self-contained. The ramification of which is that upgrades for future releases (and from Lion to Mountain Lion for that matter) are much simpler. Simply downloading a new version informs administrators that the app has been replaced and is good to go, service data in tact. In real world, this has been a little hit or miss but should prove to make our lives much easier in the future. Reducing scope, aligning with better development practices and all the work to merge all of the remaining services into Server app are huge undertakings. I would fully expect no further support or updates to Workgroup Manager, no more testing of managed preferences in deference to profiles and a few other culture shifts that still need to shake themselves out. Most of us are going to seem underwhelmed (if that’s a word, no it’s not ’cause I looked it up -> awesome video below --> ’cause affection has 2 fs, especially when you’re dealin’ with me). But here’s the thing, with an incremental update, you’re not going to get massive changes. Instead we will get slow and steady updates hopefully continuing to build faster towards a better end goal. What’s important is that the foundation is actually better now, given changes to other parts of OS X and so Server is likely now better positioned than ever for great new features in subsequent releases.
Oh, and did I forget to mention that Xgrid is gone. I guess no one really noticed anyway…

More Collaboration (Teams) Customizations

The article I did a few weeks ago on customizing the Mac OS X Server Wiki banner seems to have been a little incomplete. I discussed customizing the banner for a full web browser. However, the banner looks differently when viewed from an iPhone. I’ve had a couple of questions about how to customize the banner for iPhone so I figured I’d finish what I started. As I mentioned in the last article, you can simply customize (or replace) the banner-bg.png file located in the /usr/share/collaboration/css/serverhome_static/img directory. This will alter the appearance when viewed from a full web browser. You can also simply edit the following files (same directory) to further alter the appearance (including those for iOS):
  • footer-bg.png – The Apple logo on the initial splash page.
  • iphone-banner-bg.png – The banner file to customize for when users are accessing the splash page from iPhone rather than the browser (what this article was originally about). As with the last article, here’s a sample ArtText document for customizing the banner.
  • iphone-footer-bg.png – The footer image from iPhone.
  • iphone-service-button.png – The background for services from iPhone (tip: make sure to leave something in place of the little blue arrows so people know to click on these).
  • iphone-service-icons.png – Smaller version of the service-icons.png, without reflection (Note: you may have seen clips of these in presentations I have done).
  • more-bg.png – The arrow beside the View All per service on the opening page.
  • service-bg.png – The background for the various services you have enabled on the initial landing page.
  • service-icons.png – collection of the service icons that indicate what an item is. These include the icon for blog, wiki, mail, change password, Podcast Producer and iCal. While these may seem generic I have to give the designers who made them credit as I have yet to make anything approaching the quality of these so I almost invariably leave them as-is.
If you want to increase from 320px width for iPhone to 640 for iPad or something like that you’ll need to track down the css files. The css file for the iPhone is in the /usr/share/collaboration/css/serverhome_static directory and called (oddly enough) iphone.css. The css file for overriding body content for standard browsers is the overrides.css in that same directory. These allow you to customize font, text size, background, etc. The iphone css even has a different section for landscape view. If you want to get even more custom than just messing around with the splash page then go up another directory to /usr/share/collaboration/css. Here, you’ll find images and css files for each of the services exposed through the teamserver, including proxy, mobile, ical, emailrules and directory, including one of my fav 5, spinner.gif (seen below), which is a spinning symbol similar to that used at boot in Mac OS X. If you like living on the edge (no pun intended) then you can hop up yet another directory and start messing around with live html files. Or in the /usr/share/collaboration/themes you can find the css files and images that make up the default Apple-supplied themes. Apple provides a document on managing the themes, but the gist is that you can copy the wireframe theme you find there and rename the copy. Then open the theme.plist file inside the theme and find the selectable key, making it true instead of false. Once you’ve saved that file, restart the service to see (and use) your new theme. There are lots of other cool keys in the theme.plist, which allow you to add or remove the search fields, HotList, theme name (and displayName), change the height or width of the banner, add other sidebar items, etc. It’s not WordPress so don’t expect to download awesomeo widgets, but then it’s much more elegant than most Content Management Systems are out of the box and should just work. This isn’t to say it isn’t extensible. You can add JavaScript and XSL (ie – for FileMaker Server integration), but this can start getting somewhat complicated. One interesting note is that much of the Dashboard widget example code will run here… Be warned, with each level of the hierarchy you traverse upwards you are more likely to find a software update blowing out your code changes (especially when you get to /usr;). Which brings up an interesting point – backup your changes. Make a good backup of the whole thing before you start hax0ring around in there and then, make sure that if you do any customizations in /usr/share/collaboration that you back up that directory (I mean, you are backing up the rest of the server, right?!?!). The other directory that needs to be backed up is /Library/WebServer. This is where the actual HTML pages are stored. In here, you’ll find the Documents folder, and in there you’ll find the index.html page. If you’ve been monkeying around with the files I mentioned earlier then a key item that you’re going to want to change is the footer, where Apple asserts their copyright. This is down in the div class=”footer” section. You can also use this file to manually disable certain services. For example, you’ll see the podcastcapture section. Now, you would likely rather remove these from Server Admin if you can, but I can see edge cases (doh, again no pun intended) where you might rather edit it here. There are also some css files in here to control various ways that pages appear (although the appearance inside service boxes is configured using the files referenced earlier). Anyway, I want to end this by saying that out of the box the Wiki, Blogs, Podcast Producer (if you’re using Open Directory) and other parts of the teams server works great out of the box. It’s pretty sleek as it is and other than a footer or banner here and there I’m actually not a huge proponent of heavy customization. But if you must (and many must) then hopefully this article helps get ya’ started!