handbook/printing/chapter.sgml	1.95 -> 1.96

- More translation:
	handbook/basics/chapter.sgml
	handbook/config/chapter.sgml
	handbook/introduction/chapter.sgml
	handbook/mail/chapter.sgml
	porters-handbook/book.sgml

- Fix typo:
	handbook/users/chapter.sgml

Main contributors:	gaod, jnlin, whsyu

Obtained from:		The FreeBSD Traditional Chinese Project
			https://opensvn.csie.org/traccgi/freebsddoc/wiki
This commit is contained in:
Chin-San Huang 2007-11-24 14:38:35 +00:00
parent 685dea9c44
commit 604222a8b7
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=31047
7 changed files with 497 additions and 624 deletions

View file

@ -27,7 +27,7 @@
如果您對這些內容熟悉的話,可以放心的跳過。
如果您剛接觸 FreeBSD那您一定要仔細的讀完這章。</para>
<para>讀完這一章,您將會了解:</para>
<para>讀完這章,您將了解:</para>
<itemizedlist>
<listitem>
@ -1815,92 +1815,87 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
<sect1 id="shells">
<title>Shells</title>
<indexterm><primary>shells</primary></indexterm>
<indexterm><primary>command line</primary></indexterm>
<indexterm><primary>命令列 command line</primary></indexterm>
<para>In FreeBSD, a lot of everyday work is done in a command line
interface called a shell. A shell's main job is to take commands
from the input channel and execute them. A lot of shells also have
built in functions to help everyday tasks such as file management,
file globbing, command line editing, command macros, and environment
variables. FreeBSD comes with a set of shells, such as
<command>sh</command>, the Bourne Shell, and <command>tcsh</command>,
the improved C-shell. Many other shells are available
from the FreeBSD Ports Collection, such as
<command>zsh</command> and <command>bash</command>.</para>
<para>在 FreeBSD 中,很多日常的工作是在一個叫做 shell
的文字介面中完成的。
Shell 的主要工作就是從輸入中收到命令並執行它們。
許多 shell 也有內建一些有助於日常工作的指令,
像是檔案管理、檔案比對、命令列編輯、指令巨集以及環境變數等。
FreeBSD 有內附了幾個 shell像是 <command>sh</command>
Bourne Shell以及 <command>tcsh</command>,改良版的 C-shell。
還有許多其他的 shell 可以從 FreeBSD Ports Collection
中取得,像是 <command>zsh</command> 以及 <command>bash</command>
等。</para>
<para>Which shell do you use? It is really a matter of taste. If you
are a C programmer you might feel more comfortable with a C-like shell
such as <command>tcsh</command>. If you have come from Linux or are new
to a &unix; command line interface you might try <command>bash</command>.
The point is that each
shell has unique properties that may or may not work with your
preferred working environment, and that you have a choice of what
shell to use.</para>
<para>您用哪個 shell 呢? 其實每個人的喜好都不一樣。
如果您是一個 C 程式設計師,那對於使用像是 <command>tcsh</command>
這種 C-like 的 shell 可能會感到相當愉快。 如果你是從 Linux
跳過來的,或者您是一個 &unix; 新手,那您也許會想要用
<command>bash</command> 來當作文字介面。
每一個 shell 都有自已獨特之處,至於這些特點能不能配合您的工作環境?
那就是您選擇 shell 的重點了。</para>
<para>One common feature in a shell is filename completion. Given
the typing of the first few letters of a command or filename, you
can usually have the shell automatically complete the rest of the
command or filename by hitting the <keycap>Tab</keycap> key on the keyboard. Here is
an example. Suppose you have two files called
<filename>foobar</filename> and <filename>foo.bar</filename>. You
want to delete <filename>foo.bar</filename>. So what you would type
on the keyboard is: <command>rm fo[<keycap>Tab</keycap>].[<keycap>Tab</keycap>]</command>.</para>
<para>The shell would print out <command>rm
foo[BEEP].bar</command>.</para>
<para>The [BEEP] is the console bell, which is the shell telling me it
was unable to totally complete the filename because there is more
than one match. Both <filename>foobar</filename> and
<filename>foo.bar</filename> start with <literal>fo</literal>, but
it was able to complete to <literal>foo</literal>. If you type in
<literal>.</literal>, then hit <keycap>Tab</keycap> again, the shell would be able to
fill in the rest of the filename for you.</para>
<para>檔名自動補齊就是常見的 shell 功能。
首先輸入指令或檔案的前幾個字母,這時通常您只需要按下 <keycap>Tab</keycap>
鍵,接下來 shell 就會自動把指令或是檔案名稱剩餘的部份補齊。
假設您有兩個檔案分別叫作 <filename>foobar</filename> 及
<filename>foo.bar</filename>。 現在要刪掉
<filename>foo.bar</filename>,那麼可以輸入:
<command>rm fo[<keycap>Tab</keycap>].[<keycap>Tab</keycap>]</command>
</para>
<para>Shell 會印出這個: <command>rm foo[嗶].bar</command>。</para>
<para>[嗶] 是 console 的響鈴,這嗶的一聲是 shell
在告訴我說它沒有辦法完全自動補齊檔名,因為有不只一個檔名符合條件。
<filename>foobar</filename> 和 <filename>foo.bar</filename> 都是
<literal>fo</literal> 開頭的檔名,不過它至少可以補齊到 <literal>foo</literal>。
如果您接著輸入 <literal>.</literal> 然後再按 <keycap>Tab</keycap>
一次,那 shell 就能夠替您把剩下的檔名填滿了。</para>
<indexterm><primary>environment variables</primary></indexterm>
<para>Another feature of the shell is the use of environment variables.
Environment variables are a variable/key pair stored in the shell's
environment space. This space can be read by any program invoked by
the shell, and thus contains a lot of program configuration. Here
is a list of common environment variables and what they mean:</para>
<para>Shell 的另一項特點是使用了環境變數。
環境變數是以變數與鍵值variable/key的對應關係儲存於 shell
的環境空間中,任何由 shell 所產生的程序都可以讀取此空間,
因此這個空間儲存了許多程序的設定組態。在此附上
一份常見環境變數與其含意的列表:</para>
<indexterm><primary>environment variables</primary></indexterm>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>變數</entry>
<entry>詳細說明</entry>
</row>
</thead>
<tbody>
<row>
<entry><envar>USER</envar></entry>
<entry>Current logged in user's name.</entry>
<entry>目前登入的使用者名稱。</entry>
</row>
<row>
<entry><envar>PATH</envar></entry>
<entry>Colon-separated list of directories to search for
binaries.</entry>
<entry>以冒號(:)隔開的目錄列表,用以搜尋執行檔的路徑。</entry>
</row>
<row>
<entry><envar>DISPLAY</envar></entry>
<entry>Network name of the X11 display to connect to, if
available.</entry>
<entry>若存在這個環境變數,則代表 X11 連結顯示器的網路名稱。</entry>
</row>
<row>
<entry><envar>SHELL</envar></entry>
<entry>The current shell.</entry>
<entry>目前使用的 shell。</entry>
</row>
<row>
<entry><envar>TERM</envar></entry>
<entry>The name of the user's type of terminal. Used to determine
the capabilities of the terminal.</entry>
<entry>使用者終端機的名稱,能藉由此變數判斷終端機的能力。</entry>
</row>
<row>
@ -1911,59 +1906,56 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
<row>
<entry><envar>OSTYPE</envar></entry>
<entry>Type of operating system. e.g., FreeBSD.</entry>
<entry>作業系統的種類FreeBSD。</entry>
</row>
<row>
<entry><envar>MACHTYPE</envar></entry>
<entry>The CPU architecture that the system is running
on.</entry>
<entry>目前系統所用的 CPU 架構。</entry>
</row>
<row>
<entry><envar>EDITOR</envar></entry>
<entry>The user's preferred text editor.</entry>
<entry>使用者偏好的文字編輯器。</entry>
</row>
<row>
<entry><envar>PAGER</envar></entry>
<entry>The user's preferred text pager.</entry>
<entry>使用者偏好的文字分頁器text pager</entry>
</row>
<row>
<entry><envar>MANPATH</envar></entry>
<entry>Colon-separated list of directories to search for
manual pages.</entry>
<entry>以冒號(:)隔開的目錄列表,用以搜尋 manual pages 的路徑。</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<indexterm><primary>Bourne shells</primary></indexterm>
<para>Setting an environment variable differs somewhat from
shell to shell. For example, in the C-Style shells such as
<command>tcsh</command> and <command>csh</command>, you would use
<command>setenv</command> to set environment variables.
Under Bourne shells such as <command>sh</command> and
<command>bash</command>, you would use
<command>export</command> to set your current environment
variables. For example, to set or modify the
<envar>EDITOR</envar> environment variable, under <command>csh</command> or
<command>tcsh</command> a
command like this would set <envar>EDITOR</envar> to
<filename>/usr/local/bin/emacs</filename>:</para>
<para>在不同的 shell 底下設定環境變數的方式也有所不同。
舉例來說,在 C-Style 的 shell 底下,像是
<command>tcsh</command> 和 <command>csh</command>,你必須使用
<command>setenv</command> 來設定環境變數。
但在 Bourne shells 底下,像是 <command>sh</command> 和
<command>bash</command>,你則必須使用
<command>export</command> 來設定你所使用的環境變數。
再舉個例子來說,若要設定或是修改
<envar>EDITOR</envar> 這個環境變數,在 <command>csh</command> 或
<command>tcsh</command> 下設定 <envar>EDITOR</envar> 這個環境變數為
<filename>/usr/local/bin/emacs</filename> 的指令是:</para>
<screen>&prompt.user; <userinput>setenv EDITOR /usr/local/bin/emacs</userinput></screen>
<para>Under Bourne shells:</para>
<para>在 Bourne shells 下則是:</para>
<screen>&prompt.user; <userinput>export EDITOR="/usr/local/bin/emacs"</userinput></screen>
<para>You can also make most shells expand the environment variable by
placing a <literal>$</literal> character in front of it on the
command line. For example, <command>echo $TERM</command> would
print out whatever <envar>$TERM</envar> is set to, because the shell
expands <envar>$TERM</envar> and passes it on to <command>echo</command>.</para>
<para>大多數的 shell 都支援使用者在命令列中將
<literal>$</literal> 字元放在變數之前,以取得環境變數的值。
舉例來說,<command>echo $TERM</command> 會
顯示出 <envar>$TERM</envar> 的設定值,這是因為 shell 取得了
<envar>$TERM</envar> 的設定值,並將他傳給 <command>echo</command> 顯示出來。</para>
<para>Shells treat a lot of special characters, called meta-characters
as special representations of data. The most common one is the
@ -1983,22 +1975,17 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
is.</para>
<sect2 id="changing-shells">
<title>Changing Your Shell</title>
<title>變更你的 Shell</title>
<para>The easiest way to change your shell is to use the
<command>chsh</command> command. Running <command>chsh</command> will
place you into the editor that is in your <envar>EDITOR</envar>
environment variable; if it is not set, you will be placed in
<command>vi</command>. Change the <quote>Shell:</quote> line
accordingly.</para>
<para>變更 shell 最簡單的方法就是透過 <command>chsh</command> 命令。
執行 <command>chsh</command> 將會呼叫環境變數中 <envar>EDITOR</envar> 指定的
文字編輯器。如果沒有設定,則預設是 <command>vi</command>。依照需求去修改
<quote>Shell:</quote> 的值。
<para>你也可以透過 <command>chsh</command> 的參數 <option>-s</option>,這可以
直接設定你的 shell 而不需要透過任何文字編輯器。例如,假設你想將 shell 變更為
<command>bash</command>,可以透過下列的方式:</para>
<para>You can also give <command>chsh</command> the
<option>-s</option> option; this will set your shell for you,
without requiring you to enter an editor.
For example, if you wanted to
change your shell to <command>bash</command>, the following should do the
trick:</para>
<screen>&prompt.user; <userinput>chsh -s /usr/local/bin/bash</userinput></screen>
<note>

