How to quickly lock your Mac

Many Windows users are used to lock their computers with a keyboard combination when they leave their desks, which is a very good practice (not talking about RAM content here, let’s move on!). One thing I’ve got asked a couple of times is how to do the same thing on a Mac, and well the thing is that there are a couple of options to secure your computer when you are away but are not exactly like the Windows.

Because of this I though of writing this article and enumerating  the ways you can accomplish this.

  1. (⌘) + (⌥) + (⏏) : Immediately sleep your Mac.
  2. (⌘) + (⇧) + Q : Then enter to logout gracefully
  3. Close the lid of you laptop. D’oh!
  4. System Preferences –> Mission Control –> Hot Corners… –> Start Screen Saver
  5. /Applications/Utilities/Keychain Access.app –> Preferences –> Show keychain status in menu bar –> Click –> Lock Screen
  6. And finally the last method I learned recently with the help Greg Neagle:
  • Open Automator and create a new Service; A services that receives no input in any application.
  • System Preferences –> Keyboard –> Shortcuts –> Services; Scroll to the bottom, click on add shortcut for your new service and press your desired key combination.

Automator Keyboard

Here the code portion

try
	tell application "Finder" to if exists file "CGSession" of folder "Resources" of folder "Contents" of document file "User.menu" of folder "Menu Extras" of folder "CoreServices" of folder "Library" of folder "System" of startup disk then
		do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"
	end if
end try
Posted in IT and stuff Tagged with: ,

Changes to EX300

Last year I got certified as RHCSA and since then I have been practicing and learning more about managing a RHEL based infrastructure and, some point, in the (near?) future I’d like to get the RHCE certification.

As you may already know Red Hat released RHEL version 7 and with it they updated the requirements for the EX300 exam. There are some obvious changes to the system like the move to systemd, but if you are like me and already have some books and resources for the old RHEL6 what you want to know is what is actually new and mandatory for the new exam.

So for those folks like me that want to polish the new stuff I thought I’d share my notes on the changes I see at first sight, between the old and the new.

EX300

Highlighted in yellow are the new requirements.

Posted in IT and stuff Tagged with: , ,

Relative paths in configuration profiles

Apple wants you to use configuration profiles for setting up your client preferences. And because I don’t want to fight the fruity company I decided that this year I was moving (most) of my first boot scripts and custom plists to config profiles.

One issue I faced and that could not get my head around is that, if you want to set up the users’ Dock with no merging (that is getting rid of Apple default apps) you loose the ability to add user folders. Including the always-useful Downloads folder.

I tried all the combinations with no luck and even though very seriously on going back to fighting the fruit company and keep using non-standard ways of setting the Dock.

Then I found this key

bash-3.2$ defaults read /System/Library/CoreServices/Dock.app/Contents/Resources/en.lproj/default.plist persistent-others
(
        {
        "tile-data" =         {
            arrangement = 2;
            "home directory relative" = "~/Downloads";
            showas = 1;
        };
        "tile-type" = "directory-tile";
    }
)

It was like “home directory relative… Whaaaat?!” (insert your favourite meme)

Correct. That “just works” and looks like it is the official fruity way that has been around since 10.5 and I had absolutely no clue.

Here is the bottom of my Dock.mobileconfig which works perfectly fine

        <key>static-others</key>
        <array>
          <dict>
            <key>mcx_typehint</key>
            <integer>2</integer>
            <key>tile-type</key>
            <string>directory-tile</string>
            <key>tile-data</key>
            <dict>
              <key>arrangement</key>
              <integer>2</integer>
              <key>home directory relative</key>
              <string>~/Downloads</string>
              <key>showas</key>
              <integer>1</integer>
            </dict>
            <key>tile-type</key>
            <string>directory-tile</string>
          </dict>
        </array>
      </dict>
    </array>
  </dict>
</plist>

As one last addition to the post I want to add that if you try to edit a configuration profile you downloaded from your MDM by hand, to do things like this or any similar thing, you will see that the .mobileconfig is 4 lines and is not indented. I did open a bug for this but it was closed because it doesn’t affect functionality. Yeah! it only makes admins their tasks a bit more difficult :S

In case you want to automatically indent the file without breaking the plist just paste the content on this free XML parser from the App Store. It has been a time saver for me

Posted in IT and stuff Tagged with: , ,