If youre a developer or system administrator lured to Mac OS X because of its Unix roots, youll quickly discover that performing Unix tasks on a Mac is different than what youre accustomed to. Mac OS X for Unix Geeks serves as a bridge between Apples Darwin OS and the more traditional Unix systems. This clear, concise guide gives you a tour of Mac OS Xs Unix shell in both Leopard and Tiger, and helps you find the facilities that replace or correspond to standard Unix utilities.
Youll learn how to perform common Unix tasks in Mac OS X, such as using Directory Services instead of the standard Unix /etc/passwd and /etc/group, and youll be able to compile code, link to libraries, and port Unix software using either Leopard and Tiger. This book teaches you to:
Some might say we all want Linux with an OS X graphical user interface. Mac for Linux Geeks will assist you step by step in migrating from Linux–based systems to OS X. Dual booting, virtualization, and building out the Linux environment on OS X are discussed in detail, along with a comparative view of well–known Mac tools and their open source equivalents. Hi, everyone, I've finally bitten the bullet, and after years and years of x86 stuff, I got myself a nice, brand new iBook (choice driven by the underlying.nix flavored OS that Panther promises, as an old timer with Linux as platform, for network and security tools required by my job.
Navigate the Terminal and understand how it differs from an xterm
Enter 'Mac OS X for Unix Geeks' by Brian Jepson and Ernest E. Rothman, two Unix geeks who found themselves in the same place you are. Their new book is your guide to figuring out the BSD Unix system and Mac-specific components that are making your life difficult and to help ease you into the Unix inside Mac OS X. Academia.edu is a platform for academics to share research papers.
Use Open Directory (LDAP) and NetInfo as well as Directory Services
Compile your code with GCC 4
Port Unix programs to Mac OS X with Fink
Use MacPorts to install free/open source software
Search through metadata with Spotlights command-line utilities
Build the Darwin kernel
And theres much more. Mac OS X for Unix Geeks is the ideal survival guide to tame the Unix side of Leopard and Tiger. If youre a Unix geek with an interest in Mac OS X, youll soon find that this book is invaluable.
Skip to end of metadataGo to start of metadataTo reset hostname, via bash, after a server has already been setup:
sudo scutil --set HostName servername.example.com
Similarly to determine hostname:
- http://snipplr.com/view/2424/change-os-x-hostname/
Alternative method:
to reproduce the parameters of top on linux:
If you want top to default to these switches all the time, add this to your ~/.bash_profile
- Verbose ModePress Apple-V keys
Also see: http://www.oreillynet.com/pub/h/348 - Choose BootdiskPress 'option' key
Will display different partitions and netboot if available. - Single User mode
- Boot from CD
- Eject CD at boot Hd screen recording for mac os x.
- Target modePress T key
Target computer should already be attached to client via firewire or thunderbolt before power on
Boot into single user mode
Mount the boot volume for write access
Start system daemons
List users
Reset password
References:
- Mac OS X Tiger for Unix Geeks http://www.oreilly.com/catalog/macxtigerunix/
Note: if the following are done from an admin account (instead of root), please add sudo in front of these commands
Also note: If a user's home directory is encrypted, they won't be able to log in if you change their password this way. (In fact, these instructions were needed because of an inability to log in because the password had been changed via
passwd
.)All Apple hardware can be booted into single user mode without password by default.
To set a password on ppc hardware (OpenFirmware)
To set a password on intel hardware (EFI)
References:
- Mac OS X Tiger for Unix Geeks http://www.oreilly.com/catalog/macxtigerunix/
- http://www.macosxhints.com/article.php?story=20020725085134490 - How to fsck with open firmware passwords enabled.
'All Unix commands run while OS-X is booting up are run as root and have the potential to significantly alter the behavior of your system. Because this is potentially dangerous, creating one of these startup items is fairly difficult. They have a very structured format, and will not load unless they reside in one of two places: /System/Library/StartupItems (reserved for those provided by Apple) or /Library/StartupItems (where you should put yours).'
Reference: --manuals.info.apple.com-en-Command_Line_v10.4.pdf
Reference: http://www.macosxhints.com/article.php?story=20060710091805963
first 8 characters of hardware serial number and is case sensitive.
- To search for all Xserves waiting to be setup via Apple Server Assistant.Reference: http://www.geocenter.com/news/xserve_imaging.html
- Finding computers which don't have a DHCP address assigned to them
- from man page
- SYNOPSIS
asr verb options
asr restore --source source --target target options
asr server --source source --config configuration options
asr restore --source asr://source --file file options
asr imagescan --source options image
asr help | version
- DESCRIPTION
asr efficiently copies disk images onto volumes, either directly or via a multicast network stream. asr can also accurately clone volumes without the use of an intermediate disk image.
In its first form, asr copies source (usually a disk image, potentially on an HTTP server) to target. source can be specified using a path in the filesystem, or an http or https URL. It can also be an asr:// URL to indicate a multicast source. asr can also be invoked with its second form to act as a multicast server. In its third form, asr will restore a multicast disk image to a file instead of disk volume. In its fourth form, asr prepares a disk image to be restored efficiently, adding whole-volume and (optionally) file by file checksum information. help and version provide usage and version information, respectively.
- clone a volume
asr -source /Volumes/<vol1> -target /Volumes/<vol2>
- restore a system image onto a volume
asr -source <compressed_image> -target <target_volume> -erase
- note: the target drive will be erased
- references:
- --manuals.info.apple.com-en-Command_Line_v10.4.pdf p 177
Given <account>, <group> (which is usually same as <account>), <uid>, <gid>, <realname>
dscl . create /users/<account> uid <uid>
dscl . create /users/<account> gid <gid>
dscl . create /users/<account> shell /bin/bash
dscl . create /users/<account> home /Users/<account>
dscl . create /users/<account> realname '<realname>'
dscl . create /users/<account> passwd *
dscl . create /groups/<group> gid <gid>
dscl . create /groups/<group> passwd *
Create default directory
ditto --rsrc /System/Library/User Template/English.lproj /Users/<account>
Set correct ownership
Set password
Manually granting an account admin privledges
Reference: Mac OS X Tiger for Unix Geeks, p79
If you’re using a generic setup file, and the serial number isn’t site licensed, after setup you must specify the server’s serial number by using Server Admin or the command line. In Server Admin, select the server, click Settings, and click General. Alternatively, in the Terminal application, use ssh to connect with the server and type:
/System/Library/ServerSetup/serversetup -setServerSerialNumber <serial_number>
Verify:
/System/Library/ServerSetup/serversetup -verifyServerSerialNumber
Display:
/System/Library/ServerSetup/serversetup -getServerSerialNumber
Reference: Server Getting Started Guide p126
- Mount image
root# hdiutil attach /Volumes/global/software/MacOSXSrvrUpdCombo10.4.7.dmg
/dev/disk2 Apple_partition_scheme
/dev/disk2s1 Apple_partition_map
/dev/disk2s2 Apple_Driver_ATAPI
/dev/disk2s3 Apple_HFS /Volumes/Mac OS X Server 10.4.7 Combined Update
root# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s3 77G 3.0G 73G 4% /
devfs 100K 100K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
/dev/disk0s3 77G 59G 18G 77% /Volumes/global
automount -nsl 177 0B 0B 0B 100% /Network
automount -fstab 237 0B 0B 0B 100% /automount/Servers
automount -static 237 0B 0B 0B 100% /automount/static
/dev/disk2s3 227M 208M 18M 92% /Volumes/Mac OS X Server 10.4.7 Combined Update
root# ls /Volumes/Mac OS X Server 10.4.7 Combined Update/
.discCookie MacOSXSrvrUpdCombo10.4.7.mpkg
- Install packageIzip for mac os x 10.7.55.
root# installer -pkg /Volumes/Mac OS X Server 10.4.7 Combined Update/MacOSXSrvrUpdCombo10.4.7.mpkg -target /
installer: Package name is Mac OS X Server Update Combined
installer: Upgrading volume mounted at /.
installer: The upgrade was successful.
installer: The install requires restarting now.
root# reboot
Reference: http://textsnippets.com/posts/show/322
turn on Remote Login on the remote machine
rsync -av -e ssh --delete-excluded --exclude=Library/Caches
--exclude='Pictures/iPhoto Library' --exclude=.Trash --exclude=Library/Mozilla/Profiles///Cache/ --progress
<account>@<address>:/Users/<account>/ .
We can use
defaults
to change preferences, including some that don't have a GUI associated with them. For example, if you want Terminal to use focus-follows-mouse, do: defaults write com.apple.Terminal FocusFollowsMouse Yes
We can read all keys of a particular application, or one particular key, using <tt>read</tt>:
defaults read com.apple.Terminal
defaults read com.apple.Terminal FocusFollowsMouse
See the man page for more details.
I believe ANSI colors are settable via the TCColorArray pref. It is an array of 11 colors; to change one you have to change the whole key (to the best of my knowledge). Not sure what the first three items are, but I /think/ the fourth is the black color, then red, green, yellow, blue, etc., followed by the bright versions. More digging is necessary..
Mac Os X For Unix Geeks Pdf Windows 10
You shouldn't use
defaults
on a running application, as that application might override what you're trying to do. So if you're changing Terminal, quit Terminal and use an xterm
or iTerm if you're so inclined; if you're changing X11 (for example):stops the incredibly annoying 'Are you sure you want to quit' dialogue from happening), use Terminal or iTerm.
From: http://hohle.net/scrap_post.php?post=179
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=ExFxCxDxBxegedabagacad
Other examples:
To run from linux command line:
/usr/lib/jvm/java-1.5.0-sun-1.5.0.10/bin/java -jar ~/Desktop/RAID Admin.app/Contents/Resources/Java/RAID_Admin.jar
- Command Line Guide pp 127
- Securing Initial System Accounts
- Securing the Roo Account
- Restricting use of sudo
- Securing Single User mode
- Setting Password Policy
Listing Rules
In its simplest form, we can list the rules with:
This will list all of the rules ordered by their rule number. To also list the timestamp of the last moment a packet was matched on a specific rule, the following command will accomplish this:
Finally, if we wish to list the packet count for matched rules along with the rules themselves, we can issue the following:
OR
Both will display the same information in the same way. The first column is the rule number, followed by the number of outgoing matched packets, followed by the number of incoming matched packets, and finally followed by the rule itself.
Removing rule
Flushing all rules
logs
- nat logs
configuration files
/private/etc/ipfilter/ipfw.conf
/private/etc/ipfilter/ipfw.conf.apple
/private/etc/ipfilter/ipfw.conf.apple
command line
- Enable firewall
- Starting/Stopping firewall
- Starting/Stopping NAT
References:
- Command Line Guide p228-238
- server control
- leases
References: