Textual and graphical interfaces
There are two ways to work with a Mac OS X system: graphical and textual. When you are working on the system monitor, the monitor connected to or embedded in the system running OS X, you work with a graphical user interface by default. When you connect to the system from another system, a workstation, or a terminal, over a dial-up line or a network connection, you typically work with a textual interface, also called the command line interface (CLI).
You can use the terminal emulator application named Terminal (page 24) to display a textual window within a graphical environment. It is also possible to display a graphical interface over a network connection. This section has more information on the possibilities. The text console, described on page 35, displays a purely textual environment on the system monitor.
When the system boots, the default behavior is to log in automatically the first user account that was created when the system was set up. No password is required. Once you log out, the system presents a list of accounts that you can log in to (Figure 2-1). When you select one of these accounts, the system prompts for a password and, when you supply the correct password and press RETURN, logs you in. You can deactivate the automatic login using the System Preferences application (page 27). You can also use System Preferences to cause OS X to display name and password text boxes (Figure 2-2) instead of the list of users. With this method of logging in, you must enter a username and password, pressing RETURN after each.
Figure 2-1. List of users method of logging in
Figure 2-2. Name and password text boxes method of logging in
Security: Always use a password
Unless you are the only user of your system; your system is not connected to any other systems, the Internet, or a modem; and you are the only one with physical access to your system, it is a bad idea to allow any user to log in without a password. One of the first steps in securing a system is to disable the automatic login feature (use System Preferences [page 27]).
Typically, when you log in remotely using a terminal, terminal emulator, or other text-based device on a Mac OS X system, you must enter your username and password in response to the system prompts, pressing RETURN after each (Figure 2-3).
Figure 2-3. Textual login
Darwin (bravo.example.com) (console) login: zach Password: Last login: Mon Jul 18 16:59:14 from bravo.example.co Welcome to Darwin! You are using bash. bravo:~ zach$
After you enter your username and password, the shell prompt (or just prompt) appears, indicating that you have successfully logged in; it indicates that the system is ready for you to give it a command. The shell prompt line may be preceded by a short message called the message of the day (kept in /etc/motd) and your last login information. By default OS X establishes a prompt of host:directory user$, where user is your username, host is the name of the local system, and directory is the name of the directory you are working in. For information on how to change your prompt, refer to page 286.
Security: Did you log in last?
When you perform a textual login, after you enter your username and password and press RETURN, the system displays information about the last login on your account, showing when it took place and where it originated. You can use this information to see whether anyone else has accessed this account since you last used it. If so, perhaps an unauthorized user has learned your password and has logged on as you. In the interest of security, advise the system administrator of the circumstances that made you suspicious and change your password (page 36).
Logging In Remotely: Terminal Emulation and ssh
When you are not using a console, terminal, or other device connected directly to the Mac OS X system you are logging in on, you are probably connected to the OS X system using terminal emulation software on another system. Running on the local computer, this software connects to the Mac OS X system via a network (Ethernet, asynchronous phone line, PPP, or other type) and allows you to log in on the Mac OS X system.
Caution: Make sure TERM is set correctly
No matter how you connect, make sure you have the TERM variable set to the type of terminal your emulator is emulating. For more help see "Specifying a Terminal" on page 913.
By default Mac OS X does not allow remote logins. You can enable remote logins via ssh by enabling remote login in the Services tab of the Sharing pane of the Preferences window (page 27). OS X does not support telnet logins.
When you log in via a dial-up line, the connection is straightforward: You instruct the local emulator program to contact the remote system, it dials the phone, and the remote OS X system displays a login prompt on the screen.
When you log in via a directly connected network, you use ssh (page 847) to connect to the remote system. You can use ssh from the command line or from a graphical environment. From the command line of a terminal or a terminal emulator of an Apple, PC, or UNIX-like machine, give the command ssh, followed by the name or IP address (refer to "Host Address" on page 393) of the system you want to log in on. For examples and more detail refer to "Running Commands from the Terminal Emulator/Shell" on page 24. For more information about logging in see "Textual Login" on page 21.