View file

@ -3,7 +3,7 @@
$FreeBSD$
Original revision: 1.213
Chased revision: 1.217
Chased revision: 1.221
-->
<chapter id="config-tuning">
@ -141,42 +141,30 @@
<para>根據經驗法則,通常 swap 分割區應該設為系統記憶體(RAM)大小的兩倍即可。
舉例來說:若機器有 128&nbsp;MB RAM 的話,那麼
swap 則應該設為 256&nbsp;MB。 Systems with
less memory may perform better with more swap.
Less than 256&nbsp;megabytes of swap is not recommended and
memory expansion should be considered.
The kernel's VM paging algorithms are tuned to
perform best when the swap partition is at least two times the
size of main memory. Configuring too little swap can lead to
inefficiencies in the VM page scanning code and might create
issues later if more memory is added.</para>
swap 則應該設為 256&nbsp;MB。 記憶體較少的機器,可以透過增加更多 swap 空間來提昇效能。
我們建議 swap 空間不要設低於 256&nbsp;MB而且該考慮增加記憶體才是良策。
當 swap 最少為記憶體的兩倍大時kernel 的 VM paging 演算法會把效能調整到最佳狀態。
但若是機器記憶體很大,但 swap 卻劃分太少的話,會導致 VM page 掃瞄的效率過低,
此外日後若增加更多記憶體時,也會導致一些異常狀況發生。</para>
<para>On larger systems with multiple SCSI disks (or
multiple IDE disks operating on different controllers), it is
recommend that a swap is configured on each drive (up
to four drives). The swap partitions should be
approximately the same size. The kernel can handle arbitrary
sizes but internal data structures scale to 4 times the
largest swap partition. Keeping the swap partitions near the
same size will allow the kernel to optimally stripe swap space
across disks.
Large swap sizes are fine, even if swap is not
used much. It might be easier to recover
from a runaway program before being forced to reboot.</para>
<para>在較大型的機器內,通常會有多顆 SCSI 磁碟(或多顆 IDE 磁碟接在不同 IDE 匯流排上)
建議在每顆磁碟上都建立 swap(最多到四顆)。
而這些 swap 應該都大約一樣大小,
Kernel 可接受任意大小的 swap但內部資料結構則是最大塊 swap 的 4 倍。
若有保持 swap 為同樣大小的話,則可讓 kernel 最佳化運用各磁碟之中的 swap 空間。
即使不太常會用到,分配大的 swap 也都還可接受,
因為它可在強制重開機之前讓你更容易從當掉的程式中恢復正常。</para>
</sect3>
<sect3>
<title>為何要規劃 Partition</title>
<para>Several users think a single large partition will be fine,
but there are several reasons why this is a bad idea.
First, each partition has different operational
characteristics and separating them allows the file system to
tune accordingly. For example, the root
and <filename>/usr</filename> partitions are read-mostly, without
much writing. While a lot of reading and writing could
occur in <filename>/var</filename> and
<filename>/var/tmp</filename>.</para>
<para>有些人覺得把硬碟就直接劃分一個大分割區就好了,
但是事實上有些原因會證明為何這是個爛點子,
首先,每個分割區都有不同的運作特性,把它們分開的話可以讓檔案系統來調整。
比如: <filename>/</filename> 以及 <filename>/usr</filename> 分割區大多只是讀取而已,
比較少在寫入。 而讀寫都很頻繁的則是 <filename>/var</filename> 及
<filename>/var/tmp</filename>。</para>
<para>By properly partitioning a system, fragmentation
introduced in the smaller write heavy partitions
@ -261,28 +249,21 @@
<sect1 id="configtuning-appconfig">
<title>各式應用程式的設定檔</title>
<para>Typically, installed applications have their own
configuration files, with their own syntax, etc. It is
important that these files be kept separate from the base
system, so that they may be easily located and managed by the
package management tools.</para>
<para>原則上,安裝的軟體都會有其自有的設定檔,也會有自己的格式及語法。
因此,將其與系統分開獨立是件非常重要的事情。如此一來,套件管理工具將可以
很輕易的找出這些設定檔並管理這些設定檔。</para>
<indexterm><primary>/usr/local/etc</primary></indexterm>
<para>Typically, these files are installed in
<filename>/usr/local/etc</filename>. In the case where an
application has a large number of configuration files, a
subdirectory will be created to hold them.</para>
<para>原則上,設定檔會被放置在 <filename>/usr/local/etc</filename>。
若某軟體的設定檔為數眾多,那將會其下建立一個目錄以供放置</para>
<para>Normally, when a port or package is installed, sample
configuration files are also installed. These are usually
identified with a <filename>.default</filename> suffix. If there
are no existing
configuration files for the application, they will be created by
copying the <filename>.default</filename> files.</para>
<para>通常,當一個 port 或 package 被安裝的同時,一些基本的設定範例
也會一併被安裝至此。這些範例通常會被用 <filename>.default</filename> 做為副檔名。
若安裝時沒有自行撰寫的軟體設定檔,那麼將會複製一份 <filename>.default</filename> 設定
做為預設設定檔</para>
<para>For example, consider the contents of the directory
<filename>/usr/local/etc/apache</filename>:</para>
<para>舉個例子,我們來看看 <filename>/usr/local/etc/apache</filename></para>
<literallayout class="monospaced">-rw-r--r-- 1 root wheel 2184 May 20 1998 access.conf
-rw-r--r-- 1 root wheel 2184 May 20 1998 access.conf.default
@ -295,9 +276,8 @@
-rw-r--r-- 1 root wheel 7980 May 20 1998 srm.conf
-rw-r--r-- 1 root wheel 7933 May 20 1998 srm.conf.default</literallayout>
<para>The file sizes show that only the <filename>srm.conf</filename>
file has been changed. A later update of the <application>Apache</application> port would not
overwrite this changed file.</para>
<para><filename>srm.conf</filename> 的檔案被修改過了,爾後 <application>Apache</application> 的更新
將不會對這個已修改過的設定檔做任何變動。</para>
</sect1>
@ -667,7 +647,7 @@ HOME=/var/log
</authorgroup>
</sect1info>
<title>在 &os; 5.X (含之後) 使用 rc</title>
<title>在 &os; 使用 rc</title>
<para>從 2002 年起,&os; 整合了 NetBSD 的 <filename>rc.d</filename> 機制來作為系統服務啟動機制。
可以到 <filename>/etc/rc.d</filename> 目錄下去看,很多檔案都是基本服務,可以用 <option>start</option>, <option>stop</option>
@ -860,7 +840,7 @@ ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto</screen>
<itemizedlist>
<listitem>
<para>The easiest way is to simply load a kernel module for
your network card with &man.kldload.8;. Not all NIC
your network card with &man.kldload.8;, or automatically at boot time by adding the appropriate line to the file <filename>/boot/loader.conf</filename>. Not all NIC
drivers are available as modules; notable examples of
devices for which modules do not exist are ISA cards.</para>
</listitem>
@ -878,6 +858,128 @@ ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto</screen>
not have to build a new kernel.</para>
</listitem>
</itemizedlist>
<sect3 id="config-network-ndis">
<title>Using &windows; NDIS Drivers</title>
<indexterm><primary>NDIS</primary></indexterm>
<indexterm><primary>NDISulator</primary></indexterm>
<indexterm><primary>&windows; drivers</primary></indexterm>
<indexterm><primary>Microsoft Windows</primary></indexterm>
<indexterm><primary>Microsoft Windows</primary>
<secondary>device drivers</secondary></indexterm>
<indexterm><primary>KLD (kernel loadable
object)</primary></indexterm>
<!-- We should probably omit the expanded name, and add a <see> entry
for it. Whatever is done must also be done to the same indexterm in
linuxemu/chapter.sgml -->
<para>Unfortunately, there are still many vendors that do not
provide schematics for their drivers to the open source
community because they regard such information as trade
secrets. Consequently, the developers of &os; and other
operating systems are left two choices: develop the drivers
by a long and pain-staking process of reverse engineering or
using the existing driver binaries available for the
&microsoft.windows; platforms. Most developers, including
those involved with &os;, have taken the latter
approach.</para>
<para>Thanks to the contributions of Bill Paul (wpaul), as of
&os;&nbsp;5.3-RELEASE there is <quote>native</quote> support
for the Network Driver Interface Specification (NDIS). The
&os; NDISulator (otherwise known as Project Evil) takes a
&windows; driver binary and basically tricks it into
thinking it is running on &windows;. Because the
&man.ndis.4; driver is using a &windows; binary, it is only
usable on &i386; and amd64 systems.</para>
<note>
<para>The &man.ndis.4; driver is designed to support mainly
PCI, CardBus and PCMCIA devices, USB devices are not yet
supported.</para>
</note>
<para>In order to use the NDISulator, you need three
things:</para>
<orderedlist>
<listitem>
<para>Kernel sources</para>
</listitem>
<listitem>
<para>&windowsxp; driver binary
(<filename>.SYS</filename> extension)</para>
</listitem>
<listitem>
<para>&windowsxp; driver configuration file
(<filename>.INF</filename> extension)</para>
</listitem>
</orderedlist>
<para>Locate the files for your specific card. Generally,
they can be found on the included CDs or at the vendors'
websites. In the following examples, we will use
<filename>W32DRIVER.SYS</filename> and
<filename>W32DRIVER.INF</filename>.</para>
<note>
<para>You can not use a &windows;/i386 driver with
&os;/amd64, you must get a &windows;/amd64 driver to make it
work properly.</para>
</note>
<para>The next step is to compile the driver binary into a
loadable kernel module. To accomplish this, as
<username>root</username>, use &man.ndisgen.8;:</para>
<screen>&prompt.root; <userinput>ndisgen <replaceable>/path/to/W32DRIVER.INF</replaceable> <replaceable>/path/to/W32DRIVER.SYS</replaceable></userinput></screen>
<para>The &man.ndisgen.8; utility is interactive and will
prompt for any extra information it requires; it will
produce a kernel module in the current directory which can
be loaded as follows:</para>
<screen>&prompt.root; <userinput>kldload <replaceable>./W32DRIVER.ko</replaceable></userinput></screen>
<para>In addition to the generated kernel module, you must
load the <filename>ndis.ko</filename> and
<filename>if_ndis.ko</filename> modules. This should be
automatically done when you load any module that depends on
&man.ndis.4;. If you want to load them manually, use the
following commands:</para>
<screen>&prompt.root; <userinput>kldload ndis</userinput>
&prompt.root; <userinput>kldload if_ndis</userinput></screen>
<para>The first command loads the NDIS miniport driver
wrapper, the second loads the actual network
interface.</para>
<para>Now, check &man.dmesg.8; to see if there were any errors
loading. If all went well, you should get output resembling
the following:</para>
<screen>ndis0: &lt;Wireless-G PCI Adapter&gt; mem 0xf4100000-0xf4101fff irq 3 at device 8.0 on pci1
ndis0: NDIS API version: 5.0
ndis0: Ethernet address: 0a:b1:2c:d3:4e:f5
ndis0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
ndis0: 11g rates: 6Mbps 9Mbps 12Mbps 18Mbps 36Mbps 48Mbps 54Mbps</screen>
<para>From here you can treat the
<devicename>ndis0</devicename> device like any other network
interface (e.g., <devicename>dc0</devicename>).</para>
<para>You can configure the system to load the NDIS modules at
boot time in the same way as with any other module. First,
copy the generated module,
<filename>W32DRIVER.ko</filename>, to the <filename
class="directory">/boot/modules</filename> directory. Then,
add the following line to
<filename>/boot/loader.conf</filename>:</para>
<programlisting>W32DRIVER_load="YES"</programlisting>
</sect3>
</sect2>
<sect2>
@ -1988,7 +2090,8 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
require many thousands of file descriptors, depending on the
kind and number of services running concurrently.</para>
<para><varname>kern.maxfile</varname>'s default value is
<para>In older FreeBSD releases, <varname>kern.maxfile</varname>'s default
value is derived from the <option>maxusers</option> option in your
dictated by the <option>maxusers</option> option in your
kernel configuration file. <varname>kern.maxfiles</varname> grows
proportionally to the value of <option>maxusers</option>. When
@ -1999,6 +2102,23 @@ device_probe_and_attach: cbb0 attach returned 12</screen>
connected at once, the resources needed may be similar to a
high-scale web server.</para>
<para>As of FreeBSD 4.5, <varname>kern.maxusers</varname> is
automatically sized at boot based on the amount of memory available
in the system, and may be determined at run-time by inspecting the
value of the read-only <varname>kern.maxusers</varname> sysctl.
Some sites will require larger or smaller values of
<varname>kern.maxusers</varname> and may set it as a loader tunable;
values of 64, 128, and 256 are not uncommon. We do not recommend
going above 256 unless you need a huge number of file descriptors;
many of the tunable values set to their defaults by
<varname>kern.maxusers</varname> may be individually overridden at
boot-time or run-time in <filename>/boot/loader.conf</filename> (see
the &man.loader.conf.5; man page or the
<filename>/boot/defaults/loader.conf</filename> file for some hints)
or as described elsewhere in this document. Systems older than
FreeBSD&nbsp;4.4 must set this value via the kernel &man.config.8;
option <option>maxusers</option> instead.</para>
<para>The system will auto-tune
<literal>maxusers</literal> for you if you explicitly set it to
<literal>0</literal><footnote>

