1 .\" $NetBSD: afterboot.8,v 1.41 2009/10/24 11:24:19 reed Exp $
2 .\" $OpenBSD: afterboot.8,v 1.72 2002/02/22 02:02:33 miod Exp $
4 .\" Originally created by Marshall M. Midden -- 1997-10-20, m4@umn.edu
5 .\" Adapted to NetBSD by Julio Merino -- 2002-05-10, jmmv@NetBSD.org
8 .\" Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
9 .\" All rights reserved.
11 .\" Redistribution and use in source and binary forms, with or without
12 .\" modification, are permitted provided that the following conditions
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\" notice, this list of conditions and the following disclaimer.
16 .\" 2. Redistributions in binary form must reproduce the above copyright
17 .\" notice, this list of conditions and the following disclaimer in the
18 .\" documentation and/or other materials provided with the distribution.
20 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 .\" POSSIBILITY OF SUCH DAMAGE.
33 .\" Copyright (c) 1997 Marshall M. Midden
34 .\" All rights reserved.
36 .\" Redistribution and use in source and binary forms, with or without
37 .\" modification, are permitted provided that the following conditions
40 .\" 1. Redistributions of source code must retain the above copyright
41 .\" notice, this list of conditions and the following disclaimer.
42 .\" 2. Redistributions in binary form must reproduce the above copyright
43 .\" notice, this list of conditions and the following disclaimer in the
44 .\" documentation and/or other materials provided with the distribution.
45 .\" 3. All advertising materials mentioning features or use of this software
46 .\" must display the following acknowledgement:
47 .\" This product includes software developed by Marshall M. Midden.
48 .\" 4. The name of the author may not be used to endorse or promote products
49 .\" derived from this software without specific prior written permission.
51 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 .Nd things to check after the first complete boot
70 This document attempts to list items for the system administrator
71 to check and set up after the installation and first complete boot of the
73 The idea is to create a list of items that can be checked off so that you have
74 a warm fuzzy feeling that something obvious has not been missed.
79 Complete instructions for correcting and fixing items is not provided.
80 There are manual pages and other methodologies available for doing that.
81 For example, to view the man page for the
84 .Bd -literal -offset indent
88 Administrators will rapidly become more familiar with
90 if they get used to using the manual pages.
92 By the time that you have installed your system, it is quite likely that
93 bugs in the release have been found.
94 All significant and easily fixed problems will be reported at
95 .Pa http://www.NetBSD.org/support/security/ .
96 It is recommended that you check this page regularly.
100 You can do so on the console, or over the network using
102 If you have enabled the ssh daemon and wish to allow root logins over
103 the network, edit the
104 .Pa /etc/ssh/sshd_config
110 .Xr sshd_config 5 ) .
111 The default is to not permit root logins over the network
112 after fresh install in
115 Upon successful login on the console, you may see the message
116 .Dq We recommend creating a non-root account... .
117 For security reasons, it is bad practice to login as root during
118 regular use and maintenance of the system.
119 In fact, the system will only let you login as root on a secure
121 By default, only the console is considered to be a secure terminal.
122 Instead, administrators are encouraged to add a
124 user, add said user to the
128 command when root privileges are required.
129 This process is described in more detail later.
131 Change the password for the root user.
132 (Note that throughout the documentation, the term
134 is a synonym for the root user.)
135 Choose a password that has numbers, digits, and special characters (not space)
136 as well as from the upper and lower case alphabet.
137 Do not choose any word in any language.
138 It is common for an intruder to use dictionary attacks.
143 It is a good idea to always specify the full path name for both the
147 commands as this inhibits the possibility of files placed in your execution
150 Furthermore, the superuser's
152 should never contain the current directory
156 Check the system date with the
159 If needed, change the date, and/or change the symbolic link of
161 to the correct time zone in the
162 .Pa /usr/share/zoneinfo
167 .It Cm date 200205101820
168 Set the current date to May 10th, 2002 6:20pm.
169 .It Cm ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
170 Set the time zone to Eastern Europe Summer Time.
173 One of the first things you will likely need to do is to set up your
174 keyboard map (and maybe some other aspects about the system console).
175 To change your keyboard encoding, edit the
178 .Pa /etc/wscons.conf .
181 contains more information about this file.
185 command to verify that the name of your machine is correct.
188 if it needs to be changed.
189 You will also need to change the contents of the
195 file to have it stick around for the next reboot.
198 is supposed include a domainname, and that this should
199 not be confused with YP (NIS)
203 to configure network interfaces, it might override these local hostname
204 settings if your DHCP server specifies client's hostname with other network
206 .Ss Verify network interface configuration
207 The first thing to do is an
209 to see if the network interfaces are properly configured.
211 .Pa /etc/ifconfig. Ns Ar interface
213 .Dq Va ifconfig_ Ns Ar interface
218 is the interface name, e.g.,
222 to manually configure it
223 if you do not wish to reboot.
225 Alternatively, you can configure interfaces automatically via DHCP with
227 if you have a DHCP server running somewhere on your network.
230 to start automatically on boot,
231 you will need to have this line in
240 for more information on setting up a DHCP client.
243 .Dq virtual interfaces
244 by adding the required entries to
245 .Pa /etc/ifconfig. Ns Ar interface .
248 man page for more information on the format of
249 .Pa /etc/ifconfig. Ns Ar interface
251 The loopback interface will look something like:
252 .Bd -literal -offset indent
253 lo0: flags=8009\*[Lt]UP,LOOPBACK,MULTICAST\*[Gt] mtu 32972
254 inet 127.0.0.1 netmask 0xff000000
255 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
256 inet6 ::1 prefixlen 128
259 an Ethernet interface something like:
260 .Bd -literal -offset indent
261 le0: flags=9863\*[Lt]UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST\*[Gt]
262 inet 192.168.4.52 netmask 0xffffff00 broadcast 192.168.4.255
263 inet6 fe80::5ef0:f0f0%le0 prefixlen 64 scopeid 0x1
266 and a PPP interface something like:
267 .Bd -literal -offset indent
268 ppp0: flags=8051\*[Lt]UP,POINTOPOINT,RUNNING,MULTICAST\*[Gt]
269 inet 203.3.131.108 --\*[Gt] 198.181.0.253 netmask 0xffff0000
274 for instructions on configuring multicast routing.
275 .Ss Check routing tables
279 The output will look something like:
280 .Bd -literal -offset indent
284 Destination Gateway Flags Refs Use Mtu Interface
285 default 192.168.4.254 UGS 0 11098028 - le0
286 127 127.0.0.1 UGRS 0 0 - lo0
287 127.0.0.1 127.0.0.1 UH 3 24 - lo0
288 192.168.4 link#1 UC 0 0 - le0
289 192.168.4.52 8:0:20:73:b8:4a UHL 1 6707 - le0
290 192.168.4.254 0:60:3e:99:67:ea UHL 1 0 - le0
293 Destination Gateway Flags Refs Use Mtu Interface
294 ::/96 ::1 UGRS 0 0 32972 lo0 =\*[Gt]
295 ::1 ::1 UH 4 0 32972 lo0
296 ::ffff:0.0.0.0/96 ::1 UGRS 0 0 32972 lo0
297 fc80::/10 ::1 UGRS 0 0 32972 lo0
298 fe80::/10 ::1 UGRS 0 0 32972 lo0
299 fe80::%le0/64 link#1 UC 0 0 1500 le0
300 fe80::%lo0/64 fe80::1%lo0 U 0 0 32972 lo0
301 ff01::/32 ::1 U 0 0 32972 lo0
302 ff02::%le0/32 link#1 UC 0 0 1500 le0
303 ff02::%lo0/32 fe80::1%lo0 UC 0 0 32972 lo0
306 The default gateway address is stored in the
312 If you need to edit this file, a painless way to reconfigure the network
313 afterwards is to issue
314 .Bd -literal -offset indent
315 .Ic /etc/rc.d/network restart
318 Or, you may prefer to manually configure using a series of
326 you will have to kill it by running
327 .Bd -literal -offset indent
328 .Ic /etc/rc.d/dhclient stop
331 after you flush the routes.
333 If you wish to route packets between interfaces, add one or both
334 of the following directives (depending on whether IPv4 or IPv6 routing
336 .Pa /etc/sysctl.conf :
338 .Dl net.inet.ip.forwarding=1
339 .Dl net.inet6.ip6.forwarding=1
341 As an alternative, compile a new kernel with the
344 Packets are not forwarded by default, due to RFC requirements.
345 .Ss Secure Shell (ssh)
346 By default, all services are disabled in a fresh
348 installation, and ssh is no exception.
349 You may wish to enable it so you can remotely control your system.
354 and then starting the server with the command
355 .Bd -literal -offset indent
356 .Ic /etc/rc.d/sshd start
359 The first time the server is started, it will generate a new keypair,
360 which will be stored inside the directory
362 .Ss BIND Name Server (DNS)
363 If you are using the BIND Name Server, check the
366 It may look something like:
367 .Bd -literal -offset indent
368 domain some.thing.dom
369 nameserver 192.168.0.1
370 nameserver 192.168.4.55
371 search some.thing.dom. thing.dom.
374 For further details, see
376 Note the name service lookup order is set via
380 If using a caching name server add the line "nameserver 127.0.0.1" first.
381 To get a local caching name server to run
382 you will need to set "named=yes" in
386 file in the appropriate place for
390 The same holds true if the machine is going to be a
391 name server for your domain.
392 In both these cases, make sure that
395 (otherwise there are long waits for resolver timeouts).
396 .Ss RPC-based network services
397 Several services depend on the RPC portmapper
401 - being running for proper operation.
402 This includes YP (NIS) and NFS exports, among other services.
403 To get the RPC portmapper to start automatically on boot,
404 you will need to have this line in
409 Check the YP domain name with the
412 If necessary, correct it by editing the
413 .Pa /etc/defaultdomain
414 file or by setting the
419 .Pa /etc/rc.d/network
420 script reads this file on bootup to determine and set the domain name.
421 You may also set the running system's domain name with the
424 To start YP client services, simply run
426 then perform the remaining
427 YP activation as described in
432 In particular, to enable YP passwd support, you'll need to update
433 .Pa /etc/nsswitch.conf
441 A traditional way to accomplish the same thing is to
442 add following entry to local passwd database via
444 .Bd -literal -offset indent
448 Note this entry has to be the very last one.
449 This traditional way works with the default
456 There are many more YP man pages available to help you.
457 You can find more information by starting with
459 .Ss Check disk mounts
460 Check that the disks are mounted correctly by
463 file against the output of the
469 .Bd -literal -offset indent
470 .Li # Ic cat /etc/fstab
471 /dev/sd0a / ffs rw 1 1
472 /dev/sd0b none swap sw
473 /dev/sd0e /usr ffs rw 1 2
474 /dev/sd0f /var ffs rw 1 3
475 /dev/sd0g /tmp ffs rw 1 4
476 /dev/sd0h /home ffs rw 1 5
479 /dev/sd0a on / type ffs (local)
480 /dev/sd0e on /usr type ffs (local)
481 /dev/sd0f on /var type ffs (local)
482 /dev/sd0g on /tmp type ffs (local)
483 /dev/sd0h on /home type ffs (local)
486 Filesystem 1024-blocks Used Avail Capacity Mounted on
487 /dev/sd0a 22311 14589 6606 69% /
488 /dev/sd0e 203399 150221 43008 78% /usr
489 /dev/sd0f 10447 682 9242 7% /var
490 /dev/sd0g 18823 2 17879 0% /tmp
491 /dev/sd0h 7519 5255 1888 74% /home
494 Device 512-blocks Used Avail Capacity Priority
495 /dev/sd0b 131072 84656 46416 65% 0
504 commands as appropriate.
505 Refer to the above example and
507 for information on the format of this file.
509 You may wish to do NFS mounts now too, or you can do them later.
510 .Ss Concatenated disks (ccd)
513 concatenated disks, edit
515 You may wish to take a look to
517 for more information about this file.
520 command to unload and the
522 command to create tables internal to the kernel for the concatenated disks.
529 .Ss Automounter daemon (AMD)
532 automounter, create the
534 directory, copy example config files from
535 .Pa /usr/share/examples/amd
538 and customize them as needed.
539 Alternatively, you can get your maps with YP.
540 .Ss Clock synchronization
541 In order to make sure the system clock is synchronized
542 to that of a publicly accessible NTP server,
545 contains the following:
557 for more information on setting the system's date.
558 .Sh CHANGING /etc FILES
559 The system should be usable now, but you may wish to do more customizing,
560 such as adding users, etc.
561 Many of the following sections may be skipped
562 if you are not using that package (for example, skip the
564 section if you won't be using Kerberos).
567 and edit most of the files in that directory.
573 whenever the system is booted.
574 To keep any custom message intact, ensure that you leave two blank lines
575 at the top, or your message will be overwritten.
577 To add new users and groups, there are
583 for further programs for user and group manipulation.
591 by hand to add new groups.
594 tells you to make sure to put people in
597 group if they need root access (non-Kerberos).
599 .Bd -literal -offset indent
600 wheel:*:0:root,myself
603 Follow instructions for
608 .Ss System boot scripts and /etc/rc.local
612 scripts are invoked at boot time after single user mode has exited,
614 The whole process is controlled by the master script
616 This script should not be changed by administrators.
620 contains a series of scripts used at startup/shutdown, called by
623 is in turn influenced by the configuration variables present in
628 is run as the last thing during multiuser boot, and is provided
629 to allow any other local hooks necessary for the system.
631 To enable or disable various services on system startup,
632 corresponding entries can be made in
634 You can take a look at
635 .Pa /etc/defaults/rc.conf
636 to see a list of default system variables, which you can override in
641 .Pa /etc/defaults/rc.conf
646 for further information.
648 If you've installed X, you may want to turn on
650 the X Display Manager.
651 To do this, set the variable
662 to get any printers set up.
668 .Ss Tighten up security
671 comment out any extra entries you do not need, and only add things
672 that are really needed.
673 Note that by default all services are disabled for security reasons.
675 If you are going to use Kerberos for authentication,
680 for more information.
681 If you already have a Kerberos master, change directory to
686 from the master so that the remote commands work.
689 .Pa /etc/mail/aliases
690 and update appropriately if you want e-mail to be routed
691 to non-local addresses or to different users.
698 uses Postfix as its MTA.
699 Postfix is started by default, but its initial configuration does not
700 cause it to listen on the network for incoming connections.
701 To configure Postfix, see
702 .Pa /etc/postfix/main.cf
704 .Pa /etc/postfix/master.cf .
705 If you wish to use a different MTA (e.g., sendmail), install your MTA of
708 to point to the proper binaries.
715 .Pa /etc/dhcpd.interfaces
717 You will have to make sure
729 You will have to turn it on in
731 by adding "bootparamd=yes".
733 If this is an NFS server, make sure
736 .Bd -literal -offset indent
745 After this, you can start the server by issuing:
746 .Bd -literal -offset indent
747 .Ic /etc/rc.d/rpcbind start
748 .Ic /etc/rc.d/mountd start
749 .Ic /etc/rc.d/nfsd start
751 which will also start dependencies.
752 .Ss HP remote boot server
755 if needed for remote booting.
756 If you do not have HP computers doing remote booting, do not enable this.
757 .Ss Daily, weekly, monthly scripts
758 Look at and possibly edit the
759 .Pa /etc/daily.conf , /etc/weekly.conf ,
761 .Pa /etc/monthly.conf
763 You can check which values you can set by looking
764 to their matching files in
766 Your site specific things should go into
767 .Pa /etc/daily.local , /etc/weekly.local ,
769 .Pa /etc/monthly.local .
771 These scripts have been limited so as to keep the system running without
772 filling up disk space from normal running processes and database updates.
773 (You probably do not need to understand them.)
774 .Ss Other files in /etc
775 Look at the other files in
777 and edit them as needed.
778 (Do not edit files ending in
781 .Pa pwd.db , spwd.db ,
786 nor any directories.)
787 .Ss Crontab (background running processes)
788 Check what is running by typing
791 and see if anything unexpected is present.
792 Do you need anything else?
793 Do you wish to change things?
794 For example, if you do not
795 like root getting standard output of the daily scripts, and want only
796 the security scripts that are mailed internally, you can type
798 and change some of the lines to read:
799 .Bd -literal -offset indent
800 30 1 * * * /bin/sh /etc/daily 2\*[Gt]\*[Am]1 \*[Gt] /var/log/daily.out
801 30 3 * * 6 /bin/sh /etc/weekly 2\*[Gt]\*[Am]1 \*[Gt] /var/log/weekly.out
802 30 5 1 * * /bin/sh /etc/monthly 2\*[Gt]\*[Am]1 \*[Gt] /var/log/monthly.out
808 After the first night's security run, change ownerships and permissions
809 on files, directories, and devices; root should have received mail
810 with subject: "\*[Lt]hostname\*[Gt] daily insecurity output.".
812 a set of security recommendations, presented as a list looking like this:
813 .Bd -literal -offset indent
815 permissions (0755, 0775)
820 The best bet is to follow the advice in that list.
821 The recommended setting is the first item in parentheses, while
822 the current setting is the second one.
823 This list is generated by
826 .Pa /etc/mtree/special .
834 Install your own packages.
837 packages collection, pkgsrc, includes a large set of third-party software.
838 A lot of it is available as binary packages that you can download from
839 .Pa ftp://ftp.NetBSD.org/pub/NetBSD/packages/
840 or a mirror, and install using
843 .Pa http://www.NetBSD.org/docs/pkgsrc/
845 .Pa pkgsrc/doc/pkgsrc.txt
848 Copy vendor binaries and install them.
849 You will need to install any shared libraries, etc.
852 to find out how to install and use compatibility mode.)
854 There is also other third-party software that is available
855 in source form only, either because it has not been ported to
857 yet, because licensing restrictions make binary redistribution
858 impossible, or simply because you want to build your own binaries.
859 Sometimes checking the mailing lists for
860 past problems that people have encountered will result in a fix posted.
861 .Ss Check the running system
867 to check on running processes, network connections, and opened files,
869 Other tools you may find useful are
873 .Sh COMPILING A KERNEL
877 kernel configuration (GENERIC) is suitable for most purposes.
879 First, review the system message buffer in
880 .Pa /var/run/dmesg.boot
883 command to find out information on your system's devices as probed by the
885 In particular, note which devices were not configured.
886 This information will prove useful when editing kernel configuration files.
888 To compile a kernel inside a writable source tree, do the following:
889 .Bd -literal -offset indent
890 $ cd /usr/src/sys/arch/SOMEARCH/conf
891 $ cp GENERIC SOMEFILE (only the first time)
892 $ vi SOMEFILE (adapt to your needs)
894 $ cd ../compile/SOMEFILE
901 is the architecture (e.g., i386), and
903 should be a name indicative of a particular configuration (often
904 that of the hostname).
906 If you are building your kernel again, before you do a
910 after making changes to your kernel options.
912 After either of these two methods, you can place the new kernel (called
920 and the system will boot it next time.
921 The old kernel is stored as
923 so you can boot it in case of failure.
925 If you are using toolchain to build your kernel, you will also need to
926 build a new set of toolchain binaries.
927 You can do it by changing into
930 .Bd -literal -offset indent
932 $ K=sys/arch/`uname -m`/conf
933 $ cp $K/GENERIC $K/SOMEFILE
934 $ vi $K/SOMEFILE (adapt to your needs)
936 $ ./build.sh kernel=SOMEFILE
939 At this point, the system should be fully configured to your liking.
940 It is now a good time to ensure that the system behaves according to
941 its specifications and that it is stable on your hardware.
942 You can easily do so by running the test suites available at
944 assuming that you installed the
947 If not, you can install it now by running:
948 .Bd -literal -offset indent
950 # tar xzpf /path/to/tests.tgz
954 .Pa /etc/atf/NetBSD.conf
955 file to tune the configuration of the test suite, go to
957 hierarchy and use the
961 utilities to run all the tests in an automated way:
962 .Bd -literal -offset indent
964 # atf-run | atf-report
967 Should any problems appear when running the test suite, please let the
969 developers know by sending a message to the appropriate mailing list or
970 by sending a problem report.
971 For more details see:
972 .Bl -bullet -offset indent
974 .Pa http://www.netbsd.org/mailinglists/
976 .Pa http://www.netbsd.org/support/send-pr.html
1024 .Xr rpc.bootparamd 8 ,
1030 This document first appeared in
1032 It has been adapted to
1034 and first appeared in