Search results for preliminaries (3)
One really important step to understanding and manipulating an OS is knowing the directory structure; where important system files and other files are stored. So, I’ll explain the directory structure of Mac OS X.
You may want to open of Terminal (under Utilities) and follow along.
Type in “cd /”, then “ls”
/ is the root of the directory tree. OS X is based off of FreeBSD, a *NIX operating system, so the directory structure is very similar to that of linux or any other *NIX OS.
I’ll go through each folder in detail in the next couple of posts, but the basic gist of things can be found here: http://osxdaily.com/2007/03/30/mac-os-x-directory-structure-explained/
This is a really useful utility which allows you to protect your computer against other people with knowledge of single user mode and other goodies.
Also, if you don’t want others installing linux on your mac without permission, this protects against that as well.
On Snow Leopard, you’ll need to stick in the install disc which came with your computer and then reboot. Open the Firmware Password utility under Utilities and set a password.
Once a password is set, a password is required to boot from an external drive and single user mode.
In lion, command-R will do the trick. It is especially important to set up a firmware password in lion, since you don’t need access to the installation disk to reinstall the operating system or do anything equally harmful. If a firmware password is set, the following screen will show up when command-R is executed.
So, I’ll begin a series of basic hacks; really simple foundations to start with.
First off: Single User Mode.
Well, there are several ways to control a computer which you do not have access to. Assuming you have physical access of a machine, but do not have access to an account on the machine, single user (aka verbose) mode is probably the single most effective way to control it.
I won’t go into much detail about what it is (read the wikipedia article for that), but it is simply a runlevel which allows one to control a computer as the superuser.
On Mac OS X it looks like this:
You can change the root password of the system and fiddle around with lots of important files like sudoers and pam.conf.
Reboot your computer. Hold down command-S (⌘-S). If your computer is not protected by an open firmware password, you should see something like the screen shown in the picture. It’ll ask you to fsck with the command /sbin/fsck -fy and /sbin/mount -uw / to make modifications to the file system.
Well, what do you want to do now that you have control over this computer?
Well, those are the two most useful commands, but go ahead and play around yourself to discover more.
Limitations of Single User Mode:
Single user mode has several limitations. First of all, it is easily disabled. One can switch it off easily using the firmware password utility.
Dscl, which is used to create new accounts from the command line, cannot be used in single user mode either.