Move "Virtual Consoles and Terminals" to beginning of chapter. It
should be introduced first. Sponsored by: FreeBSD Mall, Inc.
This commit is contained in:
parent
277441b9e8
commit
2e4c283ab2
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=18285
1 changed files with 225 additions and 225 deletions
|
@ -33,6 +33,10 @@
|
|||
<para>After reading this chapter, you will know:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>How to use the <quote>virtual consoles</quote> of
|
||||
FreeBSD.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>How &unix; file permissions work.</para>
|
||||
</listitem>
|
||||
|
@ -61,14 +65,231 @@
|
|||
<listitem>
|
||||
<para>How to read manual pages for more information.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>How to use the <quote>virtual consoles</quote> of
|
||||
FreeBSD.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="consoles">
|
||||
<title>Virtual Consoles and Terminals</title>
|
||||
<indexterm><primary>virtual consoles</primary></indexterm>
|
||||
<indexterm><primary>terminals</primary></indexterm>
|
||||
|
||||
<para>FreeBSD can be used in various ways. One of them is typing commands
|
||||
to a text terminal. A lot of the flexibility and power of a &unix;
|
||||
operating system is readily available at your hands when using FreeBSD
|
||||
this way. This section describes what <quote>terminals</quote> and
|
||||
<quote>consoles</quote> are, and how you can use them in FreeBSD.</para>
|
||||
|
||||
<sect2 id="consoles-intro">
|
||||
<title>The Console</title>
|
||||
<indexterm><primary>console</primary></indexterm>
|
||||
|
||||
<para>If you have not configured FreeBSD to automatically start a
|
||||
graphical environment during startup, the system will present you with
|
||||
a login prompt after it boots, right after the startup scripts finish
|
||||
running. You will see something similar to:</para>
|
||||
|
||||
<screen>Additional ABI support:.
|
||||
Local package initialization:.
|
||||
Additional TCP options:.
|
||||
|
||||
Fri Sep 20 13:01:06 EEST 2002
|
||||
|
||||
FreeBSD/i386 (pc3.example.org) (ttyv0)
|
||||
|
||||
login:</screen>
|
||||
|
||||
<para>The messages might be a bit different on your system, but you will
|
||||
see something similar. The last two lines are what we are interested
|
||||
in right now. The second last line reads:</para>
|
||||
|
||||
<programlisting>FreeBSD/i386 (pc3.example.org) (ttyv0)</programlisting>
|
||||
|
||||
<para>This line contains some bits of information about the system you
|
||||
have just booted. You are looking at a <quote>FreeBSD</quote>
|
||||
console, running on an Intel or compatible processor of the x86
|
||||
architecture<footnote>
|
||||
<para>This is what <literal>i386</literal> means. Note that even if
|
||||
you are not running FreeBSD on an Intel 386 CPU, this is going to
|
||||
be <literal>i386</literal>. It is not the type of your processor,
|
||||
but the processor <quote>architecture</quote> that is shown
|
||||
here.</para>
|
||||
</footnote>. The name of this machine (every &unix; machine has a
|
||||
name) is <hostid>pc3.example.org</hostid>, and you are now looking
|
||||
at its system console—the <devicename>ttyv0</devicename>
|
||||
terminal.</para>
|
||||
|
||||
<para>Finally, the last line is always:</para>
|
||||
|
||||
<programlisting>login:</programlisting>
|
||||
|
||||
<para>This is the part where you are supposed to type in your
|
||||
<quote>username</quote> to log into FreeBSD. The next section
|
||||
describes how you can do this.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-login">
|
||||
<title>Logging into FreeBSD</title>
|
||||
|
||||
<para>FreeBSD is a multiuser, multiprocessing system. This is
|
||||
the formal description that is usually given to a system that can be
|
||||
used by many different people, who simultaneously run a lot of
|
||||
programs on a single machine.</para>
|
||||
|
||||
<para>Every multiuser system needs some way to distinguish one
|
||||
<quote>user</quote> from the rest. In FreeBSD (and all the
|
||||
&unix; like operating systems), this is accomplished by requiring that
|
||||
every user must <quote>log into</quote> the system before being able
|
||||
to run programs. Every user has a unique name (the
|
||||
<quote>username</quote>) and a personal, secret key (the
|
||||
<quote>password</quote>). FreeBSD will ask for these two before
|
||||
allowing a user to run any programs.</para>
|
||||
|
||||
<indexterm><primary>startup scripts</primary></indexterm>
|
||||
<para>Right after FreeBSD boots and finishes running its startup
|
||||
scripts<footnote>
|
||||
<para>Startup scripts are programs that are run automatically by
|
||||
FreeBSD when booting. Their main function is to set things up for
|
||||
everything else to run, and start any services that you have
|
||||
configured to run in the background doing useful things.</para>
|
||||
</footnote>, it will present you with a prompt and ask for a valid
|
||||
username:</para>
|
||||
|
||||
<screen>login:</screen>
|
||||
|
||||
<para>For the sake of this example, let us assume that your username is
|
||||
<username>john</username>. Type <literal>john</literal> at this prompt and press
|
||||
<keycap>Enter</keycap>. You should then be presented with a prompt to
|
||||
enter a <quote>password</quote>:</para>
|
||||
|
||||
<screen>login: <userinput>john</userinput>
|
||||
Password:</screen>
|
||||
|
||||
<para>Type in <username>john</username>'s password now, and press
|
||||
<keycap>Enter</keycap>. The password is <emphasis>not
|
||||
echoed!</emphasis> You need not worry about this right now. Suffice
|
||||
it to say that it is done for security reasons.</para>
|
||||
|
||||
<para>If you have typed your password correctly, you should by now be
|
||||
logged into FreeBSD and ready to try out all the available
|
||||
commands.</para>
|
||||
|
||||
<para>You should see the <acronym>MOTD</acronym> or message of
|
||||
the day followed by a command prompt (a <literal>#</literal>,
|
||||
<literal>$</literal>, or <literal>$</literal> character). This
|
||||
indicates you have successfully logged into FreeBSD.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-virtual">
|
||||
<title>Multiple Consoles</title>
|
||||
|
||||
<para>Running &unix; commands in one console is fine, but FreeBSD can
|
||||
run many programs at once. Having one console where commands can be
|
||||
typed would be a bit of a waste when an operating system like FreeBSD
|
||||
can run dozens of programs at the same time. This is where
|
||||
<quote>virtual consoles</quote> can be very helpful.</para>
|
||||
|
||||
<para>FreeBSD can be configured to present you with many different
|
||||
virtual consoles. You can switch from one of them to any other
|
||||
virtual console by pressing a couple of keys on your keyboard. Each
|
||||
console has its own different output channel, and FreeBSD takes care
|
||||
of properly redirecting keyboard input and monitor output as you
|
||||
switch from one virtual console to the next.</para>
|
||||
|
||||
<para>Special key combinations have been reserved by FreeBSD for
|
||||
switching consoles<footnote>
|
||||
<para>A fairly technical and accurate description of all the details
|
||||
of the FreeBSD console and keyboard drivers can be found in the
|
||||
manual pages of &man.syscons.4;, &man.atkbd.4;, &man.vidcontrol.1;
|
||||
and &man.kbdcontrol.1;. We will not expand on the details here,
|
||||
but the interested reader can always consult the manual pages for
|
||||
a more detailed and thorough explanation of how things
|
||||
work.</para>
|
||||
</footnote>. You can use
|
||||
<keycombo><keycap>Alt</keycap><keycap>F1</keycap></keycombo>,
|
||||
<keycombo><keycap>Alt</keycap><keycap>F2</keycap></keycombo>, through
|
||||
<keycombo><keycap>Alt</keycap><keycap>F8</keycap></keycombo> to switch
|
||||
to a different virtual console in FreeBSD.</para>
|
||||
|
||||
<para>As you are switching from one console to the next, FreeBSD takes
|
||||
care of saving and restoring the screen output. The result is an
|
||||
<quote>illusion</quote> of having multiple <quote>virtual</quote>
|
||||
screens and keyboards that you can use to type commands for
|
||||
FreeBSD to run. The programs that you launch on one virtual console
|
||||
do not stop running when that console is not visible. They continue
|
||||
running when you have switched to a different virtual console.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-ttys">
|
||||
<title>The <filename>/etc/ttys</filename> File</title>
|
||||
|
||||
<para>The default configuration of FreeBSD will start up with eight
|
||||
virtual consoles. This is not a hardwired setting though, and
|
||||
you can easily customize your installation to boot with more
|
||||
or fewer virtual consoles. The number and settings of the
|
||||
virtual consoles are configured in the
|
||||
<filename>/etc/ttys</filename> file.</para>
|
||||
|
||||
<para>You can use the <filename>/etc/ttys</filename> file to configure
|
||||
the virtual consoles of FreeBSD. Each uncommented line in this file
|
||||
(lines that do not start with a <literal>#</literal> character) contains
|
||||
settings for a single terminal or virtual console. The default
|
||||
version of this file that ships with FreeBSD configures nine virtual
|
||||
consoles, and enables eight of them. They are the lines that start with
|
||||
<literal>ttyv</literal>:</para>
|
||||
|
||||
<programlisting># name getty type status comments
|
||||
#
|
||||
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
|
||||
# Virtual terminals
|
||||
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure</programlisting>
|
||||
|
||||
<para>For a detailed description of every column in this file and all
|
||||
the options you can use to set things up for the virtual consoles,
|
||||
consult the &man.ttys.5; manual page.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-singleuser">
|
||||
<title>Single User Mode Console</title>
|
||||
|
||||
<para>A detailed description of what <quote>single user mode</quote> is
|
||||
can be found in <xref linkend="boot-singleuser">. It is worth noting
|
||||
that there is only one console when you are running FreeBSD in single
|
||||
user mode. There are no virtual consoles available. The settings of
|
||||
the single user mode console can also be found in the
|
||||
<filename>/etc/ttys</filename> file. Look for the line that starts
|
||||
with <literal>console</literal>:</para>
|
||||
|
||||
<programlisting># name getty type status comments
|
||||
#
|
||||
# If console is marked "insecure", then init will ask for the root password
|
||||
# when going to single-user mode.
|
||||
console none unknown off secure</programlisting>
|
||||
|
||||
<note>
|
||||
<para>As the comments above the <literal>console</literal> line
|
||||
indicate, you can edit this line and change <literal>secure</literal> to
|
||||
<literal>insecure</literal>. If you do that, when FreeBSD boots
|
||||
into single user mode, it will still ask for the
|
||||
<username>root</username> password.</para>
|
||||
|
||||
<para><emphasis>Be careful when changing this to
|
||||
<literal>insecure</literal></emphasis> If you ever forget
|
||||
the <username>root</username> password, booting into single user
|
||||
mode is a bit involved. It is still possible, but it might be a bit
|
||||
hard for someone who is not very comfortable with the FreeBSD
|
||||
booting process and the programs involved.</para>
|
||||
</note>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="permissions">
|
||||
<title>Permissions</title>
|
||||
<indexterm><primary>UNIX</primary></indexterm>
|
||||
|
@ -2000,227 +2221,6 @@ Swap: 256M Total, 38M Used, 217M Free, 15% Inuse
|
|||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="consoles">
|
||||
<title>Virtual Consoles and Terminals</title>
|
||||
<indexterm><primary>virtual consoles</primary></indexterm>
|
||||
<indexterm><primary>terminals</primary></indexterm>
|
||||
|
||||
<para>FreeBSD can be used in various ways. One of them is typing commands
|
||||
to a text terminal. A lot of the flexibility and power of a &unix;
|
||||
operating system is readily available at your hands when using FreeBSD
|
||||
this way. This section describes what <quote>terminals</quote> and
|
||||
<quote>consoles</quote> are, and how you can use them in FreeBSD.</para>
|
||||
|
||||
<sect2 id="consoles-intro">
|
||||
<title>The Console</title>
|
||||
<indexterm><primary>console</primary></indexterm>
|
||||
|
||||
<para>If you have not configured FreeBSD to automatically start a
|
||||
graphical environment during startup, the system will present you with
|
||||
a login prompt after it boots, right after the startup scripts finish
|
||||
running. You will see something similar to:</para>
|
||||
|
||||
<screen>Additional ABI support:.
|
||||
Local package initialization:.
|
||||
Additional TCP options:.
|
||||
|
||||
Fri Sep 20 13:01:06 EEST 2002
|
||||
|
||||
FreeBSD/i386 (pc3.example.org) (ttyv0)
|
||||
|
||||
login:</screen>
|
||||
|
||||
<para>The messages might be a bit different on your system, but you will
|
||||
see something similar. The last two lines are what we are interested
|
||||
in right now. The second last line reads:</para>
|
||||
|
||||
<programlisting>FreeBSD/i386 (pc3.example.org) (ttyv0)</programlisting>
|
||||
|
||||
<para>This line contains some bits of information about the system you
|
||||
have just booted. You are looking at a <quote>FreeBSD</quote>
|
||||
console, running on an Intel or compatible processor of the x86
|
||||
architecture<footnote>
|
||||
<para>This is what <literal>i386</literal> means. Note that even if
|
||||
you are not running FreeBSD on an Intel 386 CPU, this is going to
|
||||
be <literal>i386</literal>. It is not the type of your processor,
|
||||
but the processor <quote>architecture</quote> that is shown
|
||||
here.</para>
|
||||
</footnote>. The name of this machine (every &unix; machine has a
|
||||
name) is <hostid>pc3.example.org</hostid>, and you are now looking
|
||||
at its system console—the <devicename>ttyv0</devicename>
|
||||
terminal.</para>
|
||||
|
||||
<para>Finally, the last line is always:</para>
|
||||
|
||||
<programlisting>login:</programlisting>
|
||||
|
||||
<para>This is the part where you are supposed to type in your
|
||||
<quote>username</quote> to log into FreeBSD. The next section
|
||||
describes how you can do this.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-login">
|
||||
<title>Logging into FreeBSD</title>
|
||||
|
||||
<para>FreeBSD is a multiuser, multiprocessing system. This is
|
||||
the formal description that is usually given to a system that can be
|
||||
used by many different people, who simultaneously run a lot of
|
||||
programs on a single machine.</para>
|
||||
|
||||
<para>Every multiuser system needs some way to distinguish one
|
||||
<quote>user</quote> from the rest. In FreeBSD (and all the
|
||||
&unix; like operating systems), this is accomplished by requiring that
|
||||
every user must <quote>log into</quote> the system before being able
|
||||
to run programs. Every user has a unique name (the
|
||||
<quote>username</quote>) and a personal, secret key (the
|
||||
<quote>password</quote>). FreeBSD will ask for these two before
|
||||
allowing a user to run any programs.</para>
|
||||
|
||||
<indexterm><primary>startup scripts</primary></indexterm>
|
||||
<para>Right after FreeBSD boots and finishes running its startup
|
||||
scripts<footnote>
|
||||
<para>Startup scripts are programs that are run automatically by
|
||||
FreeBSD when booting. Their main function is to set things up for
|
||||
everything else to run, and start any services that you have
|
||||
configured to run in the background doing useful things.</para>
|
||||
</footnote>, it will present you with a prompt and ask for a valid
|
||||
username:</para>
|
||||
|
||||
<screen>login:</screen>
|
||||
|
||||
<para>For the sake of this example, let us assume that your username is
|
||||
<username>john</username>. Type <literal>john</literal> at this prompt and press
|
||||
<keycap>Enter</keycap>. You should then be presented with a prompt to
|
||||
enter a <quote>password</quote>:</para>
|
||||
|
||||
<screen>login: <userinput>john</userinput>
|
||||
Password:</screen>
|
||||
|
||||
<para>Type in <username>john</username>'s password now, and press
|
||||
<keycap>Enter</keycap>. The password is <emphasis>not
|
||||
echoed!</emphasis> You need not worry about this right now. Suffice
|
||||
it to say that it is done for security reasons.</para>
|
||||
|
||||
<para>If you have typed your password correctly, you should by now be
|
||||
logged into FreeBSD and ready to try out all the available
|
||||
commands.</para>
|
||||
|
||||
<para>You should see the <acronym>MOTD</acronym> or message of
|
||||
the day followed by a command prompt (a <literal>#</literal>,
|
||||
<literal>$</literal>, or <literal>$</literal> character). This
|
||||
indicates you have successfully logged into FreeBSD.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-virtual">
|
||||
<title>Multiple Consoles</title>
|
||||
|
||||
<para>Running &unix; commands in one console is fine, but FreeBSD can
|
||||
run many programs at once. Having one console where commands can be
|
||||
typed would be a bit of a waste when an operating system like FreeBSD
|
||||
can run dozens of programs at the same time. This is where
|
||||
<quote>virtual consoles</quote> can be very helpful.</para>
|
||||
|
||||
<para>FreeBSD can be configured to present you with many different
|
||||
virtual consoles. You can switch from one of them to any other
|
||||
virtual console by pressing a couple of keys on your keyboard. Each
|
||||
console has its own different output channel, and FreeBSD takes care
|
||||
of properly redirecting keyboard input and monitor output as you
|
||||
switch from one virtual console to the next.</para>
|
||||
|
||||
<para>Special key combinations have been reserved by FreeBSD for
|
||||
switching consoles<footnote>
|
||||
<para>A fairly technical and accurate description of all the details
|
||||
of the FreeBSD console and keyboard drivers can be found in the
|
||||
manual pages of &man.syscons.4;, &man.atkbd.4;, &man.vidcontrol.1;
|
||||
and &man.kbdcontrol.1;. We will not expand on the details here,
|
||||
but the interested reader can always consult the manual pages for
|
||||
a more detailed and thorough explanation of how things
|
||||
work.</para>
|
||||
</footnote>. You can use
|
||||
<keycombo><keycap>Alt</keycap><keycap>F1</keycap></keycombo>,
|
||||
<keycombo><keycap>Alt</keycap><keycap>F2</keycap></keycombo>, through
|
||||
<keycombo><keycap>Alt</keycap><keycap>F8</keycap></keycombo> to switch
|
||||
to a different virtual console in FreeBSD.</para>
|
||||
|
||||
<para>As you are switching from one console to the next, FreeBSD takes
|
||||
care of saving and restoring the screen output. The result is an
|
||||
<quote>illusion</quote> of having multiple <quote>virtual</quote>
|
||||
screens and keyboards that you can use to type commands for
|
||||
FreeBSD to run. The programs that you launch on one virtual console
|
||||
do not stop running when that console is not visible. They continue
|
||||
running when you have switched to a different virtual console.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-ttys">
|
||||
<title>The <filename>/etc/ttys</filename> File</title>
|
||||
|
||||
<para>The default configuration of FreeBSD will start up with eight
|
||||
virtual consoles. This is not a hardwired setting though, and
|
||||
you can easily customize your installation to boot with more
|
||||
or fewer virtual consoles. The number and settings of the
|
||||
virtual consoles are configured in the
|
||||
<filename>/etc/ttys</filename> file.</para>
|
||||
|
||||
<para>You can use the <filename>/etc/ttys</filename> file to configure
|
||||
the virtual consoles of FreeBSD. Each uncommented line in this file
|
||||
(lines that do not start with a <literal>#</literal> character) contains
|
||||
settings for a single terminal or virtual console. The default
|
||||
version of this file that ships with FreeBSD configures nine virtual
|
||||
consoles, and enables eight of them. They are the lines that start with
|
||||
<literal>ttyv</literal>:</para>
|
||||
|
||||
<programlisting># name getty type status comments
|
||||
#
|
||||
ttyv0 "/usr/libexec/getty Pc" cons25 on secure
|
||||
# Virtual terminals
|
||||
ttyv1 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv2 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv3 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv4 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv5 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv6 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv7 "/usr/libexec/getty Pc" cons25 on secure
|
||||
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure</programlisting>
|
||||
|
||||
<para>For a detailed description of every column in this file and all
|
||||
the options you can use to set things up for the virtual consoles,
|
||||
consult the &man.ttys.5; manual page.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="consoles-singleuser">
|
||||
<title>Single User Mode Console</title>
|
||||
|
||||
<para>A detailed description of what <quote>single user mode</quote> is
|
||||
can be found in <xref linkend="boot-singleuser">. It is worth noting
|
||||
that there is only one console when you are running FreeBSD in single
|
||||
user mode. There are no virtual consoles available. The settings of
|
||||
the single user mode console can also be found in the
|
||||
<filename>/etc/ttys</filename> file. Look for the line that starts
|
||||
with <literal>console</literal>:</para>
|
||||
|
||||
<programlisting># name getty type status comments
|
||||
#
|
||||
# If console is marked "insecure", then init will ask for the root password
|
||||
# when going to single-user mode.
|
||||
console none unknown off secure</programlisting>
|
||||
|
||||
<note>
|
||||
<para>As the comments above the <literal>console</literal> line
|
||||
indicate, you can edit this line and change <literal>secure</literal> to
|
||||
<literal>insecure</literal>. If you do that, when FreeBSD boots
|
||||
into single user mode, it will still ask for the
|
||||
<username>root</username> password.</para>
|
||||
|
||||
<para><emphasis>Be careful when changing this to
|
||||
<literal>insecure</literal></emphasis> If you ever forget
|
||||
the <username>root</username> password, booting into single user
|
||||
mode is a bit involved. It is still possible, but it might be a bit
|
||||
hard for someone who is not very comfortable with the FreeBSD
|
||||
booting process and the programs involved.</para>
|
||||
</note>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="binary-formats">
|
||||
<title>Binary Formats</title>
|
||||
|
||||
|
|
Loading…
Reference in a new issue