Learning the Terminal in Jaguar, Part 2
Pages: 1, 2, 3
By default, the Mac OS X root home directory already
contains a .forward file, but this one redirects mail not
to another user, but into thin air. This happens because instead of an
account name, root's .forward file contains the pathname
/dev/null, which is the location of a Unix black
hole. Streams of data directed to /dev/null, mail
messages included, simply disappear. Since OS X's designers figure
most users won't be accessing root's mail, they used this method to
ensure mail doesn't pile up at the door while no one's home,
eventually filling up your hard disk.
We only need, then, to edit root's .forward
file. You've probably already noticed that there is no
root directory in /Users -- so where is
root's home? The easiest way to find any user's home directory is by
using the finger command, which shows some basic
information about the specified account. For root's,
then:
[haru:~] chris% finger root
Login: root Name: System Administrator
Directory: /var/root Shell: /bin/tcsh
Last login Fri Oct 11 19:46 (PDT) on console
No Plan.
[haru:~] chris%
And there beside Directory you'll see that
root's home directory is /var/root.
As an alternative, you can always specify a user's home directory
using the ~ shortcut along with the account
name. Therefore, if you wanted to specify root's home
directory, you would use ~root.
Let's have a look inside ~root:
[haru:~] chris% sudo ls /var/root
.CFUserTextEncoding .forward .nsmbrc Library
First, here are a couple of points about this command line:
- Unlike the directories in
/Users,~rootcan only be browsed byroot. Therefore, usingsudois necessary. - You see several items with names beginning with
.. That initial dot is the Unix way of marking filenames as invisible to the shell (and to the Finder as well). You can see them, though, because you're runninglsasroot, andlsshows everything torootby default. If you were runninglsas a regular user, however, you would need to use its-aflag to see those "dot files." For example, compare the output of these two commands:ls -a ~andls ~(they should display the contents of your own home directory with, and without dot files.)
In any case, you should now see ~root/.forward, so
let's next edit it with pico, using sudo
since it's a root-owned file:
sudo pico /var/root/.forward
You should then see something like this:

That single line, then, is the entire content of
/var/root/.forward. To change it, first delete the file's
single line by pressing control + K. Next, type in your account name
(the name that's just before the "%" in the prompt; "chris" in this
case):

