Skip to main content

Posts

Remove Contents of a distribution package

Yesterday I got a request to create a VPN AnyConnect package where client asked to remove some of the contents from the file and repackage it with the preconfigured server settings. This is what it looked like: Clients demand was to remove 'Web Security', 'Diagnostic and Reporting Tool' & 'Posture' leaving only VPN in the package. So there are again, two options, take a snapshot using FileWave or Casper and create the package, which any kid can do or try the more advance way of doing it. There is an advance way of doing this - Flatten the package make the changes and Unflatten it again. Steps: 1. Run the command to open the package using  pkgutil 2. Make the changes, delete the unwanted stuffs (the selected ones in this example) 4. Just leave the VPN items: 5. Check if there is anything else the is requested by the client or something under cleanup activity. In this specific example you need to modify the Distibution file. Have a glance at this file and you ...

Using the uninstall command

To uninstall an Application dowloaded from App Store, what we used to do is create a script to locate and delete all the files of the specific app from the different folders and delete them. For others, easiest way was to delete the application from /Applications folder. Recently someone discovered that  uninstall  command is something that Apple has provided since 10.8 but kept undocumented. So how it works: sudo uninstall /Application/Xcode This will ask for admin credentials in CLI & GUI, take a while and uninstall the application. What you need to know about this is if you have packaged the App in question from App Store, then uninstaller would not be able to do the job. Reciept files if missing uninstaller is not able to uninstall the Application. However there is no reason why would you not keep the reciept files after repackaging. In upcoming posts, I will talk about repackaging apps from App Store and disclose mystery of Reciepts & bom.

How to create OS X image for deployment

Although there are various tools that works successfully but I would want to cover one at a time. This image creation is done for NetInstall or NetRestore purpose, that means, after doing a netboot, you can use this image to install a fresh OS on your Mac. Its simple, its quick and all you need to know is how to use mouse. Before you begin, make sure that the current running OS and the OS you want to build should be same. Lets begin :) What you need: OS X 10.9 from App Store (well, any OS you want). Steps are given in other post  here . AutoDMG  app from this  link Simple Steps: Launch AutoDMG. There is nothing to install. The downloaded file can be double clicked to open and then double click on AutoDMG icon. Drag the Install OS X Mavericks.app (you had downloaded from App Store) on AutoDMG. It will examine the files and then show you the list of updated available for this version. Select if you want to install all updates. If done, it will download it online and add in ...

How To: Fix ShellShock on All Versions of OS X

Apple's Willinglessness to Help Customers: Apple has released security update to handle ShellShock for three major OS versions that are most stable. They are 10.7.5, 10.8.5 and 10.9.5. This means if you are running any other version, Apple is not intereseted to help you. Well, if you are an optimist, you can say Apple wants you to upgrade your OS to one of the most reliable updates for Lion, Mountain Lion or Mavericks. The problem here is that there are thousands of users who dont have those versions. Also, there are few developer's and advance admins who are running 10.10, like I do how will they fix it? Well, this post is dedicated to everyone who is running any other version apart from 10.7.5, 10.8.5 & 10.9.5. If you own one of these, you can refer to Apple link to download and install the tiny updates. It would not ask you to reboot the Mac. https://support.apple.com/kb/DL1769  - Mavericks (10.9.5 and above) https://support.apple.com/kb/DL1768  - Mountain Lion (10.8.5)...

How To: Trace a Packet on WiFi using OS X

If you dont know what would be the use of this article and what can be done by tracing packets, then probably this article is not for you. :) So lets begin! Find out what is the BS Device ID of your WiFi by going to System Profiler. Let me grab a screenshot here: Now lets use the command  tcpdump  to get what we are looking for. Also, there is another command  airport  to do similar job but we will cover details of that tool in upcoming post. sudo tcpdump -i en0 -s 0 -B 524288 -w ~/Desktop/TracePacket1.pcap It should display the details as - tcpdump: Listening... Once this is complete, close down the process. You have a TracePackage.pcap ready with the packets. Now we need to read what has it got. So we will leverage tcpdump again: tcpdump -s 0 -n -e -x -vvv -r ~/Desktop/TracePacket1.pcap Using this you can do network troubleshooting, debug a network problem. If you find yourself dumb enough to do this, you have some helpers out there, watch out for these tools, the...

How To: Bash Script to add AD User & Group to SSH in Mac

Today morning I got a request from Green IT folks to enabled SSH on all the Macs that we have in Enterprise. Currently SSH is not enabled on clients and not even the Admins are allowed to do so. As it was against InfoSec policy of the client, they needed a solution that ensures SSH is not enabled for anyone except couple of Service Accounts that does background job. So what I proposed was simple, to create a Security Group in AD and add all Service Accounts to that Group and grant SSH access to that group. Now, no one else will be able to access via SSH except the members of this group. So here is what I wrote for them. In this script Joulix is the AD account and HM Admin Mac SSH is the AD group that needs SSH access.:   #!/bin/bash   # To add the User / Group to be able to do ssh. # Created by Laeeq Humam | 10.10.2014 | for HCL # Wrote for Green IT via Cisco Joulix. UN="Joulix" MACSSHGROUP="Admin Mac SSH" # Will use this group and user probably once or twice. Varia...

Tips: How to List Folder Size on Mac

  Hello Again! I have 99 folders inside /Documents/Scriptology/ and I wanted to see the size of all folders and see what can I delete from there. Unfortunately, by default, Finder does not show you size of a Folder on Mac. So had to find out alternative to get the information. Its pretty simple command that unix folks already know. Try this:  du -sh /Users/laeeqhumam/* | sort -n Very practical and very useful, you will get the information as the image below:

Tip: Get more info on WiFi by a click

If you ever, for any reason wanted to get more information and do a network diagnostic of your WiFi connection, you can do it just by a click. Hold down Option key and click / tap on WiFi option in the menu bar at the top. It would show you following window: You can see details of the WiFi network you are connected and also would give you option to 'Open Wireless Diagnostics' at the bottom of the menu.

How To: Delete Cache in Safari - Only Cache

So, if you already know about Safari, you might be knowing how to Reset Safari and probably that's how you delete the cache while troubleshooting. Right? Well, lets learn beyond this. Let the Helpdesk do Reset Safari for deleting Cache. Today we will cover the advance and more accurate ways that will just delete the Cache and not touch anything else. Let's begin: Launch Safari Go to Safari Menu > Preferences Under Advanced tab you will see a check box for Show Develop in menu bar Close this and go to Develop menu and select Empty Cache - you are done. Let me know if you need screenshot for this post :) If you want to take this Cache deleting thing to the next level, I have more to show you. Navigate to this location:  /Users/Library/Cache/com.Apple.Safari/Cache.db This Cache.db file should be trashed and there would not be any cache left over. Relaunch Safari and it will create a new Cache.db file. Drop a line if you are interested in learing more about handling Cache on Mac...

How To: Sleep, Restart & Shut Down using Terminal

I will make this a quick post with three options of  shutdown  command. There are different command for this purpose but  shutdown  is cool to remember. In order to shutdown, type the following command: sudo shutdown -h now On enter it will begin the shutdown process. It is a rather severe shutdown process. It will not tell you to save documents if they are open. You can replace the word ‘now’ with a time in the 24 hour format. To restart use the following command: sudo shutdown -r now To put your Mac to sleep use the following: sudo shutdown -s now You can do more by entering time in 24hrs format. Do a  man shutdown  to learn more.