View file

@ -41,7 +41,7 @@
<para>FreeBSD open-source 開發模式的基礎概念;</para>
</listitem>
<listitem>
<para>當然囉,還有 <quote>FreeBSD</quote> 這名字的緣故。</para>
<para>當然囉,還有 <quote>FreeBSD</quote> 這名字的由來。</para>
</listitem>
</itemizedlist>

View file

@ -24,10 +24,10 @@
</authorgroup>
</chapterinfo>
<title>Electronic Mail</title>
<title>電子郵件</title>
<sect1 id="mail-synopsis">
<title>Synopsis</title>
<title>概述</title>
<indexterm><primary>email</primary></indexterm>
<para><quote>Electronic Mail</quote>, better known as email, is one of the

View file

@ -1,8 +1,8 @@
<!--
The FreeBSD Documentation Project
The FreeBSD Traditional Chinese Documentation Project
$FreeBSD$
Original revision: 1.95
Original revision: 1.96
-->
<chapter id="printing">
@ -25,95 +25,89 @@
</authorgroup>
</chapterinfo>
<title>Printing</title>
<title>列印</title>
<sect1 id="printing-synopsis">
<title>Synopsis</title>
<title>概述</title>
<indexterm><primary>LPD spooling system</primary></indexterm>
<indexterm><primary>LPD 緩衝系統</primary></indexterm>
<indexterm><primary>printing</primary></indexterm>
<indexterm><primary>列印</primary></indexterm>
<para>FreeBSD can be used to print with a wide variety of printers, from the
oldest impact printer to the latest laser printers, and everything in
between, allowing you to produce high-quality printed output from the
applications you run.</para>
<para>FreeBSD 可以和各式各樣的印表機搭配列印,
從最老的撞針式印表機到最新的雷射印表機都沒問題,
讓您的應用程式可以產生出高品質的文件列印輸出。</para>
<para>也可以把 FreeBSD 設定成一台網路列印伺服器;這時候的 FreeBSD
能接收其他電腦送來的列印工作,包括其他 FreeBSD 的電腦、&windows;
的電腦以及 &macos; 的電腦。 FreeBSD
會確保同時只有一件文件正在列印,而且可以統計哪個使用者及機器印得最多,
還有就是印出接下來是誰的文件這類的<quote>標題</quote>頁等。</para>
<para>FreeBSD can also be configured to act as a print server on a
network; in this capacity FreeBSD can receive print jobs from a variety
of other computers, including other FreeBSD computers, &windows; and &macos;
hosts. FreeBSD will ensure that one job at a time is printed, and can
keep statistics on which users and machines are doing the most printing,
produce <quote>banner</quote> pages showing who's printout is who's, and
more.</para>
<para>After reading this chapter, you will know:</para>
<para>讀完這章,您將了解:</para>
<itemizedlist>
<listitem>
<para>How to configure the FreeBSD print spooler.</para>
<para>如何設定 FreeBSD 的列印多工緩衝處理器。</para>
</listitem>
<listitem>
<para>How to install print filters, to handle special print jobs
differently, including converting incoming documents to print
formats that your printers understand.</para>
<para>如何安裝列印過濾器以分別處理特殊的列印工作,
包括把收到的文件轉換成您的印表機看得懂的列印格式等。</para>
</listitem>
<listitem>
<para>How to enable header, or banner pages on your printout.</para>
<para>了解如何在您列印時順便印出頁首或標題。</para>
</listitem>
<listitem>
<para>How to print with printers connected to other computers.</para>
<para>如何利用別台電腦上的印表機列印。</para>
</listitem>
<listitem>
<para>How to print with printers connected directly to the
network.</para>
<para>如何利用直接接在網路上的印表機列印。</para>
</listitem>
<listitem>
<para>How to control printer restrictions, including limiting the size
of print jobs, and preventing certain users from printing.</para>
<para>如何控制印表機的權限,包括限制列印工作的檔案大小,
以及不允許特定使用者列印等。</para>
</listitem>
<listitem>
<para>How to keep printer statistics, and account for printer
usage.</para>
<para>如何記下印表機的統計資料,以及各帳號的印表機使用量。</para>
</listitem>
<listitem>
<para>How to troubleshoot printing problems.</para>
<para>如何解決列印時遇到的問題。</para>
</listitem>
</itemizedlist>
<para>Before reading this chapter, you should:</para>
<para>在開始閱讀這章之前,您需要︰</para>
<itemizedlist>
<listitem>
<para>Know how to configure and install a new kernel
(<xref linkend="kernelconfig">).</para>
<para>要有設定、編譯 kernel 的基礎概念
(<xref linkend="kernelconfig">)</para>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="printing-intro-spooler">
<title>Introduction</title>
<title>介紹</title>
<para>In order to use printers with FreeBSD, you may set
them up to work with the Berkeley line printer spooling system,
also known as the <application>LPD</application> spooling system,
or just <application>LPD</application>.
It is the standard printer control system in FreeBSD. This
chapter introduces <application>LPD</application> and
will guide you through its configuration.</para>
<para>要在 FreeBSD 上使用印表機,您需要設定好 Berkeley
行列式印表機列印緩衝系統,又稱為 <application>LPD</application>
列印緩衝系統,或者就叫 <application>LPD</application>。
這是 FreeBSD 標準的印表機控制系統,本章會介紹並教您如何設定
<application>LPD</application></para>
<para>If you are already familiar with
<application>LPD</application> or another printer spooling
system, you may wish to skip to section <link
linkend="printing-intro-setup">Basic Setup</link>.</para>
<para>如果您已經對 <application>LPD</application>
或是其他列印緩衝系統很熟悉了,
您可以直接跳到<link linkend="printing-intro-setup">基本設定</link>。
</para>
<para><application>LPD</application> controls everything about a
host's printers. It is responsible for a number of things:</para>
<para><application>LPD</application> 控制著主機上印表機的一切。
這些事情都是它在負責的:</para>
<itemizedlist>
<listitem>
@ -532,69 +526,14 @@ ppc0: FIFO with 16/16/8 bytes threshold</screen>
follows.</para>
</sect4>
</sect3>
<sect3 id="printing-dev-ports">
<title>Adding <filename>/dev</filename> Entries for the
Ports</title>
<note><para>FreeBSD&nbsp;5.0 includes the <literal>devfs</literal>
filesystem which automatically creates device nodes as
needed. If you are running a version of FreeBSD with
<literal>devfs</literal> enabled then you can safely skip
this section.</para></note>
<para>Even though the kernel may support communication along a
serial or parallel port, you will still need a software
interface through which programs running on the system can
send and receive data. That is what entries in the
<filename>/dev</filename> directory are for.</para>
<para><emphasis>To add a <filename>/dev</filename> entry for a
port:</emphasis></para>
<procedure>
<step>
<para>Become <username>root</username> with the &man.su.1; command.
Enter the <username>root</username> password when prompted.</para>
</step>
<step>
<para>Change to the <filename>/dev</filename>
directory:</para>
<screen>&prompt.root; <userinput>cd /dev</userinput></screen>
</step>
<step>
<para>Type:</para>
<screen>&prompt.root; <userinput>./MAKEDEV <replaceable>port</replaceable></userinput></screen>
<para>Where <replaceable>port</replaceable> is the device
entry for the port you want to make. Use
<literal>lpt0</literal> for the printer on the first parallel port,
<literal>lpt1</literal> for the printer on the second port, and so on; use
<literal>ttyd0</literal> for the first serial port,
<literal>ttyd1</literal> for the second, and so on.</para>
</step>
<step>
<para>Type:</para>
<screen>&prompt.root; <userinput>ls -l <replaceable>port</replaceable></userinput></screen>
<para>to make sure the device entry got created.</para>
</step>
</procedure>
<sect4 id="printing-parallel-port-mode">
<sect3 id="printing-parallel-port-mode">
<title>Setting the Communication Mode for the Parallel
Port</title>
<para>When you are using the parallel interface, you can choose
whether FreeBSD should use interrupt-driven or polled
communication with the printer. The generic printer
device driver (&man.lpt.4;) on FreeBSD&nbsp;4.X and 5.X
device driver (&man.lpt.4;) on FreeBSD
uses the &man.ppbus.4; system, which controls the port
chipset with the &man.ppc.4; driver.</para>
@ -639,15 +578,7 @@ ppc0: FIFO with 16/16/8 bytes threshold</screen>
<itemizedlist>
<listitem>
<para>If you want interrupt-driven mode, for FreeBSD&nbsp;4.X add the
<literal>irq</literal> specifier:</para>
<programlisting>device ppc0 at isa? irq <replaceable>N</replaceable></programlisting>
<para>Where <replaceable>N</replaceable> is the IRQ
number for your computer's parallel port.</para>
<para>For FreeBSD&nbsp;5.X, edit the following line:</para>
<para>If you want interrupt-driven mode, edit the following line:</para>
<programlisting>hint.ppc.0.irq="<replaceable>N</replaceable>"</programlisting>
@ -661,22 +592,14 @@ ppc0: FIFO with 16/16/8 bytes threshold</screen>
</listitem>
<listitem>
<para>If you want polled mode, do not add the
<literal>irq</literal> specifier:</para>
<para>For FreeBSD&nbsp;4.X, use the following line in
your kernel configuration file:</para>
<programlisting>device ppc0 at isa?</programlisting>
<para>For FreeBSD&nbsp;5.X, simply remove in your
<para>If you want polled mode, remove in your
<filename>/boot/device.hints</filename> file, the
following line:</para>
<programlisting>hint.ppc.0.irq="<replaceable>N</replaceable>"</programlisting>
<para>In some cases, this is not enough to put the
port in polled mode under FreeBSD&nbsp;5.X. Most of
port in polled mode under FreeBSD. Most of
time it comes from &man.acpi.4; driver, this latter
is able to probe and attach devices, and therefore,
control the access mode to the printer port. You
@ -721,9 +644,9 @@ ppc0: FIFO with 16/16/8 bytes threshold</screen>
<filename>/etc/rc.local</filename> file to set the mode each
time your system boots. See &man.lptcontrol.8; for more
information.</para>
</sect4>
</sect3>
<sect4 id="printing-testing">
<sect3 id="printing-testing">
<title>Checking Printer Communications</title>
<para>Before proceeding to configure the spooling system, you
@ -762,7 +685,7 @@ showpage</programlisting>
accommodations.</para>
</note>
<sect5 id="printing-checking-parallel">
<sect4 id="printing-checking-parallel">
<title>Checking a Parallel Printer</title>
<indexterm>
@ -826,9 +749,9 @@ showpage</programlisting>
<para>You should see something print. Do not worry if the
text does not look right; we will fix such things
later.</para>
</sect5>
</sect4>
<sect5 id="printing-checking-serial">
<sect4 id="printing-checking-serial">
<title>Checking a Serial Printer</title>
<indexterm>
@ -923,9 +846,8 @@ showpage</programlisting>
<para>You should see something print. Do not worry if the
text does not look right; we will fix that later.</para>
</sect5>
</sect4>
</sect3>
</sect4>
</sect3>
<sect3 id="printing-printcap">
<title>Enabling the Spooler: the <filename>/etc/printcap</filename>
@ -1196,8 +1118,8 @@ bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\
<sect4 id="printing-device">
<title>Identifying the Printer Device</title>
<para>In the <link linkend="printing-dev-ports">Adding
<filename>/dev</filename> Entries for the Ports</link>
<para>In the
Entries for the Ports
section, we identified which entry in the
<filename>/dev</filename> directory FreeBSD will use to
communicate with the printer. Now, we tell