Save the file and close pico as usual, and you're done with the .forward file.
Now that everything is in place, you can perform a test. Send a new mail message to root:
[haru:~] chris% mail root
Subject: Test 2
This is only a test, again.
.
EOT
[haru:~] chris%
Check your mail, and you should see the new message, forwarded to you from root:
haru:~] chris% mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/chris": 1 message 1 new
>N 1 chris Wed Jan 22 08:56 13/406 "Test 2"
&
Message 1:
From root Wed Jan 22 08:56:20 2003
Date: Wed, 22 Jan 2003 08:56:20 -0800 (PST)
From: Chris Stone <chris>
To: root
Subject: Test 2
This is only a test, again.
& q
Saved 1 message in mbox
[haru:~] chris%
Here are a couple of more pointers for using mail:
- If you have several messages listed, just enter the message number to have that message displayed.
- Once a message has been displayed, it no longer shows up in the
initial new mail list, but is saved in the file
~/mbox. You can safely delete that file if you don't want the messages saved. If you do keep the file and want to view the messages, however, just run mail with its-fflag, which will list all of your saved messages.
For the final test, go ahead and run the daily maintenance job manually by entering this command:
sudo periodic daily
Once a prompt has returned, the job is done and you can check your mail once more:
[haru:~] chris% sudo periodic daily
Password:
[haru:~] chris% mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/chris": 1 message 1 new
>N 1 chris Wed Jan 22 09:08 59/2244 "Haru.local"
If you take a look at the message, the beginning of it should look something like this:
Message 1:
From root Wed Jan 22 09:08:54 2003
Date: Wed, 22 Jan 2003 09:08:54 -0800 (PST)
From: Chris Stone <chris>
To: root
Subject: Haru.local daily run output
Subject: Haru.local daily run output
Removing scratch and junk files:
rm: ./Mount01: is a directory
rm: ./Mount02: is a directory
rm: ./Mount03: is a directory
rm: ./Mount04: is a directory
rm: ./vi.recover: is a directory
rm: ./zBooterMnt: is a directory
Backing up NetInfo data
Checking subsystem status:
disks:
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/disk0s9 19532400 13471036 5866040 69% /
fdesc 1 1 0 100% /dev
Now that these regular reports will be coming in, you'll probably want to be able to understand them. In Part 3, you'll get a closer look at the scripts themselves to learn how to read the reports they generate. Until then, keep checking to see that you're receiving the reports as expected, and always feel free to submit your comments or questions to our TalkBack section.
Chris Stone is a Senior Macintosh Systems Administrator for O'Reilly, coauthor of Mac OS X in a Nutshell and contributing author to Mac OS X: The Missing Manual, which provides over 40 pages about the Mac OS X Terminal.
Read more Learning the Mac OS X Terminal columns.
Return to the Mac DevCenter.
-
sendmail.cf - missing? maybe?
2005-05-22 14:25:17 DaveHalbert [View]
-
sendmail.cf - missing? maybe?
2005-05-27 03:49:23 TeddiStransky [View]
-
Problems with sending self mail
2004-08-01 14:19:09 DrewE [View]
-
Problems with sending self mail
2004-08-04 09:00:58 NewYorkBruce [View]
-
Problems with sending self mail
2004-08-04 05:11:35 NewYorkBruce [View]
-
where's my sendmail
2004-07-26 22:31:48 artificialArea [View]
-
where's my sendmail
2004-07-26 23:02:43 artificialArea [View]
-
address of root
2004-05-31 11:21:57 johnparr [View]
-
periodic under PANTHER 10.3
2003-12-20 17:22:20 anonymous2 [View]
-
dont have etc/mail ?
2003-12-18 08:21:19 anonymous2 [View]
-
Error Sending Messages
2003-12-16 19:31:47 anonymous2 [View]
-
No such file of directory
2003-11-18 21:27:29 anonymous2 [View]
-
No such file of directory
2003-12-16 15:44:27 anonymous2 [View]
-
No such file of directory
2003-11-29 08:24:02 duesi [View]
-
No such file of directory
2003-11-29 08:23:25 duesi [View]
-
Directory Question
2003-11-09 08:04:59 anonymous2 [View]
-
Directory Question
2003-11-09 23:10:37 anonymous2 [View]
-
Sendmail, doesn't
2003-11-04 15:23:09 anonymous2 [View]
-
deleting mbox
2003-09-12 07:32:06 anonymous2 [View]
-
deleting mbox
2003-09-12 07:52:55 anonymous2 [View]
-
Nice article
2003-09-05 16:15:41 anonymous2 [View]
-
Problem with sendmail
2003-08-20 07:01:15 anonymous2 [View]
-
Problem with sendmail
2003-09-10 11:44:28 anonymous2 [View]
-
Easier than cutting butter with a hot knife
2003-07-17 13:35:35 anonymous2 [View]
-
Sending mail to my email address
2003-07-07 07:21:33 anonymous2 [View]
-
Sending mail to inbox
2003-07-07 07:16:01 anonymous2 [View]
-
problems with sendmail
2003-06-13 06:22:22 anonymous2 [View]
-
Problem with "Netinfo and Sendmail"
2003-06-03 02:48:09 anonymous2 [View]
-
It works!
2003-05-19 03:04:41 anonymous2 [View]
-
sendmail doesn’t work after the 3-3-03 Security and 10.2.5 Upadate
2003-04-26 16:03:34 anonymous2 [View]
-
MAILHOST not found in hostconfig file
2003-04-24 20:28:50 anonymous2 [View]
-
MAILHOST not found in hostconfig file
2003-04-25 09:24:33 Chris Stone |
[View]
-
/clientmqueue/ No such file or directory
2003-04-23 19:24:28 mstrstvns [View]
-
/clientmqueue/ No such file or directory
2003-04-24 09:18:13 Chris Stone |
[View]
-
After tail and sudo ls -l /var/spool/clientmqueue I have...
2003-04-24 15:44:30 mstrstvns [View]
-
Fianlly there is something for the MAC
2003-04-08 03:13:56 anonymous2 [View]
-
"can not chdir"
2003-03-31 17:49:27 anonymous2 [View]
-
"can not chdir"
2003-04-04 17:24:51 anonymous2 [View]
-
Unclear on checking old messages
2003-03-26 00:29:58 anonymous2 [View]
-
re: Unclear on checking old messages
2003-03-26 03:28:05 macmartin [View]
-
re: Unclear on checking old messages
2003-03-26 06:08:13 anonymous2 [View]
-
Help - sendmail starts only manually
2003-03-19 10:42:26 macmartin [View]
-
mails from the periodic scripts sometimes from root and sometimes from user ?
2003-03-16 13:19:50 macmartin [View]
-
Can't send mail through ROOT
2003-03-15 12:24:00 anonymous2 [View]
-
maybe this can help
2003-03-16 13:28:29 macmartin [View]
-
Can't send mail through ROOT
2003-03-15 14:37:54 edillon [View]
-
Delete Command
2003-03-13 16:15:51 tjtrujillo [View]
-
Delete Command
2003-03-25 12:06:18 anonymous2 [View]
-
3-3-03 Security Upadate & Sendmail
2003-03-10 12:02:12 Chris Stone |
[View]
-
3-3-03 Security Upadate & Sendmail
2003-04-23 21:44:47 anonymous2 [View]
-
3-3-03 Security Upadate & Sendmail
2003-04-24 09:37:47 Chris Stone |
[View]
-
connection refused by localhost?
2003-03-09 14:28:27 dv8godd [View]
-
connection refused by localhost?
2005-08-10 14:22:03 clintjd [View]
-
connection refused by localhost?
2003-04-24 13:28:01 anonymous2 [View]
-
Ditto on connection refused by localhost
2003-03-09 12:43:05 anonymous2 [View]
-
Ditto on connection refused by localhost
2003-04-01 20:44:08 anonymous2 [View]
-
Connection refused by localhost
2003-03-09 06:53:36 anonymous2 [View]
-
Security Update 3/3/03
2003-03-06 19:04:21 baltwo [View]
-
Thanks for 1 & 2! When can we expect 3?
2003-02-27 12:51:47 anonymous2 [View]
-
try repairing permissions
2003-02-24 17:59:49 anonymous2 [View]
-
Thanks
2003-03-03 17:25:48 mike_dowe [View]
-
Representing A Space
2003-02-20 18:39:29 anonymous2 [View]
-
Representing A Space
2003-07-02 22:43:48 humbi [View]
-
Representing A Space
2003-07-03 08:48:55 anonymous2 [View]
-
POP3 server: Qpopper
2003-02-18 19:05:50 anonymous2 [View]
-
sendmail will not start
2003-02-10 10:26:27 anonymous2 [View]
-
local-host-names error
2003-02-08 21:57:45 anonymous2 [View]
-
local-host-names error (World writable error)
2003-05-13 08:06:00 anonymous2 [View]
-
local-host-names error (World writable error)
2003-10-22 17:22:26 anonymous2 [View]
-
Can't read mail...
2003-02-05 20:02:13 anonymous2 [View]
-
Sendmail fixed
2003-02-05 15:09:56 anonymous2 [View]
-
Sendmail not working
2003-02-05 14:45:40 anonymous2 [View]
-
DontBlameSendmail error corrected
2003-02-02 23:56:59 anonymous2 [View]
-
DontBlameSendmail editing failed
2003-02-02 22:29:08 anonymous2 [View]
-
Jaguar Part 2
2003-02-02 20:15:57 anonymous2 [View]
-
clientmqueue error
2003-02-01 15:45:31 anonymous2 [View]
-
CRON assist
2003-01-29 17:49:07 zeker00 [View]
-
mail to read unix mail
2003-01-29 04:16:15 anonymous2 [View]
-
.forward and External mail address
2003-01-29 03:40:59 anonymous2 [View]
-
Another caveat to the chmod method
2003-01-28 00:57:00 rlotz [View]
-
Simpler mail config
2003-01-26 17:48:04 rhook [View]
-
Thanks! and a question
2003-01-26 14:49:16 anonymous2 [View]
-
Mount0n and zBooterMnt
2003-01-26 07:32:42 rw [View]
-
Thank You
2003-01-26 04:40:33 anonymous2 [View]
-
Local mail access
2003-01-25 10:41:21 anonymous2 [View]
-
Local mail access
2003-01-26 06:10:00 anonymous2 [View]
-
Local mail access
2003-01-26 07:51:07 greenergrad [View]
-
Command not found
2003-01-25 09:46:08 anonymous2 [View]
-
sending to outside addresses?
2003-01-25 08:04:09 anonymous2 [View]
-
sending to outside addresses?
2003-03-26 00:32:23 anonymous2 [View]
-
sending to outside addresses?
2003-01-26 07:26:26 rw [View]
-
Thank you
2003-01-24 19:28:56 rw [View]

