Someone hands you a USB drive. You put it in your computer and you can’t access anything on it. You are running an imaging lab and you want to backup or troubleshoot a device before you re-image it, but you can’t access certain files. Obviously, you can sudo. But, you can also simply disable permissions on that volume (which, like getting someone to make you a sandwich, requires sudo of course).
The command used to enable and disable permissions on a volume is vsdbutil, located at /usr/sbin/vsdbutil. And there’s a LaunchDaemon at /System/Library/LaunchDaemons/com.apple.vsdbutil.plist that interacts with diskarbitrationd so that when a volume is mounted, it is marked as having permissions activated or deactivated (which is basically “Ignore Permissions” at the Finder).
To use vsdbutil to enable “Ignore Permissions”, use the -d flag followed by the path to the volume:
sudo /usr/sbin/vsdbutil -d /Volumes/Myvolume
To then enable (or activate, thus the a) permissions again, use the -a flag:
sudo /usr/sbin/vsdbutil -a /Volumes/Myvolume
You can also run the -c to see the status for a given path:
sudo /usr/sbin/vsdbutil -c /Volumes/Myvolume
And last but certainly not least if you’re working on a lot of volumes, the -i option will enable permissions on all mounted HFS and HFS+ volumes:
sudo /usr/sbin/vsdbutil -i
Overall, it’s very easy to send these commands using a positional parameter (e.g. $1) to a script, performing a mount, some operation (backup, reimage, restore, repair some corrupted data, etc).
Note: You can’t Ignore Permissions of FAT or FAT32 volumes using the command line or a Finder Get Info screen.
krypted December 1st, 2015
I bet you thought this would be the article where I showed you how to make your computer curse more. Well, language can mean much more than that. In fact, Apple has dedicated a whole binary to switching your default language in OS X, in languagesetup. This command, located at /usr/sbin/languagesetup, is capable of changing the default language used by a system to a number of different languages. There are other ways to accomplish this, but none quite so easy. To get started, note that there are two ways to run languagesetup. The first is interactively, which I mostly use to figure out what I actually want to do with it. The second is using a standard command prompt, which I use for scripting.
Let’s start with the interactive. Simply run the command with no operators/verbs/whatevers:
This outputs a list of the languages that can be used in this way. Note that number 7 is Spanish.
WARNING: root access required to change system language
1) Use English for the main language
2) Utiliser le français comme langue principale
3) Deutsch als Standardsprache verwenden
7) Usar español como idioma principal
8) Usa l’italiano come lingua principale
9) Gebruik Nederlands als hoofdtaal
10) 주 언어로 한국어 사용
11) Usar português do Brasil como idioma principal
12) Usar o português europeu como idioma principal
13) Brug dansk som hovedsprog
14) Käytä pääkielenä suomea
15) Bruk norsk som hovedspråk
16) Använd svenska som huvudspråk
17) Сделать русский язык основным языком системы
18) Użyj polskiego jako języka głównego
19) Ana dil olarak Türkçe’yi kullan
20) استخدام اللغة العربية كلغة رئيسية
22) Vybrat češtinu jako hlavní jazyk
23) Magyar kiválasztása alapértelmezett nyelvként
24) Seleccioneu el català com a idioma principal
25) Odaberite hrvatski kao glavni jezik
26) Επιλέξτε Ελληνικά ως την κύρια γλώσσα
27) בחר/י עברית כשפה ראשית
28) Selectați româna ca limbă principală
29) Vybrať slovenčinu ako hlavný jazyk
30) Вибрати українську основною мовою
31) Gunakan Bahasa Indonesia sebagai bahasa utama
32) Gunakan Bahasa Melayu untuk bahasa utama
33) Sử dụng Tiếng Việt làm ngôn ngữ chính
34) Utilizar español de México como el idioma principal
At this point, you could just use the number 7 key (if we were root) and switch the default language of the system to Spanish. But, we’re going to go ahead and do that in a non-interactive fashion, using the langspec option:
sudo languagesetup -langspec 7
Or to switch it back, note that English is first:
sudo languagesetup -langspec 1
krypted November 30th, 2015
Many devices die the day their warranty expires, but my trusty Apple Airport that carries wireless signal to my drums lasted forever. OK, not forever, But let me tell you, music notes can visibly be seen traveling through the air to get to me when I’m on those drums and that Airport is beaming Spotify or Apple Music to me. And this Airport, it just kept huffing and puffing along. For 6 years, as though to say, “I must be worth more per day of use that that craptastic Linksys the neighbor spent $40 on.” It’s a pride thing, ya’ know… Until today. And let me tell you, you gotta’ have wireless signal extended to your drums. So what do you do? You go to the Apple Store. I jump back in my little Prius, and go to pull out of my garage, about 3 miles from the mall. And pulling out of my alley the traffic starts.
Seriously, there’s never traffic on my street. I look at the next street, and there are people trying to pull out of their house too. And we’re all just kinda’ stuck. All pointing in the same direction. I try to pull onto the street, but the 84 year old lady next door is already there, and flicks me off. This, after I raked her leaves all fall. And trimmed her bushes. I figure maybe she doesn’t recognize me, but then she tells me to roll my window down. I do, and she says “Charles, if you try to pull in front of me, I’ll kneecap you in your sleep.” Guess she does recognize me…
After she pulls up, I edge into the lane and she flicks me off again from her rear-view mirror. Aggressive. I get my phone out and put on a little music. My soundtrack for this drive will be That’s Still Mama, from Cody ChesnuTT. I recommend reading this to that soundtrack.
There’s a wall of cars. More cars than I’ve ever seen in my neighborhood. And it’s snowing. When I make a right turn a couple of blocks later it’s a straight shot to the mall. I can see ahead of me, there’s a sea of cars. And there are people getting out of their cars, running away. Why? Because there’s a group of nuns eating a poor child. Once all of the cars are clear, I see the nuns jump up, wipe off, and the kid gets up. Wait, what? They jump in their van and drive along the shoulder in a straight shot to the mall. Wow, the kind of preparation to fake a zombie apocalypse in order to get to the mall quicker, that’s some serious premeditation… Then I recognize them. They chased me a few years ago in the mall… I look at my watch and remember that back in 2009, I took a trip to the Apple Store on a random Friday to get a new Airport. It turned out to be quite an adventure, filled with homicidal nuns, a vorpal bell toting Salvation Army guy (very different than a green army guy), and a hipster wearing an outfit that has now become somewhat mainstream (as all edge fashions will do before they become old hat and you get stoned for wearing them). You can find the description of this journey here: http://krypted.com/mac-os-x/friday/.
You know, this year, I think I can do without my wireless, so I just go home. One less flannel-wearing bearded guy to contend with. And one who will have his holiday decorations done today. Happy holidays, ya’ll.
krypted November 27th, 2015
Posted In: personal
A Charlie Brown Thanksgiving. A true classic. Especially here in Minnesota, where it all started. Woodstock and Snoopy save the day, you learn a simple lesson about the pilgrims. And of course, Thanksgiving dinner served up on a ping-pong table. Classic.
Planes, Trains and Automobiles. Steve Martin and John Candy in their prime. Traveling across the country to get home for Thanksgiving. “Those aren’t pillows” is still a classic line from a classic movie. It is a different time. 1987. And a few of the jokes might not be as PC today as they were just before Jeremy Piven made it where it was only PC to wear flannel in PCU. Another classic. But Planes, Trains and Automobiles is on Netflix; PCU isn’t. And PCU isn’t about Thanksgiving.
The Scent of a Woman. Al Pacino as a blind alcoholic colonel who tangos and drives a Ferrari. Prep school kid (Chris O’Donnell with great hair) falls for a girl, shows the utmost integrity and impresses the colonel, who it turns out served on LBJ’s staff. A young Philip Seymour Hoffman and Gabrielle Anwar are also in this movie, which is not on Netflix.
Alice’s Restaurant. Produced in 1969, amidst counter-culture turmoil, this movie follows the wild adventures of Arlo Guthrie, visiting Alice for Thanksgiving, making questionable decisions and having Cool Hand Luke-style issues with authority. It’s quirky, slow, but endearing. Not on Netflix at the moment.
Dutch. Ed O’Neill (Married with Children, Modern Family, etc) is a typical 90s-era construction worker, picking up an unwilling private school kid. The two immediately hate each other and travel across the country just being awful. I like awful, so I like this. Except of course there’s a happy ending. But then, it’s kicking off the holiday season, so why not have a little happy… And it’s on Netflix.
A New World. I’m not sure that Colin Farrell makes a convincing John Smith, but it is good to have a little history lesson in the day to be thankful. Of course, it’s a love story. Complete with Pocahontas, a Native American princess. Not currently on Netflix.
Pocahontas. Disney. Good cartoon for the kids. John Smith can’t hold a candle to the wisdom of the tree spirit. Better than Sleeping Beauty. Good to have the heroine save the day. Aaaand, it’s available on Netflix.
Home for the Holidays. Robert Downey Jr (who was young once), Holly Hunter, Dylan McDermott, Anne Bancroft, Thanksgiving stress, boyfriends, turkey, family drama, more family drama. A great saw-toothed tension structure, good writing, somewhat realistic, and some pretty darn good acting. Although not on Netflix… But if you take Thanksgiving out of the equation, the best stand-alone movie on the list, for sure!
The Blind Side. Sandra Bullock won an Oscar for rescuing a poor, really big, kid from the streets. Of course, it’s an ‘Ole Miss tradition to do so when the kid is an NFL-caliber football player. True story. Thanksgiving is for football. The whole darn weekend. But the movie is not on Netflix, so you’ll have to get it elsewhere if you’re gonna’ watch it while the turkey followed by Wild Turkey is putting you to sleep.
Hannah and Her Sisters. If anyone can make a day off and lots of food suck, it’s Woody Allen. Oooooof course, as with all Woody Allen movies, Woody Allen is in love affairs with the leading ladies,including Mia Farrow and a young Dianne West. Also like all Woody Allen movies, amazing dialog. Not on Netflix.
krypted November 26th, 2015
Posted In: personal
Back when I worked with Xsan a lot more than I do now, one of the things we spent a lot of time doing was working with metadata and journal data on Xsan volumes. You can also view journal data for non-Xsan volumes. The hfs.util binary is used to view journal data about volumes. In this example, we’ll look at the journal size and location the boot volume of our system:
/System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util -I /Volumes/Macintosh\ HD
The output shows the size of the journal and the location, as follows:
/Volumes/Macintosh HD : journal size 40960 k at offset 0x1a38b000
krypted November 25th, 2015
I really enjoy supplementing the work I do on krypted with some of these types of articles. Look for more soon!
krypted November 24th, 2015
krypted November 24th, 2015
Posted In: personal
krypted November 23rd, 2015
Posted In: personal
Tags: nailed it
The hostinfo command displays information about your host; namely your kernel version, the number of processors the kernel is configured for, the number of physical processors active, the number of logical processors active, the type of those processors, which ones are active, the amount of memory available, tasks, threads, and average load.
Run hosting without any arguments or options:
The output would be as follows (ymmv per system):
Mach kernel version:
Darwin Kernel Version 15.0.0: Wed Aug 26 19:41:34 PDT 2015; root:xnu-3247.1.106~5/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 16.00 gigabytes
Default processor set: 395 tasks, 1711 threads, 4 processors
Load average: 1.78, Mach factor: 2.21
There are a bunch of other commands that can provide far more detailed information about your system. However, hostinfo has remained basically unchanged for 13 years, so if I can get something there, I can trust it’s fairly future-proofed in my scripts.
krypted November 23rd, 2015
Posted In: Mac OS X