View file

@ -2,7 +2,7 @@
The FreeBSD Documentation Project
$FreeBSD$
Original revision: 1.54
Original revision: 1.58
-->
<chapter id="users">
@ -22,7 +22,8 @@
<sect1 id="users-synopsis">
<title>概述</title>
<para>FreeBSD 允許多個使用者同時使用電腦。當然,這並不是很多人同時坐在同一台電腦前
<para>FreeBSD 允許多個使用者同時使用電腦。 當然,
這並不是很多人同時坐在同一台電腦前
<footnote>
<para>Well..除非您連接 multiple terminals這種情況我們會在 <xref
linkend="serialcomms"> 講到。</para>
@ -45,11 +46,13 @@
</listitem>
<listitem>
<para>如何更改帳號的基本資料,像是帳號全名,或是使用的 shell 種類。</para>
<para>如何更改帳號的基本資料,像是帳號全名,或是使用的 shell
種類。</para>
</listitem>
<listitem>
<para>如何針對帳號、群組來設限,比如:允許存取記憶體或 CPU 資源多寡等。</para>
<para>如何針對帳號、群組來設限,比如:允許存取記憶體或 CPU
資源多寡等。</para>
</listitem>
<listitem>
@ -57,11 +60,11 @@
</listitem>
</itemizedlist>
<para>在閱讀這章之前,您應當了解</para>
<para>在開始閱讀這章之前,您需要</para>
<itemizedlist>
<listitem>
<para>瞭解 &unix; 及 FreeBSD (<xref
<para>瞭解 &unix; 及 FreeBSD (<xref
linkend="basics">)的基礎概念。</para>
</listitem>
</itemizedlist>
@ -70,155 +73,137 @@
<sect1 id="users-introduction">
<title>介紹</title>
<para>系統的所有存取是經由帳號來進行,而所有的程式 process 是由使用者來進行,所以
使用者及帳號管理,乃是 FreeBSD 系統上不可或缺的重點。</para>
<para>系統的所有存取是經由帳號來進行,而所有的程式 process
是由使用者來進行,所以使用者及帳號的管理,乃是 FreeBSD
系統上不可或缺的重點。</para>
<para>Every account on a FreeBSD system has certain information associated
with it to identify the account.</para>
<para>所有於 FreeBSD 系統中的帳號皆包含下列相關資訊用來辨識身份。</para>
<variablelist>
<varlistentry>
<term>User name</term>
<term>使用者名稱</term>
<listitem>
<para>The user name as it would be typed at the
<prompt>login:</prompt> prompt. User names must be unique across
the computer; you may not have two users with the same
user name. There are a number of rules for creating valid user
names, documented in &man.passwd.5;; you would typically use user
names that consist of eight or fewer all lower case
characters.</para>
<para>使用者名稱要輸入在 <prompt>login:</prompt> 提示出現後。
使用者名稱必須是獨一無二,
不能有重複的使用者名稱。
至於如何建立有效使用者名稱的規則,請參閱 &man.passwd.5; 說明,
通常使用者名稱是以八個以內的小寫字母所組成。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Password</term>
<term>密碼</term>
<listitem>
<para>Each account has a password associated with it. The password
may be blank, in which case no password will be required to access
the system. This is normally a very bad idea; every account
should have a password.</para>
<para>每個帳號都可擁有一組密碼。 密碼也可以不設,
如此就不需密碼即可登入系統,但通常這並非妙策,
每個帳號都應設定一組密碼。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>User ID (UID)</term>
<term>使用者代號 (User ID, UID)</term>
<listitem>
<para>The UID is a number, traditionally from 0 to 65535<footnote id="users-largeuidgid">
<para>It is possible to use UID/GIDs as large as
4294967295, but such IDs can cause serious problems
with software that makes assumptions about the values
of IDs.</para>
</footnote>, used to uniquely identify
the user to the system. Internally, FreeBSD uses the UID to
identify users&mdash;any FreeBSD commands that allow you to
specify a user name will convert it to the UID before working with
it. This means that you can have several accounts with different
user names but the same UID. As far as FreeBSD is concerned these
accounts are one user. It is unlikely you will ever need to do
this.</para>
<para>UID 是系統用來辨識使用者的數字,通常範圍是從 0 到 65535 <footnote id="users-largeuidgid">
<para>UID/GID 最大可使用至 4294967295但這樣的 ID
可能會對已假設範圍的軟體造成嚴重問題。</para>
</footnote>。 FreeBSD 內部是使用 UID 來辨識使用者 &mdash;
FreeBSD 在執行任何指定使用者的指令之前,都會先把使用者名稱轉換為
UID。 也就是說,比如可以有數個不同的使用者名稱,
但是都使用同一個 UID對 FreeBSD 來說,這些帳號都只代表同一使用者。
不過,實際上需要這樣做的可能性不大。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Group ID (GID)</term>
<term>群組代號 (Group ID, GID)</term>
<listitem>
<para>The GID is a number, traditionally from 0 to 65535<footnoteref linkend="users-largeuidgid">, used to uniquely identify
the primary group that the user belongs to. Groups are a
mechanism for controlling access to resources based on a user's
GID rather than their UID. This can significantly reduce the size
of some configuration files. A user may also be in more than one
group.</para>
<para>GID 是系統用來辨識使用者所屬群組的數字,通常範圍是從 0 到 65535<footnoteref linkend="users-largeuidgid">
。 用群組來控制資源存取,可有效減少一些設定檔的大小。
此外,使用者還可以同時屬於多個不同的群組。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Login class</term>
<term>登入分類(Login classes)</term>
<listitem>
<para>Login classes are an extension to the group mechanism that
provide additional flexibility when tailoring the system to
different users.</para>
<para>
登入分類是群組的延伸機制,
提供了不同的使用者更彈性的。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Password change time</term>
<term>密碼變更期限</term>
<listitem>
<para>By default FreeBSD does not force users to change their
passwords periodically. You can enforce this on a per-user basis,
forcing some or all of your users to change their passwords after
a certain amount of time has elapsed.</para>
<para>FreeBSD 預設並不要求使用者週期性的更改密碼。您可以強制某些或
全部的使用者在指定的期間過後必須更改密碼。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Account expiry time</term>
<term>帳號期限</term>
<listitem>
<para>By default FreeBSD does not expire accounts. If you are
creating accounts that you know have a limited lifespan, for
example, in a school where you have accounts for the students,
then you can specify when the account expires. After the expiry
time has elapsed the account cannot be used to log in to the
system, although the account's directories and files will
remain.</para>
<para>FreeBSD 的帳號沒有預設的期限,如果您已知道帳號的使用期限,
例如,學校中提供學生使用的帳號,可在建立帳號時指定帳號的期限。
當帳號過期後會無法登入系統,但該帳號的目錄及檔案則會保留。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>User's full name</term>
<term>使用者全名</term>
<listitem>
<para>The user name uniquely identifies the account to FreeBSD, but
does not necessarily reflect the user's real name. This
information can be associated with the account.</para>
<para>FreeBSD 的帳號使用使用者名稱用來辨識,但使用者名稱並不一定代表
真實使用者的姓名。為帳號所需的相關資訊。</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Home directory</term>
<term>家目錄</term>
<listitem>
<para>The home directory is the full path to a directory on the
system in which the user will start when logging on to the
system. A common convention is to put all user home directories
under
<filename>/home/<replaceable>username</replaceable></filename>
or <filename>/usr/home/<replaceable>username</replaceable></filename>.
The user would store their personal files in their home directory,
and any directories they may create in there.</para>
<para>家目錄為使用者登入系統時的所在目錄的完整路徑。
通常會將所有使用者的家目錄放置於
<filename>/home/<replaceable>使用者名稱</replaceable></filename>
或 <filename>/usr/home/<replaceable>使用者名稱</replaceable></filename>。
使用者可以將其個人的資料放置於其家目錄之中,並可以在此目錄底下
建立新的目錄</para>
</listitem>
</varlistentry>
<varlistentry>
<term>User shell</term>
<term>使用者 Shell</term>
<listitem>
<para>The shell provides the default environment users use to
interact with the system. There are many different kinds of
shells, and experienced users will have their own preferences,
which can be reflected in their account settings.</para>
<para>Shell 提供預設的環境讓使用者與系統互動。
Shell 擁有數種不同的種類, 可供進階使用者依使用習慣選擇。</para>
</listitem>
</varlistentry>
</variablelist>
<para>There are three main types of accounts: the <link
linkend="users-superuser">Superuser</link>, <link
linkend="users-system">system users</link>, and <link
linkend="users-user">user accounts</link>. The Superuser
account, usually called <username>root</username>, is used to
manage the system with no limitations on privileges. System
users run services. Finally, user accounts are used by real
people, who log on, read mail, and so forth.</para>
<!--
Superuser: 系統管理者帳號
System users: 系統帳號
user accounts: 使用者帳號
-->
<para>帳號主要分為下列三類: <link
linkend="users-superuser">系統管理者帳號</link>, <link
linkend="users-system">系統帳號</link>,及 <link
linkend="users-user">使用者帳號</link>。 系統管理者帳號的帳號
通常為 <username>root</username>,擁有最大的權限來管理系統。
系統帳號用來執行伺服器服務。最後,使用者帳號供真正的使用者使用,
可登入、讀信等等。</para>
</sect1>
<sect1 id="users-superuser">
<title>The Superuser Account</title>
<title>系統管理者帳號</title>
<indexterm>
<primary>accounts</primary>
@ -251,7 +236,7 @@
</sect1>
<sect1 id="users-system">
<title>System Accounts</title>
<title>系統帳號</title>
<indexterm>
<primary>accounts</primary>
@ -287,7 +272,7 @@
</sect1>
<sect1 id="users-user">
<title>User Accounts</title>
<title>使用者帳號</title>
<indexterm>
<primary>accounts</primary>
@ -310,17 +295,16 @@
</sect1>
<sect1 id="users-modifying">
<title>Modifying Accounts</title>
<title>更改帳號</title>
<indexterm>
<primary>accounts</primary>
<secondary>modifying</secondary>
</indexterm>
<para>There are a variety of different commands available in the
&unix; environment to manipulate user accounts. The most common
commands are summarized below, followed by more detailed
examples of their usage.</para>
<para>在 &unix; 的環境之中提供了各式不同的指令管理使用者帳號,
以下為較常使用的指令摘要及更詳細的使用範例。
</para>
<informaltable frame="none" pgwide="1">
<tgroup cols="2">
@ -329,34 +313,30 @@
<thead>
<row>
<entry>Command</entry>
<entry>Summary</entry>
<entry>指令</entry>
<entry>摘要</entry>
</row>
</thead>
<tbody>
<row>
<entry>&man.adduser.8;</entry>
<entry>The recommended command-line application for adding
new users.</entry>
<entry>新增使用者。</entry>
</row>
<row>
<entry>&man.rmuser.8;</entry>
<entry>The recommended command-line application for
removing users.</entry>
<entry>移除使用者。</entry>
</row>
<row>
<entry>&man.chpass.1;</entry>
<entry>A flexible tool to change user database information.</entry>
<entry>更改使用者資料。</entry>
</row>
<row>
<entry>&man.passwd.1;</entry>
<entry>The simple command-line tool to change user
passwords.</entry>
<entry>更改使用者密碼。</entry>
</row>
<row>
<entry>&man.pw.8;</entry>
<entry>A powerful and flexible tool to modify all aspects
of user accounts.</entry>
<entry>修改使用者的各種資料。</entry>
</row>
</tbody>
</tgroup>
@ -376,109 +356,15 @@
<primary><filename class="directory">/usr/share/skel</filename></primary>
</indexterm>
<indexterm><primary>skeleton directory</primary></indexterm>
<para>&man.adduser.8; is a simple program for
adding new users. It creates entries in the system
<filename>passwd</filename> and <filename>group</filename>
files. It will also create a home directory for the new user,
copy in the default configuration files (<quote>dotfiles</quote>) from
<filename>/usr/share/skel</filename>, and can optionally mail
the new user a welcome message.</para>
<para>In &os;&nbsp;5.0, &man.adduser.8; was rewritten from a
Perl script to a shell script that acts as wrapper around
&man.pw.8;, so its usage is slightly different on &os;&nbsp;4.X
and &os;&nbsp;5.X.</para>
<para>To create the initial configuration file, use
<command>adduser -s -config_create</command>.
<footnote>
<para>The <option>-s</option> makes &man.adduser.8;
default to
quiet. We use <option>-v</option> later when we want to
change defaults.</para>
</footnote>
Next, we configure &man.adduser.8;
defaults, and create our first user account, since using
<username>root</username> for normal usage is evil and
nasty.</para>
<para>&man.adduser.8; 是一支新增使用者的簡單程式。
它會建立資料於系統的 <filename>passwd</filename> 與
<filename>group</filename>
檔案之中。 同時也會建立使用者的家目錄,從 <filename>
/usr/share/skel</filename> 複製預設的組態檔(<quote>dotfiles</quote>)
並可以選擇性的郵件通知新使用者歡迎訊息。</para>
<example>
<title>Configuring <command>adduser</command> and adding a
user on &os;&nbsp;4.X</title>
<screen>&prompt.root; <userinput>adduser -v</userinput>
Use option ``-silent'' if you don't want to see all warnings and questions.
Check /etc/shells
Check /etc/master.passwd
Check /etc/group
Enter your default shell: csh date no sh tcsh zsh [sh]: <userinput>zsh</userinput>
Your default shell is: zsh -&gt; /usr/local/bin/zsh
Enter your default HOME partition: [/home]:
Copy dotfiles from: /usr/share/skel no [/usr/share/skel]:
Send message from file: /etc/adduser.message no
[/etc/adduser.message]: <userinput>no</userinput>
Do not send message
Use passwords (y/n) [y]: <userinput>y</userinput>
Write your changes to /etc/adduser.conf? (y/n) [n]: <userinput>y</userinput>
Ok, let's go.
Don't worry about mistakes. I will give you the chance later to correct any input.
Enter username [a-z0-9_-]: <userinput>jru</userinput>
Enter full name []: <userinput>J. Random User</userinput>
Enter shell csh date no sh tcsh zsh [zsh]:
Enter home directory (full path) [/home/jru]:
Uid [1001]:
Enter login class: default []:
Login group jru [jru]:
Login group is ``jru''. Invite jru into other groups: guest no
[no]: <userinput>wheel</userinput>
Enter password []:
Enter password again []:
Name: jru
Password: ****
Fullname: J. Random User
Uid: 1001
Gid: 1001 (jru)
Class:
Groups: jru wheel
HOME: /home/jru
Shell: /usr/local/bin/zsh
OK? (y/n) [y]: <userinput>y</userinput>
Added user ``jru''
Copy files from /usr/share/skel to /home/jru
Add another user? (y/n) [y]: <userinput>n</userinput>
Goodbye!
&prompt.root;</screen>
</example>
<para>In summary, we changed the default shell to
<application>zsh</application> (an additional shell found in
the Ports Collection), and turned off the sending of a welcome mail to
added users. We then saved the configuration,
created an account for <username>jru</username>, and made
sure <username>jru</username> is in <username>wheel</username>
group (so that she may assume the role of
<username>root</username> with the &man.su.1;
command.)</para>
<note>
<para>The password you type in is not echoed, nor are asterisks
displayed. Make sure that you do not mistype the password.
</para>
</note>
<note>
<para>Just use &man.adduser.8; without arguments
from now on, and you will not have to go through changing the
defaults. If the program asks you to change the defaults,
exit the program, and try the <option>-s</option>
option.</para>
</note>
<example>
<title>Adding a user on &os;&nbsp;5.X</title>
<title>在 &os; 內新增使用者</title>
<screen>&prompt.root; <userinput>adduser</userinput>
Username: <userinput>jru</userinput>
@ -510,6 +396,11 @@ Add another user? (yes/no): <userinput>no</userinput>
Goodbye!
&prompt.root;</screen>
</example>
<note>
<para>您輸入的密碼並不會回應到螢幕,所以不會以星號顯示
。 請確定您所輸入的密碼無誤。</para>
</note>
</sect2>
<sect2 id="users-rmuser">
@ -521,62 +412,50 @@ Goodbye!
<secondary>removing</secondary>
</indexterm>
<para>You can use &man.rmuser.8; to
completely remove a user from the system.
&man.rmuser.8; performs the following
steps:</para>
<para>您可以使用 &man.rmuser.8; 來將使用者從系統之中完全移除
&man.rmuser.8; 會執行以下動作:</para>
<procedure>
<step>
<para>Removes the user's &man.crontab.1; entry (if
any).</para>
<para>移除該使用者的 &man.crontab.1; 資料 (如果存在)。</para>
</step>
<step>
<para>Removes any &man.at.1; jobs belonging to the
user.</para>
<para>移除所有屬於該使用者的 &man.at.1; 工作。</para>
</step>
<step>
<para>Kills all processes owned by the user.</para>
<para>中止所有該使用者擁有的程序。</para>
</step>
<step>
<para>Removes the user from the system's local password
file.</para>
<para>移除系統本機密碼檔中該使用者的資料。</para>
</step>
<step>
<para>Removes the user's home directory (if it is owned by
the user).</para>
<para>移除該使用者的家目錄 (如果為該使用者所有)。</para>
</step>
<step>
<para>Removes the incoming mail files belonging to the user
from <filename>/var/mail</filename>.</para>
<para>移除 <filename>/var/mail</filename> 中屬於該使用者的郵件。</para>
</step>
<step>
<para>Removes all files owned by the user from temporary
file storage areas such as <filename>/tmp</filename>.</para>
<para>移除暫存空間 (如: <filename>/tmp</filename>) 中所有屬於該使用者的檔案。</para>
</step>
<step>
<para>Finally, removes the username from all groups to which
it belongs in <filename>/etc/group</filename>.
<para>最後,在 <filename>/etc/group</filename> 檔內移除該使用者帳號。
</para>
<note>
<para>If a group becomes empty and the group name is the
same as the username, the group is removed; this
complements the per-user unique groups created by
&man.adduser.8;.</para>
<para>若該群組已無成員,或者是群組名稱與該使用者名稱相同時,
則群組將會被移除; 此操作會與 &man.adduser.8;
所建立的帳號群組相對應。</para>
</note>
</para>
</step>
</procedure>
<para>&man.rmuser.8; cannot be used to remove
superuser accounts, since that is almost always an indication
of massive destruction.</para>
<para>&man.rmuser.8; 無法移除系統管理者帳號帳號,
因為這即代表嚴重的破壞行為。</para>
<para>By default, an interactive mode is used, which attempts to
make sure you know what you are doing.</para>
<para>為了確認您的操作,預設採互動模式。</para>
<example>
<title><command>rmuser</command> Interactive Account Removal</title>
<title><command>rmuser</command> 帳號移除</title>
<screen>&prompt.root; <userinput>rmuser jru</userinput>
Matching password entry:
@ -597,27 +476,19 @@ Removing files belonging to jru from /var/tmp/vi.recover: done.
<title><command>chpass</command></title>
<indexterm><primary><command>chpass</command></primary></indexterm>
<para>&man.chpass.1; changes user database
information such as passwords, shells, and personal
information.</para>
<para>&man.chpass.1; 可更改使用者資料如: 密碼、Shell及個人資訊。</para>
<para>Only system administrators, as the superuser, may change
other users' information and passwords with
&man.chpass.1;.</para>
<para>僅系統管理者即系統管理者帳號可利用 &man.chpass.1; 更改其他使用者的資訊及密碼</para>
<para>When passed no options, aside from an optional username,
&man.chpass.1; displays an editor
containing user information. When the user exists from the
editor, the user database is updated with the new
information.</para>
<para>除了指定使用者名稱,當不加參數時,&man.chpass.1; 會將使用者資訊顯示於編輯器當中。
並於使用者離開編輯器時更新使用者資訊。</para>
<note>
<para>In &os;&nbsp;5.X, you will be asked for your password
after exiting the editor if you are not the superuser.</para>
<para>若您並非系統管理者帳號,在離開編輯器前會詢問您的密碼。</para>
</note>
<example>
<title>Interactive <command>chpass</command> by Superuser</title>
<title>系統管理者帳號 <command>chpass</command></title>
<screen>#Changing user database information for jru.
Login: jru
@ -636,11 +507,10 @@ Home Phone:
Other information:</screen>
</example>
<para>The normal user can change only a small subset of this
information, and only for themselves.</para>
<para>一般使用者僅可更改自己的少部份資訊。</para>
<example>
<title>Interactive <command>chpass</command> by Normal User</title>
<title>一般使用者 <command>chpass</command></title>
<screen>#Changing user database information for jru.
Shell: /usr/local/bin/zsh
@ -652,14 +522,10 @@ Other information:</screen>
</example>
<note>
<para>&man.chfn.1; and &man.chsh.1; are
just links to &man.chpass.1;, as
are &man.ypchpass.1;,
&man.ypchfn.1;, and
&man.ypchsh.1;. NIS support is automatic, so
specifying the <literal>yp</literal> before the command is
not necessary. If this is confusing to you, do not worry, NIS will
be covered in <xref linkend="network-servers">.</para>
<para>&man.chfn.1; 與 &man.chsh.1; 即為 &man.chpass.1;,也同
&man.ypchpass.1;、&man.ypchfn.1; 與 &man.ypchsh.1;。
NIS 支援是自動的,所以無需在指令前加上 <literal>yp</literal>。
若這會困擾您,請不必擔心,<xref linkend="network-servers"> 將函蓋 NIS 的部份的說明。</para>
</note>
</sect2>
<sect2 id="users-passwd">
@ -670,17 +536,15 @@ Other information:</screen>
<primary>accounts</primary>
<secondary>changing password</secondary>
</indexterm>
<para>&man.passwd.1; is the usual way to
change your own password as a user, or another user's password
as the superuser.</para>
<para>&man.passwd.1; 是更改密碼常用的方式,除了超級管理者可更改其他使用者的密碼外
使用者僅能更改自己的密碼。</para>
<note>
<para>To prevent accidental or unauthorized changes, the original
password must be entered before a new password can be set.</para>
<para>為了避免意外或未經同意的修改,在更新密碼前需輸入原密碼。</para>
</note>
<example>
<title>Changing Your Password</title>
<title>更改您的密碼</title>
<screen>&prompt.user; <userinput>passwd</userinput>
Changing local password for jru.
@ -692,7 +556,7 @@ passwd: done</screen>
</example>
<example>
<title>Changing Another User's Password as the Superuser</title>
<title>以系統管理者帳號去更改其他使用者的密碼</title>
<screen>&prompt.root; <userinput>passwd jru</userinput>
Changing local password for jru.
@ -703,10 +567,8 @@ passwd: done</screen>
</example>
<note>
<para>As with &man.chpass.1;,
&man.yppasswd.1; is just a link to
&man.passwd.1;, so NIS works with either
command.</para>
<para>&man.chpass.1;、
&man.yppasswd.1; 即為 &man.passwd.1;,皆支援 NIS。</para>
</note>
</sect2>
@ -715,32 +577,32 @@ passwd: done</screen>
<title><command>pw</command></title>
<indexterm><primary><command>pw</command></primary></indexterm>
<para>&man.pw.8; is a command line utility to create, remove,
modify, and display users and groups. It functions as a front
end to the system user and group files. &man.pw.8;
has a very powerful set of command line options that make it
suitable for use in shell scripts, but new users may find it
more complicated than the other commands presented
here.</para>
<para>&man.pw.8; 用來建立、移除、修改及查詢使用者及群組。
其功能即為系統使用者及群組檔案的前端。&man.pw.8; 擁有大量的指令參數
較適合使用於 shell script 中,對新手來說會此指令較其他指令複雜許多。
</para>
</sect2>
</sect1>
<sect1 id="users-limiting">
<title>對帳號的資源運用作限制</title>
<title>使用者資源限制</title>
<indexterm><primary>limiting users</primary></indexterm>
<indexterm>
<primary>accounts</primary>
<secondary>limiting</secondary>
</indexterm>
<para>If you have users, the ability to limit their system use may
have come to mind. FreeBSD provides
several ways an administrator can limit the amount of system
resources an individual may use. These limits are
divided into two sections: disk quotas, and other resource
limits.</para>
<!--
login class: 登入分級
login capability: 登入容量
-->
<para>
若您擁有許多使用者,接下會想到該如何限制使用的資源。
FreeBSD 提供管理者許多方法來限制系統的資源給每個人使用。
這些限制分為兩個部份: 磁碟限額,以及其他資源限制。
</para>
<indexterm><primary>quotas</primary></indexterm>
<indexterm>
@ -748,59 +610,46 @@ passwd: done</screen>
<secondary>quotas</secondary>
</indexterm>
<indexterm><primary>disk quotas</primary></indexterm>
<para>Disk quotas limit disk usage to users, and
they
provide a way to quickly check that usage without
calculating it every time. Quotas are discussed in <xref
linkend="quotas">.</para>
<para>磁碟限額可以限制使用者的磁碟用量,
它提供了一種方法可以快速的檢查並計算用量
而不需每次重新計算,
關於磁碟限額將於 <xref linkend="quotas"> 會討論。</para>
<para>The other resource limits include ways to limit the amount of
CPU, memory, and other resources a user may consume. These are
defined using login classes and are discussed here.</para>
<para>其他資源限制包含了 CPU、記憶體、以及其他每個使用者可使用
的資源做限制,這些限制可使用 Login class 來定義並於在本章討論。</para>
<indexterm>
<primary><filename>/etc/login.conf</filename></primary>
</indexterm>
<para>Login classes are defined in
<filename>/etc/login.conf</filename>. The precise semantics are
beyond the scope of this section, but are described in detail in the
&man.login.conf.5; manual page. It is sufficient to say that each
user is assigned to a login class (<literal>default</literal> by
default), and that each login class has a set of login capabilities
associated with it. A login capability is a
<literal><replaceable>name</replaceable>=<replaceable>value</replaceable></literal>
pair, where <replaceable>name</replaceable> is a well-known
identifier and <replaceable>value</replaceable> is an arbitrary
string processed accordingly depending on the name. Setting up login
classes and capabilities is rather straight-forward and is also
described in &man.login.conf.5;.</para>
<para>Login class 定義於
<filename>/etc/login.conf</filename>。 明確語意不會在本節說明
但詳細的描述會在 &man.login.conf.5; 文件中。 每使用者預設被
分配到一個 Login class 中 (預設為 <literal>default</literal>)
而每個 Login class 都有其資源的限制(Login capabilitiy)。
Login capabilitiy 以 <literal><replaceable>名稱</replaceable>=<replaceable>值</replaceable></literal> 成對,
<replaceable>名稱</replaceable> 代表資源的種類,而 <replaceable>值</replaceable>
為任意的字串,為對應名稱的參數。 設定 Login class 及 Login capability 相當簡單,並同樣在
&man.login.conf.5; 中詳細說明。</para>
<note>
<para>The system does not normally read the configuration in
<filename>/etc/login.conf</filename> directly, but reads the database
file <filename>/etc/login.conf.db</filename> which provides
faster lookups.
To generate <filename>/etc/login.conf.db</filename> from
<filename>/etc/login.conf</filename>, execute the following
command:</para>
<para>系統不會直接讀取 <filename>/etc/login.conf</filename> 的組態
而是讀取提供查詢較快的 <filename>/etc/login.conf.db</filename> 資料庫檔。
要從 <filename>/etc/login.conf</filename> 產生 <filename>/etc/login.conf.db</filename>
需要執行以下指令:</para>
<screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>
</note>
<para>Resource limits are different from plain vanilla login
capabilities in two ways. First, for every limit, there is a soft
(current) and hard limit. A soft limit may be adjusted by the user
or application, but may be no higher than the hard limit. The latter
may be lowered by the user, but never raised. Second, most resource
limits apply per process to a specific user, not the user as a whole.
Note, however, that these differences are mandated by the specific
handling of the limits, not by the implementation of the login
capability framework (i.e., they are not <emphasis>really</emphasis>
a special case of login capabilities).</para>
<para>資源限制於一般的 Login capability 有兩點不同。
第一,每種限制分為軟性限制及硬性限制。
軟性限制可由使用者或應用程式調整,但不能高於硬性限制。
後者限制可被使用者降低,但無法再提高。
第二,多數資源限制是針對每個使用者的個別行程限制,而不是使用者的所有行程。
注意,這些差異是由指定的限制程式托管,並非實作於 Login capability 的架構
(例如,這些不是 <emphasis>真正</emphasis> 登入容量的特例)。</para>
<para>And so, without further ado, below are the most commonly used
resource limits (the rest, along with all the other login
capabilities, may be found in &man.login.conf.5;).</para>
<para>另外,為了避免麻煩,以下為幾個常用的資源限制
(剩下及其他的 Login capability 可在 &man.login.conf.5; 中找到說明)。</para>
<variablelist>
<varlistentry>
@ -833,7 +682,7 @@ passwd: done</screen>
<secondary>cputime</secondary>
</indexterm>
<para>This is the maximum amount of CPU time a user's process may
consume. Offending processes will be killed by the kernel.
consume. Offending processes will be killed by the kernel.</para>
<note>
<para>This is a limit on CPU <emphasis>time</emphasis>
@ -844,7 +693,6 @@ passwd: done</screen>
legitimate task&mdash;can easily use almost 100% of a CPU
for some time.</para>
</note>
</para>
</listitem>
</varlistentry>
@ -1016,7 +864,7 @@ passwd: done</screen>
</sect1>
<sect1 id="users-groups">
<title>Groups</title>
<title>群組</title>
<indexterm><primary>groups</primary></indexterm>
<indexterm>

