xref: /netbsd-src/share/man/man8/afterboot.8 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: afterboot.8,v 1.60 2017/09/10 19:08:17 maya Exp $
2.\"	$OpenBSD: afterboot.8,v 1.72 2002/02/22 02:02:33 miod Exp $
3.\"
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
6.\"
7.\"
8.\" Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
9.\" All rights reserved.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
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.
19.\"
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.
31.\"
32.\"
33.\" Copyright (c) 1997 Marshall M. Midden
34.\" All rights reserved.
35.\"
36.\" Redistribution and use in source and binary forms, with or without
37.\" modification, are permitted provided that the following conditions
38.\" are met:
39.\"
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.
50.\"
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.
61.\"
62.Dd September 10, 2017
63.Dt AFTERBOOT 8
64.Os
65.Sh NAME
66.Nm afterboot
67.Nd things to check after the first complete boot
68.Sh DESCRIPTION
69.Ss Starting Out
70This document attempts to list items for the system administrator
71to check and set up after the installation and first complete boot of the
72system.
73The idea is to create a list of items that can be checked off so that you have
74a warm fuzzy feeling that something obvious has not been missed.
75A basic knowledge of
76.Ux
77is assumed.
78.Pp
79Complete instructions for correcting and fixing items is not provided.
80There are manual pages and other methodologies available for doing that.
81For example, to view the man page for the
82.Xr ls 1
83command, type:
84.Bd -literal -offset indent
85.Ic man 1 ls
86.Ed
87.Pp
88Administrators will rapidly become more familiar with
89.Nx
90if they get used to using the manual pages.
91.Ss Security alerts
92By the time that you have installed your system, it is quite likely that
93bugs in the release have been found.
94All significant and easily fixed problems will be reported at
95.Lk http://www.NetBSD.org/support/security/ .
96It is recommended that you check this page regularly.
97.Pp
98Additionally, you should set
99.Dq fetch_pkg_vulnerabilities=YES
100in
101.Pa /etc/daily.conf
102to allow your system to automatically update the local database of known
103vulnerable packages to the latest version available on-line.
104The system will later check, on a daily basis, if any of your installed
105packages are vulnerable based on the contents of this database.
106See
107.Xr daily.conf 5
108and
109.Xr security.conf 5
110for more details.
111.Ss Login
112Login as
113.Dq Ic root .
114You can do so on the console, or over the network using
115.Xr ssh 1 .
116If you have enabled the SSH daemon (see
117.Xr sshd 8 )
118and wish to allow root logins over the network, edit the
119.Pa /etc/ssh/sshd_config
120file and set
121.Dq PermitRootLogin
122to
123.Dq yes
124(see
125.Xr sshd_config 5 ) .
126The default is to not permit root logins over the network
127after fresh install in
128.Nx .
129.Pp
130Upon successful login on the console, you may see the message
131.Dq We recommend creating a non-root account... .
132For security reasons, it is bad practice to login as root during
133regular use and maintenance of the system.
134In fact, the system will only let you login as root on a secure
135terminal.
136By default, only the console is considered to be a secure terminal.
137Instead, administrators are encouraged to add a
138.Dq regular
139user, add said user to the
140.Dq wheel
141group, then use the
142.Xr su 1
143command when root privileges are required.
144This process is described in more detail later.
145.Ss Root password
146Change the password for the root user.
147(Note that throughout the documentation, the term
148.Dq superuser
149is a synonym for the root user.)
150Choose a password that has numbers, digits, and special characters (not space)
151as well as from the upper and lower case alphabet.
152Do not choose any word in any language.
153It is common for an intruder to use dictionary attacks.
154Type the command
155.Ic /usr/bin/passwd
156to change it.
157.Pp
158It is a good idea to always specify the full path name for both the
159.Xr passwd 1
160and
161.Xr su 1
162commands as this inhibits the possibility of files placed in your execution
163.Ev PATH
164for most shells.
165Furthermore, the superuser's
166.Ev PATH
167should never contain the current directory
168.Po Dq \&.
169.Pc .
170.Ss System date
171Check the system date with the
172.Xr date 1
173command.
174If needed, change the date, and/or change the symbolic link of
175.Pa /etc/localtime
176to the correct time zone in the
177.Pa /usr/share/zoneinfo
178directory.
179.Pp
180Examples:
181.Bl -tag -width date
182.It Cm date 200205101820
183Set the current date to May 10th, 2002 6:20pm.
184.It Cm ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
185Set the time zone to Eastern Europe Summer Time.
186.El
187.Ss Console settings
188One of the first things you will likely need to do is to set up your
189keyboard map (and maybe some other aspects about the system console).
190To change your keyboard encoding, edit the
191.Dq Va encoding
192variable found in
193.Pa /etc/wscons.conf .
194.Pp
195.Xr wscons.conf 5
196contains more information about this file.
197.Ss Check hostname
198Use the
199.Ic hostname
200command to verify that the name of your machine is correct.
201See the man page for
202.Xr hostname 1
203if it needs to be changed.
204You will also need to change the contents of the
205.Dq Va hostname
206variable in
207.Pa /etc/rc.conf
208or edit the
209.Pa /etc/myname
210file to have it stick around for the next reboot.
211Note that
212.Dq Va hostname
213is supposed include a domainname, and that this should
214not be confused with YP (NIS)
215.Xr domainname 1 .
216If you are using
217.Xr dhcpcd 8
218to configure network interfaces, it might override these local hostname
219settings if your DHCP server specifies client's hostname with other network
220configurations.
221.Ss Verify network interface configuration
222The first thing to do is an
223.Ic ifconfig -a
224to see if the network interfaces are properly configured.
225Correct by editing
226.Pa /etc/ifconfig. Ns Ar interface
227or the corresponding
228.Dq Va ifconfig_ Ns Ar interface
229variable in
230.Xr rc.conf 5
231(where
232.Ar interface
233is the interface name, e.g.,
234.Dq le0 )
235and then using
236.Xr ifconfig 8
237to manually configure it
238if you do not wish to reboot.
239.Pp
240Alternatively, you can configure interfaces automatically via DHCP with
241.Xr dhcpcd 8
242if you have a DHCP server running somewhere on your network.
243To get
244.Xr dhcpcd 8
245to start automatically on boot,
246you will need to have this line in
247.Pa /etc/rc.conf :
248.Pp
249.Dl dhcpcd=YES
250.Pp
251See
252.Xr dhcpcd 8
253and
254.Xr dhcpcd.conf 5
255for more information on setting up a DHCP client.
256.Pp
257You can add new
258.Dq virtual interfaces
259by adding the required entries to
260.Pa /etc/ifconfig. Ns Ar interface .
261Read the
262.Xr ifconfig.if 5
263man page for more information on the format of
264.Pa /etc/ifconfig. Ns Ar interface
265files.
266The loopback interface will look something like:
267.Bd -literal -offset indent
268lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 32972
269	inet 127.0.0.1 netmask 0xff000000
270	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
271	inet6 ::1 prefixlen 128
272.Ed
273.Pp
274an Ethernet interface something like:
275.Bd -literal -offset indent
276le0: flags=9863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
277	inet 192.168.4.52 netmask 0xffffff00 broadcast 192.168.4.255
278	inet6 fe80::5ef0:f0f0%le0 prefixlen 64 scopeid 0x1
279.Ed
280.Pp
281and a PPP interface something like:
282.Bd -literal -offset indent
283ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST>
284        inet 203.3.131.108 --> 198.181.0.253 netmask 0xffff0000
285.Ed
286.Pp
287See
288.Xr mrouted 8
289for instructions on configuring multicast routing.
290.Ss Check routing tables
291Issue a
292.Ic netstat -rn
293command.
294The output will look something like:
295.Bd -literal -offset indent
296Routing tables
297
298Internet:
299Destination    Gateway           Flags  Refs     Use  Mtu  Interface
300default        192.168.4.254     UGS      0 11098028    -  le0
301127            127.0.0.1         UGRS     0        0    -  lo0
302127.0.0.1      127.0.0.1         UH       3       24    -  lo0
303192.168.4      link#1            UC       0        0    -  le0
304192.168.4.52   8:0:20:73:b8:4a   UHL      1     6707    -  le0
305192.168.4.254  0:60:3e:99:67:ea  UHL      1        0    -  le0
306
307Internet6:
308Destination        Gateway       Flags  Refs  Use     Mtu  Interface
309::/96              ::1           UGRS     0     0   32972  lo0 =>
310::1                ::1           UH       4     0   32972  lo0
311::ffff:0.0.0.0/96  ::1           UGRS     0     0   32972  lo0
312fc80::/10          ::1           UGRS     0     0   32972  lo0
313fe80::/10          ::1           UGRS     0     0   32972  lo0
314fe80::%le0/64      link#1        UC       0     0    1500  le0
315fe80::%lo0/64      fe80::1%lo0   U        0     0   32972  lo0
316ff01::/32          ::1           U        0     0   32972  lo0
317ff02::%le0/32      link#1        UC       0     0    1500  le0
318ff02::%lo0/32      fe80::1%lo0   UC       0     0   32972  lo0
319.Ed
320.Pp
321The default gateway address is stored in the
322.Dq Va defaultroute
323variable in
324.Pa /etc/rc.conf ,
325or in the file
326.Pa /etc/mygate .
327If you need to edit this file, a painless way to reconfigure the network
328afterwards is to issue
329.Bd -literal -offset indent
330.Ic service network restart
331.Ed
332.Pp
333Or, you may prefer to manually configure using a series of
334.Ic route add
335and
336.Ic route delete
337commands (see
338.Xr route 8 ) .
339If you run
340.Xr dhcpcd 8
341you will have to kill it by running
342.Bd -literal -offset indent
343.Ic service dhcpcd stop
344.Ed
345.Pp
346before you flush the routes.
347.Pp
348If you wish to route packets between interfaces, add one or both
349of the following directives (depending on whether IPv4 or IPv6 routing
350is required) to
351.Pa /etc/sysctl.conf :
352.Pp
353.Dl net.inet.ip.forwarding=1
354.Dl net.inet6.ip6.forwarding=1
355.Pp
356As an alternative, compile a new kernel with the
357.Dq GATEWAY
358option.
359Packets are not forwarded by default, due to RFC requirements.
360.Ss Secure Shell (SSH)
361By default, all services are disabled in a fresh
362.Nx
363installation, and SSH is no exception.
364You may wish to enable it so you can remotely control your system.
365Set
366.Dq Va sshd=YES
367in
368.Pa /etc/rc.conf
369and then starting the server with the command
370.Bd -literal -offset indent
371.Ic service sshd start
372.Ed
373.Pp
374The first time the server is started, it will generate a new keypair,
375which will be stored inside the directory
376.Pa /etc/ssh .
377.Ss Host names and DNS
378The system resolves host names according the rules for hosts in the
379name service switch configuration at
380.Pa /etc/nsswitch.conf .
381By default, it will query
382.Pa /etc/hosts
383first, and then the DNS resolver specified in
384.Pa /etc/resolv.conf .
385.Pp
386If your network does not have a usable DNS resolver, e.g. one provided
387by DHCP, you can run a local caching recursive resolver by setting
388.Dq named=YES
389in
390.Pa /etc/rc.conf
391and either rebooting or running the following command:
392.Bd -literal -offset indent
393.Ic service named start
394.Ed
395.Pp
396.Xr named 8
397is configured in
398.Pa /etc/named.conf
399by default to run as a local caching recursive resolver.
400Then, to make the system use it, put the following in
401.Pa /etc/resolv.conf :
402.Bd -literal -offset indent
403nameserver 127.0.0.1
404.Ed
405.Ss Wireless networking
406You can scan for nearby wireless networks using:
407.Bd -literal -offset indent
408.Ic ifconfig iwm0 up list scan
409.Ic ifconfig iwm0 down
410.Ed
411.Pp
412To connect to a wireless network using WPA and DHCP:
413.Bd -literal -offset indent
414.Ic wpa_passphrase networkname password > /etc/wpa_supplicant.conf
415.Ic wpa_supplicant -i iwm0 -c /etc/wpa_supplicant.conf &
416.Ic dhcpcd iwm0
417.Ed
418.Pp
419To automatically connect at boot, add the following flags to
420.Pa /etc/rc.conf :
421.Pp
422.Dl dhcpcd=YES
423.Dl dhcpcd_flags="-b"
424.Dl wpa_supplicant=YES
425.Dl wpa_supplicant_flags="-i iwm0 -c /etc/wpa_supplicant.conf"
426.Ss RPC-based network services
427Several services depend on the RPC portmapper
428.Xr rpcbind 8
429- formerly known as
430.Ic portmap
431- being running for proper operation.
432This includes YP (NIS) and NFS exports, among other services.
433To get the RPC portmapper to start automatically on boot,
434you will need to have this line in
435.Pa /etc/rc.conf :
436.Pp
437.Dl rpcbind=YES
438.Ss YP (NIS) Setup
439Check the YP domain name with the
440.Xr domainname 1
441command.
442If necessary, correct it by editing the
443.Pa /etc/defaultdomain
444file or by setting the
445.Dq Va domainname
446variable in
447.Pa /etc/rc.conf .
448The
449.Pa /etc/rc.d/network
450script reads this file on bootup to determine and set the domain name.
451You may also set the running system's domain name with the
452.Xr domainname 1
453command.
454To start YP client services, simply run
455.Ic ypbind ,
456then perform the remaining
457YP activation as described in
458.Xr passwd 5
459and
460.Xr group 5 .
461.Pp
462In particular, to enable YP passwd support, you'll need to update
463.Pa /etc/nsswitch.conf
464to include
465.Dq nis
466for the
467.Dq passwd
468and
469.Dq group
470entries.
471A traditional way to accomplish the same thing is to
472add following entry to local passwd database via
473.Xr vipw 8 :
474.Bd -literal -offset indent
475.Li +:*::::::::
476.Ed
477.Pp
478Note this entry has to be the very last one.
479This traditional way works with the default
480.Xr nsswitch.conf 5
481setting of
482.Dq passwd ,
483which is
484.Dq compat .
485.Pp
486There are many more YP man pages available to help you.
487You can find more information by starting with
488.Xr nis 8 .
489.Ss Check disk mounts
490Check that the disks are mounted correctly by
491comparing the
492.Pa /etc/fstab
493file against the output of the
494.Xr mount 8
495and
496.Xr df 1
497commands.
498Example:
499.Bd -literal -offset indent
500.Li # Ic cat /etc/fstab
501/dev/sd0a / ffs     rw              1 1
502/dev/sd0b none swap sw
503/dev/sd0e /usr ffs  rw              1 2
504/dev/sd0f /var ffs  rw              1 3
505/dev/sd0g /tmp ffs  rw              1 4
506/dev/sd0h /home ffs rw              1 5
507
508.Li # Ic mount
509/dev/sd0a on / type ffs (local)
510/dev/sd0e on /usr type ffs (local)
511/dev/sd0f on /var type ffs (local)
512/dev/sd0g on /tmp type ffs (local)
513/dev/sd0h on /home type ffs (local)
514
515.Li # Ic df
516Filesystem  1024-blocks     Used    Avail Capacity  Mounted on
517/dev/sd0a         22311    14589     6606    69%    /
518/dev/sd0e        203399   150221    43008    78%    /usr
519/dev/sd0f         10447      682     9242     7%    /var
520/dev/sd0g         18823        2    17879     0%    /tmp
521/dev/sd0h          7519     5255     1888    74%    /home
522
523.Li # Ic pstat -s
524Device      512-blocks     Used    Avail Capacity  Priority
525/dev/sd0b       131072    84656    46416    65%    0
526.Ed
527.Pp
528Edit
529.Pa /etc/fstab
530and use the
531.Xr mount 8
532and
533.Xr umount 8
534commands as appropriate.
535Refer to the above example and
536.Xr fstab 5
537for information on the format of this file.
538.Pp
539You may wish to do NFS mounts now too, or you can do them later.
540.Ss Concatenated disks (ccd)
541If you are using
542.Xr ccd 4
543concatenated disks, edit
544.Pa /etc/ccd.conf .
545You may wish to take a look to
546.Xr ccdconfig 8
547for more information about this file.
548Use the
549.Ic ccdconfig -U
550command to unload and the
551.Ic ccdconfig -C
552command to create tables internal to the kernel for the concatenated disks.
553You then
554.Xr mount 8 ,
555.Xr umount 8 ,
556and edit
557.Pa /etc/fstab
558as needed.
559.Ss Automounter daemon (AMD)
560To use the
561.Xr amd 8
562automounter, create the
563.Pa /etc/amd
564directory, copy example config files from
565.Pa /usr/share/examples/amd
566to
567.Pa /etc/amd
568and customize them as needed.
569Alternatively, you can get your maps with YP.
570.Ss Clock synchronization
571In order to make sure the system clock is synchronized
572to that of a publicly accessible NTP server,
573make sure that
574.Pa /etc/rc.conf
575contains the following:
576.Pp
577.Dl ntpdate=YES
578.Dl ntpd=YES
579.Pp
580See
581.Xr date 1 ,
582.Xr ntpdate 8 ,
583.Xr ntpd 8 ,
584.Xr rdate 8 ,
585and
586.Xr timed 8
587for more information on setting the system's date.
588.Sh CHANGING /etc FILES
589The system should be usable now, but you may wish to do more customizing,
590such as adding users, etc.
591Many of the following sections may be skipped
592if you are not using that package (for example, skip the
593.Sx Kerberos
594section if you won't be using Kerberos).
595We suggest that you
596.Ic cd /etc
597and edit most of the files in that directory.
598.Pp
599Note that the
600.Pa /etc/motd
601file is modified by
602.Pa /etc/rc.d/motd
603whenever the system is booted.
604To keep any custom message intact, ensure that you leave two blank lines
605at the top, or your message will be overwritten.
606.Ss Add new users
607To add new users and groups, there are
608.Xr useradd 8
609and
610.Xr groupadd 8 ;
611see also
612.Xr user 8
613for further programs for user and group manipulation.
614You may use
615.Xr vipw 8
616to add users to the
617.Pa /etc/passwd
618file
619and edit
620.Pa /etc/group
621by hand to add new groups.
622The manual page for
623.Xr su 1 ,
624tells you to make sure to put people in
625the
626.Sq wheel
627group if they need root access (non-Kerberos).
628For example:
629.Bd -literal -offset indent
630wheel:*:0:root,myself
631.Ed
632.Pp
633Follow instructions for
634.Xr kerberos 8
635if using
636Kerberos
637for authentication.
638.Ss System boot scripts and /etc/rc.local
639.Pa /etc/rc
640and the
641.Pa /etc/rc.d/*
642scripts are invoked at boot time after single user mode has exited,
643and at shutdown.
644The whole process is controlled by the master script
645.Pa /etc/rc .
646This script should not be changed by administrators.
647.Pp
648The directory
649.Pa /etc/rc.d
650contains a series of scripts used at startup/shutdown, called by
651.Pa /etc/rc .
652.Pa /etc/rc
653is in turn influenced by the configuration variables present in
654.Pa /etc/rc.conf .
655.Pp
656The script
657.Pa /etc/rc.local
658is run as the last thing during multiuser boot, and is provided
659to allow any other local hooks necessary for the system.
660.Ss rc.conf
661To enable or disable various services on system startup,
662corresponding entries can be made in
663.Pa /etc/rc.conf .
664You can take a look at
665.Pa /etc/defaults/rc.conf
666to see a list of default system variables, which you can override in
667.Pa /etc/rc.conf .
668Note you are
669.Em not
670supposed to change
671.Pa /etc/defaults/rc.conf
672directly, edit only
673.Pa /etc/rc.conf .
674See
675.Xr rc.conf 5
676for further information.
677.Ss X Display Manager
678If you've installed X, you may want to turn on
679.Xr xdm 1 ,
680the X Display Manager.
681To do this, set
682.Dq xdm=YES
683in
684.Pa /etc/rc.conf .
685.Ss Printers
686Edit
687.Pa /etc/printcap
688and
689.Pa /etc/hosts.lpd
690to get any printers set up.
691Consult
692.Xr lpd 8
693and
694.Xr printcap 5
695if needed.
696.Ss Tighten up security
697In
698.Pa /etc/inetd.conf
699comment out any extra entries you do not need, and only add things
700that are really needed.
701Note that by default all services are disabled for security reasons.
702.Ss Kerberos
703If you are going to use Kerberos for authentication,
704see
705.Xr kerberos 8
706and
707.Dq info heimdal
708for more information.
709If you already have a Kerberos master, change directory to
710.Pa /etc/kerberosV
711and configure.
712Remember to get a
713.Pa srvtab
714from the master so that the remote commands work.
715.Ss Mail Aliases
716Check
717.Pa /etc/mail/aliases
718and update appropriately if you want e-mail to be routed
719to non-local addresses or to different users.
720.Pp
721Run
722.Xr newaliases 1
723after changes.
724.Ss Postfix
725.Nx
726uses Postfix as its MTA.
727Postfix is started by default, but its initial configuration does not
728cause it to listen on the network for incoming connections.
729To configure Postfix, see
730.Pa /etc/postfix/main.cf
731and
732.Pa /etc/postfix/master.cf .
733If you wish to use a different MTA (e.g., sendmail), install your MTA of
734choice and edit
735.Pa /etc/mailer.conf
736to point to the proper binaries.
737.Ss DHCP server
738If this is a
739DHCP
740server, edit
741.Pa /etc/dhcpd.conf
742and
743.Pa /etc/dhcpd.interfaces
744as needed.
745You will have to make sure
746.Pa /etc/rc.conf
747has
748.Dq dhcpd=YES
749or run
750.Xr dhcpd 8
751manually.
752.Ss Bootparam server
753If this is a
754Bootparam
755server, edit
756.Pa /etc/bootparams
757as needed.
758You will have to turn it on in
759.Pa /etc/rc.conf
760by adding
761.Dq bootparamd=YES .
762.Ss NFS server
763If this is an NFS server, make sure
764.Pa /etc/rc.conf
765has:
766.Bd -literal -offset indent
767nfs_server=YES
768mountd=YES
769rpcbind=YES
770.Ed
771.Pp
772Edit
773.Pa /etc/exports
774and get it correct.
775After this, you can start the server by issuing:
776.Bd -literal -offset indent
777.Ic service rpcbind start
778.Ic service mountd start
779.Ic service nfsd start
780.Ed
781which will also start dependencies.
782.Ss HP remote boot server
783Edit
784.Pa /etc/rbootd.conf
785if needed for remote booting.
786If you do not have HP computers doing remote booting, do not enable this.
787.Ss Daily, weekly, monthly scripts
788Look at and possibly edit the
789.Pa /etc/daily.conf , /etc/weekly.conf ,
790and
791.Pa /etc/monthly.conf
792configuration files.
793You can check which values you can set by looking
794to their matching files in
795.Pa /etc/defaults .
796Your site specific things should go into
797.Pa /etc/daily.local , /etc/weekly.local ,
798and
799.Pa /etc/monthly.local .
800.Pp
801These scripts have been limited so as to keep the system running without
802filling up disk space from normal running processes and database updates.
803(You probably do not need to understand them.)
804.Ss Other files in /etc
805Look at the other files in
806.Pa /etc
807and edit them as needed.
808(Do not edit files ending in
809.Pa .db
810\(em like
811.Pa pwd.db , spwd.db ,
812nor
813.Pa localtime ,
814nor
815.Pa rmt ,
816nor any directories.)
817.Ss Crontab (background running processes)
818Check what is running by typing
819.Ic crontab -l
820as root
821and see if anything unexpected is present.
822Do you need anything else?
823Do you wish to change things?
824For example, if you do not
825like root getting standard output of the daily scripts, and want only
826the security scripts that are mailed internally, you can type
827.Ic crontab -e
828and change some of the lines to read:
829.Bd -literal -offset indent
83030  1  *  *  *   /bin/sh /etc/daily 2>&1 > /var/log/daily.out
83130  3  *  *  6   /bin/sh /etc/weekly 2>&1 > /var/log/weekly.out
83230  5  1  *  *   /bin/sh /etc/monthly 2>&1 > /var/log/monthly.out
833.Ed
834.Pp
835See
836.Xr crontab 5 .
837.Ss Next day cleanup
838After the first night's security run, change ownerships and permissions
839on files, directories, and devices; root should have received mail
840with subject: "<hostname> daily insecurity output.".
841This mail contains
842a set of security recommendations, presented as a list looking like this:
843.Bd -literal -offset indent
844var/mail:
845        permissions (0755, 0775)
846etc/daily:
847        user (0, 3)
848.Ed
849.Pp
850The best bet is to follow the advice in that list.
851The recommended setting is the first item in parentheses, while
852the current setting is the second one.
853This list is generated by
854.Xr mtree 8
855using
856.Pa /etc/mtree/special .
857Use
858.Xr chmod 1 ,
859.Xr chgrp 1 ,
860and
861.Xr chown 8
862as needed.
863.Ss Packages
864Install your own packages.
865The
866.Nx
867packages collection, pkgsrc, includes a large set of third-party software.
868A lot of it is available as binary packages that you can download from
869.Lk https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/
870or a mirror, and install using
871.Xr pkg_add 1 .
872See
873.Lk https://www.NetBSD.org/docs/pkgsrc/
874and
875.Pa pkgsrc/doc/pkgsrc.txt
876for more details.
877.Pp
878Copy vendor binaries and install them.
879You will need to install any shared libraries, etc.
880(Hint:
881.Ic man -k compat
882to find out how to install and use compatibility mode.)
883.Pp
884There is also other third-party software that is available
885in source form only, either because it has not been ported to
886.Nx
887yet, because licensing restrictions make binary redistribution
888impossible, or simply because you want to build your own binaries.
889Sometimes checking the mailing lists for
890past problems that people have encountered will result in a fix posted.
891.Ss Check the running system
892You can use
893.Xr ps 1 ,
894.Xr netstat 1 ,
895and
896.Xr fstat 1
897to check on running processes, network connections, and opened files,
898respectively.
899Other tools you may find useful are
900.Xr systat 1
901and
902.Xr top 1 .
903.Sh COMPILING A KERNEL
904Note:
905The standard
906.Nx
907kernel configuration (GENERIC) is suitable for most purposes.
908.Pp
909First, review the system message buffer in
910.Pa /var/run/dmesg.boot
911and by using the
912.Xr dmesg 8
913command to find out information on your system's devices as probed by the
914kernel at boot.
915In particular, note which devices were not configured.
916This information will prove useful when editing kernel configuration files.
917.Pp
918To compile a kernel inside a writable source tree, do the following:
919.Bd -literal -offset indent
920$ cd /usr/src/sys/arch/SOMEARCH/conf
921$ cp GENERIC SOMEFILE (only the first time)
922$ vi SOMEFILE (adapt to your needs)
923$ config SOMEFILE
924$ cd ../compile/SOMEFILE
925$ make depend
926$ make
927.Ed
928.Pp
929where
930.Ar SOMEARCH
931is the architecture (e.g., i386), and
932.Ar SOMEFILE
933should be a name indicative of a particular configuration (often
934that of the hostname).
935.Pp
936If you are building your kernel again, before you do a
937.Ic make
938you should do a
939.Ic make clean
940after making changes to your kernel options.
941.Pp
942After either of these two methods, you can place the new kernel (called
943.Pa netbsd )
944in
945.Pa /
946(i.e.,
947.Pa /netbsd )
948by issuing
949.Ic make install
950and the system will boot it next time.
951The old kernel is stored as
952.Pa /onetbsd
953so you can boot it in case of failure.
954.Pp
955If you are using toolchain to build your kernel, you will also need to
956build a new set of toolchain binaries.
957You can do it by changing into
958.Pa /usr/src
959and issuing:
960.Bd -literal -offset indent
961$ cd /usr/src
962$ K=sys/arch/`uname -m`/conf
963$ cp $K/GENERIC $K/SOMEFILE
964$ vi $K/SOMEFILE (adapt to your needs)
965$ ./build.sh tools
966$ ./build.sh kernel=SOMEFILE
967.Ed
968.Sh SYSTEM TESTING
969At this point, the system should be fully configured to your liking.
970It is now a good time to ensure that the system behaves according to
971its specifications and that it is stable on your hardware.
972Please refer to
973.Xr tests 7
974for details on how to do so.
975.Sh SEE ALSO
976.Xr chgrp 1 ,
977.Xr chmod 1 ,
978.Xr config 1 ,
979.Xr crontab 1 ,
980.Xr date 1 ,
981.Xr df 1 ,
982.Xr domainname 1 ,
983.Xr fstat 1 ,
984.Xr hostname 1 ,
985.Xr make 1 ,
986.Xr man 1 ,
987.Xr netstat 1 ,
988.Xr newaliases 1 ,
989.Xr passwd 1 ,
990.Xr pkg_add 1 ,
991.Xr ps 1 ,
992.Xr ssh 1 ,
993.Xr su 1 ,
994.Xr systat 1 ,
995.Xr top 1 ,
996.Xr xdm 1 ,
997.Xr ccd 4 ,
998.Xr aliases 5 ,
999.Xr crontab 5 ,
1000.Xr dhcpcd.conf 5 ,
1001.Xr exports 5 ,
1002.Xr fstab 5 ,
1003.Xr group 5 ,
1004.Xr hosts 5 ,
1005.Xr ifconfig.if 5 ,
1006.Xr mailer.conf 5 ,
1007.Xr named.conf 5 ,
1008.Xr nsswitch.conf 5 ,
1009.Xr passwd 5 ,
1010.Xr printcap 5 ,
1011.Xr rc.conf 5 ,
1012.Xr resolv.conf 5 ,
1013.Xr sshd_config 5 ,
1014.Xr wpa_supplicant.conf 5 ,
1015.Xr wscons.conf 5 ,
1016.Xr hier 7 ,
1017.Xr hostname 7 ,
1018.Xr pkgsrc 7 ,
1019.Xr tests 7 ,
1020.Xr amd 8 ,
1021.Xr ccdconfig 8 ,
1022.Xr chown 8 ,
1023.Xr dhcpcd 8 ,
1024.Xr dhcpd 8 ,
1025.Xr dmesg 8 ,
1026.Xr groupadd 8 ,
1027.Xr ifconfig 8 ,
1028.Xr inetd 8 ,
1029.Xr kerberos 8 ,
1030.Xr lpd 8 ,
1031.Xr mount 8 ,
1032.Xr mrouted 8 ,
1033.Xr mtree 8 ,
1034.Xr named 8 ,
1035.Xr nis 8 ,
1036.Xr ntpd 8 ,
1037.Xr ntpdate 8 ,
1038.Xr rbootd 8 ,
1039.Xr rc 8 ,
1040.Xr rdate 8 ,
1041.Xr rmt 8 ,
1042.Xr route 8 ,
1043.Xr rpc.bootparamd 8 ,
1044.Xr rpcbind 8 ,
1045.Xr sshd 8 ,
1046.Xr timed 8 ,
1047.Xr umount 8 ,
1048.Xr useradd 8 ,
1049.Xr vipw 8 ,
1050.Xr wpa_supplicant 8 ,
1051.Xr yp 8 ,
1052.Xr ypbind 8
1053.Sh HISTORY
1054This document first appeared in
1055.Ox 2.2 .
1056It has been adapted to
1057.Nx
1058and first appeared in
1059.Nx 2.0 .
1060