View file

@ -675,7 +675,7 @@ DOS2UNIX_REGEX= .*\.(c|cpp|h)</programlisting>
</sect1>
<sect1 id="slow-configure">
<title>Configuring</title>
<title>設定</title>
<para>Include any additional customization commands in your
<filename>configure</filename> script and save it in the
@ -8446,13 +8446,9 @@ etc/orbit.conf.sample
<screen>&prompt.root; <userinput>(cd /var/tmp/$(make -V PORTNAME) && find -d * -type d) | sort | comm -13 OLD-DIRS - | sort -r | sed -e 's#^#@dirrm #' &gt;&gt; pkg-plist</userinput></screen>
<para>Finally, you need to tidy up the packing list by hand; it is not
<emphasis>all</emphasis> automated. Manual pages should be listed in
the port's <filename>Makefile</filename> under
<makevar>MAN<replaceable>n</replaceable></makevar>, and not in the
package list. User configuration files should be removed, or
installed as
<filename><replaceable>filename</replaceable>.sample</filename>.
<para>最後您應該手動整理檔案清單這不是全部自動化處理的。Man page 則應該利用 <makevar>MAN<replaceable>n</replaceable></makevar> 的方式
寫在 port 的 <filename>Makefile</filename> 而不是寫在檔案清單中。
使用者設定檔應該移除,或更名為<filename><replaceable>filename</replaceable>.sample</filename>。
The <filename>info/dir</filename> file should not be listed
and appropriate <filename>install-info</filename> lines should
be added as noted in the <link linkend="makefile-info">info