#author("2023-02-15T17:29:59+09:00","default:kaw","kaw")
#author("2023-11-10T23:31:41+09:00;2023-02-23T11:24:21+09:00","default:kaw","kaw")
#navi(FuguItaGuide)
This chapter describes the basic procedure when the system is booted and ready for use.

We will also point out sources of information that may be helpful for those unfamiliar with Unix-like operating systems, and for those with experience using other Unix-like operating systems.
#contents

#aname(firstlogin)
* Login for the first time [#cb54daf8]
**Log in as root [#j9dcb23b]
Once FuguIta has finished booting, you will be presented with the OpenBSD operating system login screen. ~
At first, only the superuser account can log in, so enter ``root'' at the ``login:'' prompt, and enter the password you set at startup at the ``Password:'' prompt.
 OpenBSD/amd64 (fugu-demo.localnet) (tty00)
 
 login: root
 Password:
 OpenBSD 7.2-stable (RDROOT.MP) #28: Fri Feb  3 11:29:19 JST 2023
 
 Welcome to FuguIta, the OpenBSD-based live system.
 
 FuguIta aims to help popularize OpenBSD operating system by making it easier
 to get started with.
 
 For information on FuguIta's specific features and how to use them, please
 refer to the documentation on https://fuguita.org/.
 
 If you have any questions or suggestions for FuguIta, please send an email to
 me or post a message to fuguita.org's message board.
 Please feel free to contact me.
 
 Yoshihiro Kawamata
 kaw@on.rim.or.jp , https://fuguita.org/
 
 You have new mail.
 fugu-demo# 
If the login is successful, the shell prompt "fugu-demo#" will be displayed and commands can be executed. ~
As an example, let's run the command ps.
 fugu-demo# ps -aux
 USER       PID %CPU %MEM   VSZ   RSS TT  STAT   STARTED       TIME COMMAND
 root     68528  3.6  0.1   868   884 00  Sp      6:51AM    0:01.89 -ksh (ksh)
 root         1  0.0  0.1   884   532 ??  I       6:40AM    0:01.68 /sbin/init
 root     14453  0.0  0.1   792   644 ??  Ip      6:43AM    0:00.47 /sbin/slaacd
 _slaacd  53995  0.0  0.1   812   784 ??  Ip      6:43AM    0:00.81 slaacd: engi
 _slaacd  33982  0.0  0.1   800   732 ??  Ip      6:43AM    0:00.81 slaacd: fron
 root     55401  0.0  0.1   712   548 ??  IU      6:44AM    0:00.17 dhclient: em
 _dhcp    78950  0.0  0.1   840   700 ??  Ip      6:44AM    0:00.10 dhclient: em
 root     86344  0.0  0.2   520  2184 ??  IpU     6:46AM    0:00.64 syslogd: [pr
 _syslogd 45328  0.0  0.1  1128  1488 ??  Sp      6:46AM    0:01.04 /usr/sbin/sy
 root     73380  0.0  0.1   836   584 ??  IU      6:46AM    0:00.27 pflogd: [pri
 _pflogd  53476  0.0  0.1   876   540 ??  Sp      6:46AM    0:02.97 pflogd: [run
 _ntp     63935  0.0  0.3  1016  2868 ??  S<p     6:47AM    0:02.87 ntpd: ntp en
 _ntp     18769  0.0  0.2   820  2508 ??  Ip      6:47AM    0:01.86 ntpd: dns en
 root     34145  0.0  0.2   788  1568 ??  S<pU    6:47AM    0:00.81 /usr/sbin/nt
 root     63360  0.0  0.1  1324  1280 ??  I       6:47AM    0:00.37 sshd: /usr/s
 root     61566  0.0  0.2  1680  2052 ??  Ip      6:48AM    0:00.82 /usr/sbin/sm
 _smtpd   19845  0.0  0.4  1448  3940 ??  Ip      6:48AM    0:01.83 smtpd: klond
 _smtpd   66321  0.0  0.4  1716  4240 ??  Ip      6:48AM    0:02.23 smtpd: contr
 _smtpd   91561  0.0  0.4  1552  4164 ??  Ip      6:48AM    0:01.95 smtpd: looku
 _smtpd   90688  0.0  0.4  1844  4396 ??  Ip      6:48AM    0:02.69 smtpd: pony
 _smtpq   16446  0.0  0.4  1640  4252 ??  Ip      6:48AM    0:02.47 smtpd: queue
 _smtpd   82450  0.0  0.4  1440  3988 ??  Ip      6:48AM    0:02.17 smtpd: sched
 _sndio   66682  0.0  0.1   516   744 ??  I<p     6:48AM    0:00.17 /usr/bin/snd
 _sndiop  92235  0.0  0.1   504   920 ??  IpU     6:48AM    0:00.08 sndiod: help
 root      1376  0.0  0.1   672  1268 ??  Sp      6:51AM    0:00.84 /usr/sbin/cr
 root      6575  0.0  0.0   484   360 00  R+pU/0  7:32AM    0:00.35 ps -aux
 root     13541  0.0  0.1   288  1296 C0  I+pU    6:51AM    0:00.58 /usr/libexec
 root     70324  0.0  0.1   292  1308 C1  I+pU    6:51AM    0:00.54 /usr/libexec
 root     10475  0.0  0.1   296  1312 C2  I+pU    6:51AM    0:00.44 /usr/libexec
 root     81779  0.0  0.1   292  1304 C3  I+pU    6:51AM    0:00.58 /usr/libexec
 root     45364  0.0  0.1   284  1280 C5  I+pU    6:51AM    0:00.47 /usr/libexec
 fugu-demo# 
ps is a command that displays what programs (processes) are currently running. ~
Even if the system is just starting up and it looks like there is no movement on the screen, you can see that many processes have already been started internally.

From now on, I will explain the settings that should be done when you log in as root for the first time.

*** Change time zone [#j329c68f]
FuguIta immediately after booting in mode 0 has the time zone (time zone) set to UTC (Universal Coordinated Time). ~
Japan Standard Time (JST) is 9 hours ahead of Coordinated Universal Time.
 fugu-demo# date 
 Fri Feb 10 05:14:49 UTC 2023
To change FuguIta's time zone to JST, enter the command as follows and change the file pointed by the symbolic link /etc/localtime.
 fugu-demo# cd /etc
 fugu-demo# ls -l localtime
 lrwxr-xr-x  1 root  wheel  23 Feb 10 05:13 localtime -> /usr/share/zoneinfo/UTC
 fugu-demo# ln -s -f /usr/share/zoneinfo/Asia/Tokyo localtime                     
 fugu-demo# ls -l localtime
 lrwxr-xr-x  1 root  wheel  30 Feb 10 14:15 localtime -> /usr/share/zoneinfo/Asia/Tokyo
 fugu-demo# date
 Fri Feb 10 14:15:44 JST 2023
 fugu-demo# 
>''[Memo]''~
''⇒''If the JST after setting is different from the actual time, use the [[date>man:date.1]] command to correct it.

///#aname(adduser)
///***一般ユーザの登録 [#g69bab25]
///起動直後のFuguItaは、スーパユーザ(システム管理)用のアカウントrootでのみログインできます。
///
///Unix系のOSでは、通常は一般ユーザとしてログインし、日常の利用を行います。~
///システム管理の時には、スーパユーザとしてログインし直して管理作業を行います。
///>&color(red){''【ご注意】''};~
///&color(red){''!!''スーパユーザでログイン中はシステムを動作不能にしてしまうような操作を容易に実行できてしまいます。勿論、意にではない誤操作の場合も例外ではありません。このようなリスクを防ぐため、一般ユーザのアカウントを作成し、通常はそのアカウントで使用することを''強くお勧め''します。};
///
///以下、一般ユーザとしてyoshiというアカウントを作成してみます。~
///ユーザアカウントの作成もシステム管理ですので、rootで行います。
///
///ユーザアカウントを追加するには[[adduser>man:adduser.8]]というコマンドを使用します。~
///まず、ユーザアカウント追加時のデフォルト値を訊かれます。これはadduserの初回の実行時にだけ訊かれます。通常はて<Enter>キーのみの入力で問題ありません。
/// # adduser
/// Couldn't find /etc/adduser.conf: creating a new adduser configuration file
/// Reading /etc/shells
/// Enter your default shell: bash csh ksh nologin nsh sh [ksh]:
/// Your default shell is: ksh -> /bin/ksh
/// Default login class: authpf bgpd daemon default pbuild staff unbound
/// [default]:
/// Enter your default HOME partition: [/home]:
/// Copy dotfiles from: /etc/skel no [/etc/skel]:
/// Send welcome message?: /path/file default no [no]:
/// Do not send message(s)
/// Prompt for passwords by default (y/n) [y]:
/// Default encryption method for passwords: auto blowfish [auto]:
/// Use option ``-silent'' if you don't want to see all warnings and questions.
/// 
/// Reading /etc/shells
/// Check /etc/master.passwd
/// Check /etc/group
///次に、一般ユーザのアカウント作成の報を入力します。例として「yoshi」というユーザアカウントを作成してみます。~
///最初に表示されているように、力内容は最後に訂正でき(入力しなおせ)ます。
/// Ok, let's go.
/// Don't worry about mistakes. There will be a chance later to correct any input.
/// Enter username []: yoshi                        ←アカウント名(半角アルファベット半角数字)
/// Enter full name []: Yoshihiro Kawamata          ←ユーザの本名
/// Enter shell bash csh ksh nologin nsh sh [ksh]:  ←<Enter>を力 (ログインシェル)
/// Uid [1000]:                                     ←<Enter>を力 (ユーザID)
/// Login group yoshi [yoshi]:                      ←<Enter>を力 (ログイングループ)
/// Login group is ``yoshi''. Invite yoshi into other groups: guest no
/// [no]: wheel                                     ←(ログイングループ以外に加するグループ)
/// Login class authpf bgpd daemon default pbuild staff unbound
/// [default]:                                      ←<Enter>を力 (ログインクラス)
/// Enter password []:                              ←パスワードを力 (表示されません)
/// Enter password again []:                        ←確認のためのパスワード再/// 
/// Name:        yoshi
/// Password:    ****
/// Fullname:    Yoshihiro Kawamata
/// Uid:         1000
/// Gid:         1000 (yoshi)
/// Groups:      yoshi wheel
/// Login Class: default
/// HOME:        /home/yoshi
/// Shell:       /bin/ksh
/// OK? (y/n) [y]: y                                ←力内容の確認
/// Added user ``yoshi''
/// Copy files from /etc/skel to /home/yoshi
/// Add another user? (y/n) [y]: n                  ←他にもユーザアカウント作成するなら「y」
/// Goodbye!
/// # 
///>''【メモ】''~
///''⇒''この例ではアカウントyoshiをwheelというグループにも加させています。~
///wheelに加しているユーザは、システム管理作業を行うために、一時的にrootになることができます。
///
///以上で、yoshiという一般ユーザアカウントが作成されました。
///
///***一般ユーザに管理権限を与える
///前で説明したように、システム管理作業を行うには、一般ユーザから一時的にスーパユーザになるか、あるいは一般ユーザからログアウトした後、スーパユーザとしてログインし直す必要があります。
///
///OpenBSDでは、[[doas>man:doas]]というコマンドを使用して一般ユーザがrootの権限でコマンドを実行することができます。
///
///doasを使うには、まず設定ファイル[[/etc/doas.conf>man:doas.conf]]を編集する要があります。~
///最初はdoas.confは存在していませんので以下のコマンドを実行し、ファイルを作成します(doas.confがすでに存在している場合は、テキストエディタでdoas.confを編集します)。
/// # echo permit persist :wheel > /etc/doas.conf
/// # chmod 0600 /etc/doas.conf
///この操作で、「permit persist :wheel」という容1行だけが書かれたファイル doas.conf が作成されます。これは「wheelグループに所属しているユーザに対してroot権限でのコマンド実行を許可するように」という意味の設定です。
///>''【メモ】''~
///''⇒''doasを実行すると、実行したユーザのパスワードを要求しますが、上の例では「persist」を指定しているため、パスワードの力に成功してから数分間はdoasを再実行してもユーザのパスワード入力が省略されます。
///
///#aname(usbfadm_expand)
///***USBメモリの保存領域を拡張する [#k9cd1e38]
///[[FuguItaのLiveUSBを作る>fg1:create_liveusb]] で説明したように、ダウンロードサイトからイメージファイルをダウンロードし、展開、書込みを行うことでLiveUSB版FuguItaを作成することができます。
///
///しかし、このLiveUSB版FuguItaは、使用するUSBメモリのサイズに関係なく2GBしか領域を使用できません。~
///この、FuguItaのシステムが約1GBを占有していますので、usbfadmでデータを保存できるのは1ギガバイト程度です。
///
///FuguItaに付属のusbfadmユティリティには、データを保存するパーティションのサイズを拡張できるexpandと呼ばれる機能があります。~
///以下にusbfadm expandの使用例を示します。
/// fugu-demo# usbfadm  ← root権限でusbfadmを起動
/// 
/// Welcome to usbfadm.
/// USB flash drive administration tool for FuguIta
/// 
///  Version/Arch: 7.2/amd64  (FuguIta-7.2-amd64-202302081)
///     Boot mode: manual
/// Target device: not set
/// Data saved as: not set
/// 
/// readline capability available
/// TAB to complete the reserved words
/// 
/// Type ? for help.
/// 
/// ? : ? ->target  ← targetコマンドで拡張するパーティションを指定
/// 
/// Searching storage device
/// Please make sure the device inserted.
/// Then press ENTER ->
/// sd0i sd0j sd0k sd1a +sd1d vnd5a  ← 検出されたパーテションの一覧。頭に +記号が
/// target device ->sd1d                付いているのがデータ保存用パーティション
/// 
/// sd1d : ? ->info  ← 指定したパーティションの容量を見てみる
/// 
/// Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
/// /dev/sd1d      1.1G    2.5K    1.1G	0%	 5 1287065     0%   /mnt  ← 容量は1.1GB
/// 
/// scanning...
/// 
/// 512B	7.0/amd64/noasks
/// 
/// sd1d : ? ->expand  ← expand機能を呼出し
/// 
/// Select the expansion method for sd1d:
///   1:  growfs - expands the partition while retaining its contents
///   2:  newfs - expand and format the partition
///   3: [exit without expansion]
/// ->2  ← "newfs"を使ってパーティションを拡張
///パーティションの拡張方法には、「growfs」と「newfs」とがあります。~
///growfsではパーティションに保存されているデータを保持したまま領域を拡張します。~
///newfsでは、領域を拡張した後、パーティションをフォーマットし直します。~
///newfsでは、保存されているファイル・ディレクトリはて消えてしまいますので、ご注意下さい。一方、growfsにおいても、実行前にデータのバックアップを取っておくことをお勧めします。
/// This makes sd1d as large as possible.
/// Note that all contents in sd1d will be removed
/// Do you proceed? [y/N] -> y
/// 
/// /dev/rsd1d: 3136.5MB in 6423488 sectors of 512 bytes
/// 257 cylinder groups of 12.24MB, 3134 blocks, 6272 inodes each
/// super-block backups (for fsck -b #) at:
///  144, 25216, 50288, 75360, 100432, 125504, 150576, 175648, 200720, 225792,
///     :
///  6368432, 6393504, 6418576,
/// ** /dev/rsd1d
/// ** File system is already clean
/// ** Last Mounted on
/// ** Phase 1 - Check Blocks and Sizes
/// ** Phase 2 - Check Pathnames
/// ** Phase 3 - Check Connectivity
/// ** Phase 4 - Check Reference Counts
/// ** Phase 5 - Check Cyl groups
/// 1 files, 1 used, 5611214 free (14 frags, 701400 blocks, 0.0% fragmentation)
/// 
/// sd1d : ? ->info  ← 拡張後の容量を確認
/// 
/// Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
/// /dev/sd1d      2.7G    2.5K    2.7G	0%	 5 1611897     0%   /mnt  ← 2.7GBに増加している
/// 
/// scanning...
/// 
/// 512B	7.0/amd64/noasks
/// 
/// sd1d : ? ->quit
/// 
/// Bye bye...
/// fugu-demo#
///>''【メモ】'' ~
///''⇒''ファイルシステムのパラメータ(フォーマット形式、ブロックサイズ、フラグメントサイズ、iノード密度など)は、growfsでは拡張前のものがそのまま使われるのに対し、newfsでは拡張後のサイズに合ったパラメータが設定され、フォーマットが実行されます。
///
///***ログアウト [#uaac716c]
///現在使用しているアカウントを終了(ログアウト)するにはexitコマンドを力します。
/// fugu-demo# exit
/// 
/// OpenBSD/amd64 (fugu-demo.localnet) (tty00)
/// 
/// login: 
///
///**一般ユーザでログイン [#tbce0de3]
///前で一般ユーザのアカウントを作成しましたので、このアカウントでログインしてみます。
/// OpenBSD/amd64 (fugu-demo.localnet) (tty00)
/// 
/// login: yoshi
/// Password:
/// OpenBSD 7.2-stable (RDROOT.MP) #30: Wed Feb  8 13:07:26 JST 2023
/// 
/// Welcome to FuguIta, the OpenBSD-based live system.
/// 
/// FuguIta aims to help popularize OpenBSD operating system by making it easier
/// to get started with.
/// 
/// For information on FuguIta's specific features and how to use them, please
/// refer to the documentation on https://fuguita.org/.
/// 
/// If you have any questions or suggestions for FuguIta, please send an email to
/// me or post a message to fuguita.org's message board.
/// Please feel free to contact me.
/// 
/// Yoshihiro Kawamata
/// kaw@on.rim.or.jp , https://fuguita.org/
/// 
/// fugu-demo$ pwd
/// /ram/home/yoshi
/// fugu-demo$ ls
/// fugu-demo$ ls -a
/// .          .Xdefaults .cvsrc     .mailrc    .ssh
/// ..         .cshrc     .login     .profile
/// fugu-demo$ 
///>''【メモ】''~
///''⇒''rootでログインしたときのシェルのプロンプトは「fugu-demo#」になりますが、一般ユーザの場合は「fugu-demo$」となります。~
///以降の例示箇所でもこの表記に従います。
///
///#aname(usbfadm_sync)
///***USBメモリにファイルを保存する [#c2ed3d80]
///FuguItaではユーザが作成したファイル、設定の変更、追加されたパッケージ、システムのログなど一切のデータをLiveUSB版のFuguItaに作成されている保存用パーティションに保存し、次回以降の起動時に呼び出すことができます。
///
///データを保存するためにはusbfadmコマンドを実行します。
///usbfadmを実行するためには管理権限が必要なので、doasコマンドを使ってusbfadmを実行します。
/// fugu-demo$ doas usbfadm
/// doas (yoshi@fugu-demo.localnet) password: 
/// 
/// Welcome to usbfadm.
/// USB flash drive administration tool for FuguIta
/// 
///  Version/Arch: 7.2/amd64  (FuguIta-7.2-amd64-202302081)
///     Boot mode: manual
/// Target device: /dev/sd0d
/// Data saved as: fugu-demo
/// 
/// readline capability available
/// TAB to complete the reserved words
/// 
/// Type ? for help.
/// 
/// ? : ? ->
///まず、targetコマンドを使用して保存のパーティションを指定します。~
///保存用のデバイスが着されていることを確認した後、ENTERを押下するとデバイスのスキャンが行われます。~
///デバイス名の前に+記号がついているものが、保存に使用することができるデバイスです。
/// ? : ? --> target
/// 
/// Searching USB flash drives
/// Please make sure the device inserted.
/// Then press ENTER ->
/// cd0a sd0a +sd0d
/// 
/// targe device--> sd0d
///
///次に、saveasコマンドを使用して保存するデータに名前を付けます。~
///名前を省略した場合、ホスト名が保存名として使用されます。
/// sd0d : ? --> saveas
/// Name of saved data --> fugu-demo
/// 
/// Your data will be saved as ``fugu-demo''.
///当初「? : ?」だったプロンプトの文字列が変化していることにご注目下さい。
///今ほどのtargetコマンドとsaveasで設定した値がプロンプトに表示され、確認ができるようになっています。
///
///最後にsyncコマンドを実行し、データを実際に保存します。
///  /dev/sd0d : fugu-demo -> sync
/// 
/// Sync current mfs as fugu-demo, OK? -> y
/// 
/// building file list ... done
/// created directory /mnt/livecd-config/fugu-demo
/// ./
/// etc/
/// etc/bgpd.conf
/// etc/boot.conf
///    :
///    :
/// var/yp/Makefile.yp
/// var/yp/Makefile.yp.dist
/// var/yp/README
/// 
/// sent 16455591 bytes  received 232568 bytes  180412.53 bytes/sec
/// total size is 15492096  speedup is 0.93
///infoコマンドで保存されたデータの報を表示してみます。
/// /dev/sd0d : fugu-demo -> info
/// 
/// Filesystem     Size    Used   Avail Capacity  Mounted on
///  /dev/sd0d     218M   18.9M    179M   9.6%    /mnt
/// 
/// scanning...
/// 
/// 18.9M   6.0/amd64/fugu-demo
///データは問題なく保存されているようなのでusbfadmを終了します。
/// /dev/sd0d : fugu-demo -> bye
/// 
/// fugu-demo$
///>''【メモ】''~
///usbfadmによる保存は、シェルのコマンドラインからも行うことができます。
/// fugu-demo$ doas usbfadm -r
/// doas (yoshi@fugu-demo.localnet) password: 
/// 
/// ========================================
/// = Sync current mfs as fugu-demo into /dev/sd0d
/// =
/// sending incremental file list
/// deleting etc/X11/xenodm/authdir/authfiles/A:0-G4H73h
///    :
/// var/spool/smtpd/purge/
/// var/spool/smtpd/temporary/
/// #
///オプション -r は、usbfadmにファイル保存の再実行を指示します。~
///~
///また、cronを使用してバックグラウンドで定期的に実行することもできます。
/// (crontabファイル)
/// # crontab file
/// #minute hour    mday    month   wday    command
///   ~ 略 ~
/// #save session periodically
/// #0       */4     *       *       *       PATH=$PATH:/usr/local/bin /usr/fuguita/sbin/usbfadm -rq
///これにより、usbfadmによる保存がバックグラウンドで4時間ごとに行われます。-q は進捗状況などを表示しない「quiet」オプションです。
///
///>''【メモ】''~
///''⇒''usbfadmコマンドで作成したパーティションでなくとも、OpenBSDのFFS形式でフォーマットされていて、/livecd-configというディレクトリが作成されているパーティションであれば使用できます。
///
///***FuguItaを終了する [#lcb9f9a0]
///FuguItaの運用を終了するにはrootでログインし、[[shutdown>man:shutdown.8]]コマンドを実行します。~
///または一般ユーザで、doasコマンドを使用してshutdownコマンドを実行します。
/// fugu-demo$ doas shutdown -h -p now
/// doas (yoshi@fugu-demo.localnet) password: 
/// Shutdown NOW!
/// shutdown: [pid 4771]
/// fugu-demo$
/// *** FINAL System shutdown message from root@fugu-demo.localnet ***
/// System going down IMMEDIATELY
/// 
/// 
/// 
/// System shutdown time has arrived
/// 
/// fugu-demo$ syncing disks... done
///上の例では、shutdownコマンドへの指定として -h オプションを指定しているので、システムは停止(halt)します。
///また、同時に-p オプションを指定しているので停止直後に電源が自動的にOFF (power off)になります(PCによっては -p オプションによる電源OFFに対応していない機種もあります。この場合は手動で本体の電源をOFFにします)。
///~ -h オプションや -p オプションの替わりに -r オプションを指定すると、システムは再起動(reboot)します。~
///
///FuguItaでは、ユーザが作成したデータやシステムの設定ファイルはメモリ上に保持されていますので、[[usbfadmコマンドによる保存>#usbfadm_sync]]を行わないでシステムを停止すると、それらのデータは消えてなくなります。
///
///FuguIta上で行った操作がシステムを停止すると消えてしまうということは、見方を変えると蔵ハードディスクにインストールされている既存のシステムなどに影響を及ぼしにくいということでもあります。~
///つまり、rootでファイルの消去やプロセスの停止などを行ってもその影響は限定的なので、システム管理の練習などを安心して行うことができます。
///
///#aname(boot_mode3)
///**保存した設定やファイルを読み込む [#p11aec5c]
///[[設定やファイルを保存する>#usbfadm_sync]] で説明した方法で保存されたデータは以降の起動時に読み込ませ、環境を復帰させることができます。~
///データを復帰させるには、起動モードの選択でモード3を選択します。
/// Boot modes:
///   0: fresh boot - standard mode as a live system
///   1: fresh boot - less memory, faster boot (/usr is non-writable, can't pkg_add)
///   2: fresh boot - works using only RAM (about 1GB or more of RAM required)
///   3: boot with retrieving saved files from storage device
///      or enter passphrase for an encrypted volume
///   4: boot with retrieving saved files from floppy disk
///   5: interactive shell for debugging
/// ->3
/// scanning partitions: sd0a sd0d sd0i cd0a
/// Device(s) found:
///   loadable from: sd0d
/// Which is FuguIta's storage device? [default: sd0d] -> sd0d
/// /dev/sd0d : available data;
/// 
/// fugu-demo
/// 
/// config name -> fugu-demo
/// Copying files from flash to ram ... 
///保存したデータ名を指定すると退避させていたデータを復帰し、起動が再開されます。~
///各種設定値もすべて復帰するため、最初に説明した起動モード0と違いネットワークの設定などは訊かれません。
///
///ログイン後、さらにデータを保存することもできます。手順は [[設定やファイルを保存する>#usbfadm_sync]] で説明した方法と同じですが、
///すでにLiveUSB上にファイルが保存されているため、変更したファイルやディレクトリのみが対象となります。~
///そして、保存デバイス名と保存名はすでに設定済みなので、いきなりsyncコマンドを実行してもOKです。
///
///シャットダウン時、デフォルトではデータの退避は自動的に行われないので、その都度手動でusbfadmコマンドを実行する要があります。
///これを自動化したい場合は [[終了時にデータが自動で保存されるようにする>fg3:autosave]] の設定を行って下さい。
///
///***X Window Systemを起動してみる。 [#x82da9c0]
///OpenBSDはX Window Systemというグラフィクス環境を含んだ形で出荷されており、FuguItaもこのX Window Systemを使用することができます。
///>''【メモ】''~
///''⇒''X Window Systemは「X」や「X11」などと略して呼んでもよいことになっています。以下、X Window SystemをXと表記することにします。
///
///Xを使用するには、準備編の[[ログイン方法の選択>fg1:loginmethod]] で説明したように、ログイン方法としてX Window Systemを選択します。
/// Do you login with Console or X Window System?
/// [default: Console] -> x
///Xが起動すると、以下のようなログイン画面が表示されますので、ユーザ名とパスワードを力します。
///#ref(FuguItaガイド/xenodm-login.png,,50%)
///ログインに成功すると以下のような画面になります。
///#ref(FuguItaガイド/startx.png)
///画面左上の白いウィンドウは「端末エミュレータ」というもので、X上でシェルとのセッションなど、文字端末での作業を行うためのプログラムです。~
///右上には時計が表示されています。~
///左下にあるものは「xconsole」といい、システムのログ報を表示するプログラムです。起動直後はこのプログラムはアイコン化されています。~
///右下の表のようなものは、「仮想デスクトップ」といい、複数のデスクトップ画面を切り替えて使用できるようにするものです。標準の設定では3列×3行=9面のデスクトップ画面を切り替えられます。
///
///壁紙部分(Xでは、「ルートウィンドウ」と呼びます)でマウスの左ボタンを押すとメニューが表われます。このメニューからXのアプリを選択して実行できます。メニューにないものは端末エミュレータからコマンドを投して実行することもできます。
///
///以下の画面は、実際にアプリを実行してみた例です。
///#ref(FuguItaガイド/various-xclt.png,wrap)
///ルートウィンドウではマウスの中ボタンや右ボタンを押すことで、別のメニューが表示されます。
///>''【メモ】''~
///''⇒''Xの操作は3ボタンマウスによる操作を想定して設計されています。
///中ボタンのないマウスの場合は、左右のボタンを両方同時に押すか、あるいはホイールを押します。
///
///Xを終了するには、マウスの左ボタンのメニュー中、「Exit」を選択し、さらに本当に終了するかを確認するウィンドウに対し「Exit」を選択します。
///#ref(FuguItaガイド/quit-verify-win.png,wrap)
///
///>''【メモ】''~
///''⇒''OpenBSDには、X Windowを使うためのソフトウェア(デスクトップ環境)が何種類か用意されており、また、日本語の表示や力用のソフトウェアを追加することもできます。これについては応用編の [[日本語デスクトップ環境を導入する>fg3:dtjsetup]] で説明致します。
///
///*使用法の習得 [#r70ef50e]
///#aname(useunix)
///** Unix系OSの使い方を調べる [#h19a6ead]
///本ガイドの冒頭で説明したように、FuguItaはUnix系OSの一種である OpenBSD をベースにして作成されています。
///
///Unixは約半世紀前の1969年に開発され、以降さまざまなコンピュータ向けの実が作成されてきました。今ではUnix系のOSはスーパーコンピュータからスマートフォンや家電製品、あるいは小さな組込み機器までさまざまな環境で使用されるに至っています。
///
///Unix系OSはMicrosoft WindowsなどのOSとは操作方法が大きくことなっており、最初はどのように使ってよいか見当がつかない方もいるかも知れません。
///
///Unix系OSの基本的な部分はコンシューマユーザ向けに作られてはいません。OpenBSDも例外ではなく、予備知識を持たないユーザを想定した親切なユーザインターフェースなどは初期状ではほとんど用意されていません。言い替えると''「なんとなくあちこちいじっているうちに使い方がわかった」ということにはなりません。''
///
///そんなUnix系OSを理解し、活用するにはどのようなアプローチを取ればよいのでしょうか。
///
///***書籍の用意 [#u17669c8]
///>Unix系OSに関する基本を解説している書籍を用意しましょう。~
///様な実装が存在するUnix系OSですが、それらには [[Unix哲学>https://ja.wikipedia.org/wiki/UNIX%E5%93%B2%E5%AD%A6]] とも呼ばれる共通した考え方があります。この考え方を理解し、実践できるようになることがUnix系OSを習得する上でのキーになります。~
///書籍の容としては特定の実装だけを対象とせず、基本的な概念から応用の入口までを網羅的・体系的に解説しているものがよいでしょう。~
///>「これ一冊読めばすべてOK」というような書籍はなかなかないのですが、定評のあるものをいくつか挙げておきます;
///-はじめてUNIXで仕事をする人が読む本 / 木本彦 他 著 / KADOKAWA アスキーメディアワークス
///-新 The Unix Super Text [上]  / 山口和紀・古瀬一隆 著 / 技術評論社
///
///>以下のものは副読本として読むと、より理解が進むかもしれません;
///-Unixという考え方-その設計思想と哲学 / Mike Gancarz著 芳尾桂訳 / オーム社
///-Linuxを「読む」 / こじまみつひろ著 / 毎日コミュニケーションズ
///
///#aname(man)
///***オンラインマニュアルを活用する [#w1893733]
///>やはり自分で手を動かすことが、効果的なスキル習得の基本になります。~
///その際、やみくもにやってみるのではなく、システムに蔵されているオンラインマニュアル(manコマンド)を活用しましょう。オンラインマニュアルは記述が、違う実装に基いて説明している、というような弱点はありません。
///>>''【メモ】''~
///''⇒''Unixのオンラインマニュアルは幾つかの章に別れています。~
///同じ名前の目が複数の章にある場合があります。例えば「sleep」は、1章(一般コマンド)と3章(ライブラリ)の両方にあり、それぞれsleep(1)、sleep(3)の様に記述します。ですので、sleepコマンドのコマンドラインを知りたい場合は、
/// $ man 1 sleep
///C言語でプログラミングをしていて、sleep関数の使い方を知りたい場合は、
/// $ man 3 sleep
///として第3章にあるsleep関数の説明を表示します。
///
///ですので、これ以降「ls(1)」のような表記が出てきますが、これは「"man 1 ls"を実行してオンラインマニュアルの1章にある"ls"のを参照して下さい」という意味になります。
///>''【メモ】''~
///''⇒''オンラインマニュアルのことをマニュアルページと呼ぶこともあります。意味は同じです。
///
///オンラインマニュアルとは別に、Unixのコマンドの多くは自分自身の使用説明を表示する機能を持っています;
/// $ man
/// usage: man [-acfhklw] [-C file] [-I os=name] [-K encoding] [-M path] [-m path]
///            [-O option=value] [-S subsection] [-s section] [-T output] [-W level]
///            [section] name ...
/// $ cp -?
/// cp: unknown option -- ?
/// usage: cp [-fip] [-R [-H | -L | -P]] source target
///        cp [-fip] [-R [-H | -L | -P]] source ... directory
///上の例ではmanコマンドとcpコマンドのヘルプメッセージを表示させています。~
///このようにコマンドのヘルプメッセージは非常に簡素な説明なので、忘れてしまったコマンドラインオプションを思い出すため、といったような備忘録的な役割で使用されます。
///
///***「参考報」としてネットを活用
///>インターネットを活用するとUnix系OSに関連する報も、簡単に得ることができます。 ~
///しかし、前で説明したような弱点もあります。特に検索エンジンでの検索結果については目の前の実機にもあてはまるかどうかは自分で判断する必要があります。検索サイトの結果は「参考情報」として活用するのがよいでしょう。~
///さらに、現在では多くのUnix系OSが開発コミュニティなどによる「式サイト」を持っています。公式サイトの情報は一次情報として活用できます。~
///
///***まとめ [#m2783069]
///以上述べたことを例えば「ファイルの属性」というトピックにあてはめて考えると、次のようになるでしょう;
///
///-書籍で基礎事を押さえる ~
///→ファイルのオーナ・グループ・パーミッションとは何か、どのようなコマンドで操作するかを調べる。
///
///-オンラインマニュアル等で確認しながら実際に操作 ~
///→実際にchown, chgrp, chmodコマンドなどを実行し、結果を確認してみる。どのようなコマンドラインオプションがあるかなどをmanコマンドで調べる。
///
///-ネットで関連報・参考情報をゲット~
///→ネットの検索などで注意点、はまりやすい点、色な応用法などを調べてみる。~
///→式サイトで関連情報を調べる ... 仕様の変更やセキュリティホール情報がないか、など。
///
///FuguItaは以上で述べたようなUnix系OSの習得にも向いています。つまり、インストール作業不要というライブシステムの特徴を活かし、ユーザが気軽に色と試せる環境、失敗しても容易にやりなおせる環境を提供しています。
///
///#aname(useopenbsd)
///**OpenBSDの使い方を調べる [#g576b58f]
///前節の [[Unix の使い方を調べる>#useunix]] ではUnix系OSの使用経験のあまりない人がUnix系OSの使い方を習得するためのヒントについて説明しましたが、この節ではOpenBSDを使う場合の報源やそれらを活用する上でのポイントについて説明します。
///
///***導
///rootでログインすると、OpenBSDプロジェクト開発リーダーTheo de Raadt氏からのメールが届いています。
/// # mail
/// Mail version 8.1.2 01/15/2001.  Type ? for help.
/// "/var/mail/root": 1 message 1 new
/// >N  1 deraadt@do-not-re  Sun Oct 18 07:58   86/4565  Welcome to OpenBSD 5.8!
/// & more 1
/// Message 1:
/// From deraadt@do-not-reply.openbsd.org Sun Oct 18 07:58:58 MST 2015
/// Date: Oct 18 07:58:58 MST 2015
/// From: deraadt@do-not-reply.openbsd.org (Theo de Raadt)
/// To: root
/// Subject: Welcome to OpenBSD 5.8!
/// 
/// This message attempts to describe the most basic initial questions that a
/// system administrator of an OpenBSD box might have.  You are urged to save
/// this message for later reference.
/// ....(以下略)....
///このメールでは、OpenBSDをインストールした人が最初に持つと思われる疑問について説明しています。メール本文に書いてある報源をたどってゆくことで、OpenBSDを使用する上での様々なノウハウを得ることができます。
///
///以下このメールの容と重複する部分もありますが、システム上の各種情報源について触れていきます。
///
///***システムのドキュメント
///[[Unixの使い方を調べる>#useunix]] で述べたようにオンラインマニュアルはUnix系OSの最も基本的な報源ですが、OpenBSDにおいても例外ではありません。~
///そのことはインストール直後のroot宛てメールにおいても、以下のように強調されています;
/// Again, PLEASE READ THE MANUAL PAGES.  Our developers have spent countless
/// hours improving them so that they are clear and precise.
///マニュアルページには、特に導のためのエントリも幾つか用意されています。
///:[[help>man:help.1]]|Unix初心向けのエントリです。コマンドラインで''help''コマンドを実行した場合もこのエントリが表示されます。
///:[[man>man:man.1]]|manコマンドの説明です。OpenBSDではmandocというプログラムによってマニュアルページのシステムが再実されていますが、manコマンドの使い方は他のUnix系OSとほぼ同じです。
///:[[afterboot>man:afterboot.8]]|インストール直後にチェックを行ったほうがよい目について解説しています。この文書の [[入門編>fg2:pagetop]] より詳しく網羅的な内容ですので、ご一読をお勧めします。
///:intro|マニュアルページはカテゴリごとに章に別れていますが、その各章に関する説明です。例えば、
/// man 1 intro
///とすると、一般コマンドカテゴリについての説明が、
/// man 5 intro
///では、ファイル形式のカテゴリ般についての説明が表示されます。
///
///OpenBSDでは、マニュアルページの章立ては以下のようになっています;
///|1    |一般コマンド                              |
///|2    |システムコールとエラー番号                |
///|3    |ライブラリ                                |
///|4    |デバイスドライバ                          |
///|5    |ファイル形式                              |
///|6    |ゲーム                                    |
///|7    |その他                                    |
///|8    |システム保守・運用のためのコマンド        |
///|9    |カーネル                                  |
///
///各セクションのマニュアルの容は現状のシステムに追従し続けており、常にアップデートと推敲が行われています。~
///また他のUnix系OSでは4章(デバイスドライバ)などの章で、ほとんど報が提供されていない実装系もありますが、OpenBSDではこのような情報も完備されており、例えばWi-Fiの設定のように使用するハードウェアに依存した設定情報が必要な場合も十分な情報を得ることができます。
///>''【メモ】''~
///''⇒''OpenBSDに蔵されているオンラインマニュアルはmanコマンドで読めますが、ウェブブラウザで man.openbsd.org にアクセスして読むこともできます。~
///FuguItaガイドでもコマンドの説明中 [[ls(1)>man:ls.1]] のようにリンクを張ってある部分はウェブのオンラインマニュアルを参照できます。
///
//////|TO BE REVISED|
///#ref(FuguItaガイド/emacsinfo.png,around,right)
///GNUプロジェクト由来のコマンドやEmacs上で動作するアプリケーションに関しては、Info形式のドキュメントが提供されている場合があります。~
///Infoドキュメントを閲覧するには、[[info>man:info.1]]コマンドを実行します。
///>''【メモ】''~
///''⇒''Emacsエディタを追加インストールしている環境では、InfoドキュメントはEmacsエディタから、''<Meta>-x info<Enter>''、あるいは''<Escape> x info<Enter>''と力し、閲覧することができます。
///#clear
///
///マニュアルページやInfo以外にもアプリケーション固有のドキュメントがあります。
///それらは主に次に挙げるディレクトリの下にあります;
///-/usr/share/doc
///-/usr/X11R6/share/doc
///-/usr/local/share/doc
///-/usr/local/share/gtk-doc
///
///***システム上のファイル [#sd8aa942]
///サーバやアプリケーションソフトなどの設定ファイルはすべて/etc以下に集約されています。~
///パッケージ管理ツールports/packagesで追加されたソフトウェアは、/usr/local以下にインストールされますが、設定ファイルに関しては/etc以下に置されます。X関連の設定ファイルについても同様です。
///
///システムの動作ログは、/var/log以下にあります。唯一、cronのみが/var/cron/logというログファイルを作成します。
///
///[[起動時の設定>fg1:bootsetup]] で説明した起動時に表示されるカーネルメッセージは、/var/run/dmesg.boot というファイルに記録されています。システム起動完了後はこのファイルの容を閲覧することで、システム起動時の様子を調査することができます。
///
///***インターネット上の///:http://www.openbsd.org/|プロジェクトによって運営されている式サイト。[[OpenBSD全般に関する詳細なガイド>http://www.openbsd.org/faq/index.html]] や [[システムの更新情報>http://www.openbsd.org/errata72.html]] など、ウェブ上のOpenBSD関連情報の起点です。
///:http://undeadly.org/ 「OpenBSD Journal」|OpenBSD関連のニュースサイト。その都度OpenBSDの旬の話題が取り上げられ、OpenBSD開発の最前線の様子なども知ることができます。以前、[[FuguItaの紹介記事>http://undeadly.org/cgi?action=article&sid=20131210093950]] も投稿されました。
///:メーリングリスト|[[式に管理・運営されているメーリングリスト>http://www.openbsd.org/mail.html]] があります。また、これらのアーカイブサイトもあり、メーリングリストに加入しなくてもウェブ上での閲覧が可能です。
///
///***書籍 [#y291b608]
///作の知る限り、OpenBSDユーザ向けに書かれた日本語の書籍は2023年現在出版されておりません。~
///BSD系のUnix向けの書籍の中には、
///-BSD HACKS ~ プロが使うテクニック&ツール100選 / Dru Lavigne著,桃井康成監修,林秀幸訳 / オライリー・ジャパン
///
///など、部分的にOpenBSDについて言及されている書籍もあります。
///
///英語の書籍に関しては [[式サイトの記述>http://www.openbsd.org/books.html]] をご参照下さい。~
///'''Absolute OpenBSD, 2nd Edition''' や '''The book of PF, 3rd Edition'''など、OpenBSD向けの書籍がいくつか出版されているようです。
#aname(adduser)
*** General user registration [#g69bab25]
Immediately after starting FuguIta, you can only log in with the superuser (system administrator) account root.

On a Unix-based OS, you normally log in as a general user and use the system on a daily basis. ~
When doing system administration, log back in as superuser to perform administrative tasks.
>&color(red){''[Caution]''};~
&color(red){''!!''While logged in as the superuser, it is easy to perform operations that render the system inoperable. Of course, unintentional erroneous operation is no exception. To prevent such risks, it is ``strongly recommended'' that you create a general user account and use it normally. };

Below, create an account called yoshi as a general user. ~
Creating user accounts is also system management, so do it as root.

Use the command [[adduser>man:adduser.8]] to add a user account. ~
First, you will be asked for default values when adding a user account. This is only asked the first time adduser is run. Normally, there is no problem with inputting only the <Enter> key.
 # adduser
 Couldn't find /etc/adduser.conf: creating a new adduser configuration file
 Reading /etc/shells
 Enter your default shell: bash csh ksh nologin nsh sh [ksh]:
 Your default shell is: ksh -> /bin/ksh
 Default login class: authpf bgpd daemon default pbuild staff unbound
 [default]:
 Enter your default HOME partition: [/home]:
 Copy dotfiles from: /etc/skel no [/etc/skel]:
 Send welcome message?: /path/file default no [no]:
 Do not send message(s)
 Prompt for passwords by default (y/n) [y]:
 Default encryption method for passwords: auto blowfish [auto]:
 Use option ``-silent'' if you don't want to see all warnings and questions.
 
 Reading /etc/shells
 Check /etc/master.passwd
 Check /etc/group
Next, enter the information for general user account creation. As an example, let's create a user account called "yoshi". ~
As shown at the beginning, the input can be corrected (retyped) at the end.
 Ok, let's go.
 Don't worry about mistakes. There will be a chance later to correct any input.
 Enter username []: yoshi
 Enter full name []: Yoshihiro Kawamata
 Enter shell bash csh ksh nologin nsh sh [ksh]:
 Uid [1000]:
 Login group yoshi [yoshi]:
 Login group is ``yoshi''. Invite yoshi into other groups: guest no
 [no]: wheel
 Login class authpf bgpd daemon default pbuild staff unbound
 [default]:
 Enter password []:
 Enter password again []:
 
 Name:        yoshi
 Password:    ****
 Fullname:    Yoshihiro Kawamata
 Uid:         1000
 Gid:         1000 (yoshi)
 Groups:      yoshi wheel
 Login Class: default
 HOME:        /home/yoshi
 Shell:       /bin/ksh
 OK? (y/n) [y]: y
 Added user ``yoshi''
 Copy files from /etc/skel to /home/yoshi
 Add another user? (y/n) [y]: n
 Goodbye!
 # 
>''[Memo]''~
''⇒''In this example, the account yoshi is also added to the group called wheel. ~
Users with a wheel subscription can temporarily become root to perform system administration tasks.

A general user account called yoshi is now created.

***Give administrator privileges to a general user [#y2b9442b]
As explained in the previous section, to perform system administration tasks, you must temporarily become a superuser from a general user, or log out as a general user and then log back in as a superuser.

On OpenBSD, general users can execute commands with root privileges using the command [[doas>man:doas]].

To use doas, you first need to edit the configuration file [[/etc/doas.conf>man:doas.conf]]. ~
doas.conf does not exist at first, so execute the following command to create the file (if doas.conf already exists, edit doas.conf with a text editor ).
 # echo permit persist :wheel > /etc/doas.conf
 # chmod 0600 /etc/doas.conf
This will create a file doas.conf with a single line "permit persist :wheel". This is a setting that means "to allow users belonging to the wheel group to execute commands with root privileges".
>''[Memo]''~
''⇒''When you execute doas, you will be prompted for the password of the user who executed it, but since "persist" is specified in the above example, doas re-executing will bypass the user's password input.

#aname(usbfadm_expand) 
***Extend the storage area of the USB memory [#k9cd1e38]
As explained in [[Creating a FuguIta LiveUSB>fge1:create_liveusb]], you can create a LiveUSB version of FuguIta by downloading the image file from the download site, expanding it, and writing it.  

However, this LiveUSB version of FuguIta can only use 2GB of space regardless of the size of the USB memory used. ~ 
Of this, the FuguIta system occupies about 1GB, so usbfadm can save about 1GB of data.  

The usbfadm utility that comes with FuguIta has a feature called expand that can expand the size of the partition that stores data. ~

Below is an example of using usbfadm expand.
 fugu-demo# usbfadm  ← start usbfadm with root privileges
 
 Welcome to usbfadm.
 USB flash drive administration tool for FuguIta
 
  Version/Arch: 7.2/amd64  (FuguIta-7.2-amd64-202302081)
     Boot mode: manual
 Target device: not set
 Data saved as: not set
 
 readline capability available
 TAB to complete the reserved words
 
 Type ? for help.
 
 ? : ? ->target  ← Specify the partition to extend with the target command
 
 Searching storage device
 Please make sure the device inserted.
 Then press ENTER ->
 sd0i sd0j sd0k sd1a +sd1d vnd5a  ← list of detected partitions.
 target device ->sd1d                Partitions with a + sign at the beginning
                                     are data storage partitions
 
 sd1d : ? ->info  ← check the capacity of the specified partition
 
 Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
 /dev/sd1d      1.1G    2.5K    1.1G	0%	 5 1287065     0%   /mnt  ← 容量は1.1GB
 
 scanning...
 
 512B	7.0/amd64/noasks
 
 sd1d : ? ->expand  ← call expand function
 
 Select the expansion method for sd1d:
   1:  growfs - expands the partition while retaining its contents
   2:  newfs - expand and format the partition
   3: [exit without expansion]
 ->2  ← extend partition using "newfs"
There are two ways to extend a partition: "growfs" and "newfs". ~
growfs expands the area while retaining the data stored in the partition. ~
newfs reformats the partition after expanding the space. ~
Please note that newfs will erase all saved files and directories. On the other hand, even with growfs,
it is recommended that you back up your data before running it.
 This makes sd1d as large as possible.
 Note that all contents in sd1d will be removed
 Do you proceed? [y/N] -> y
 
 /dev/rsd1d: 3136.5MB in 6423488 sectors of 512 bytes
 257 cylinder groups of 12.24MB, 3134 blocks, 6272 inodes each
 super-block backups (for fsck -b #) at:
  144, 25216, 50288, 75360, 100432, 125504, 150576, 175648, 200720, 225792,
     :
  6368432, 6393504, 6418576,
 ** /dev/rsd1d
 ** File system is already clean
 ** Last Mounted on
 ** Phase 1 - Check Blocks and Sizes
 ** Phase 2 - Check Pathnames
 ** Phase 3 - Check Connectivity
 ** Phase 4 - Check Reference Counts
 ** Phase 5 - Check Cyl groups
 1 files, 1 used, 5611214 free (14 frags, 701400 blocks, 0.0% fragmentation)
 
 sd1d : ? ->info  ← check capacity after expansion
 
 Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
 /dev/sd1d      2.7G    2.5K    2.7G	0%	 5 1611897     0%   /mnt  ← 2.7GBに増加している
 
 scanning...
 
 512B	7.0/amd64/noasks
 
 sd1d : ? ->quit
 
 Bye bye...
 fugu-demo#
>''[Memo]'' ~
''⇒''File system parameters (format type, block size, fragment size, inode density, etc.) are used as they are before expansion in growfs, while in newfs they are changed to the size after expansion. The matching parameters are set and formatting is performed.

***logout [#m60f45ba]
Enter the exit command to terminate (logout) the account you are currently using.
 fugu-demo# exit
 
 OpenBSD/amd64 (fugu-demo.localnet) (tty00)
 
 login: 

**login as a general user [#p70c5caa]
We created a general user account in the previous section, so try logging in with this account.
 OpenBSD/amd64 (fugu-demo.localnet) (tty00)
 
 login: yoshi
 Password:
 OpenBSD 7.2-stable (RDROOT.MP) #30: Wed Feb  8 13:07:26 JST 2023
 
 Welcome to FuguIta, the OpenBSD-based live system.
 
 FuguIta aims to help popularize OpenBSD operating system by making it easier
 to get started with.
 
 For information on FuguIta's specific features and how to use them, please
 refer to the documentation on https://fuguita.org/.
 
 If you have any questions or suggestions for FuguIta, please send an email to
 me or post a message to fuguita.org's message board.
 Please feel free to contact me.
 
 Yoshihiro Kawamata
 kaw@on.rim.or.jp , https://fuguita.org/
 
 fugu-demo$ pwd
 /ram/home/yoshi
 fugu-demo$ ls
 fugu-demo$ ls -a
 .          .Xdefaults .cvsrc     .mailrc    .ssh
 ..         .cshrc     .login     .profile
 fugu-demo$ 
>''[Memo]''~
''⇒''When logged in as root, the shell prompt will be "fugu-demo#", but for general users it will be "fugu-demo$". ~
Follow this notation in the following examples.

#aname(usbfadm_sync)
*** Save file to USB memory [#vbd70334]
FuguIta saves all data such as files created by the user, changed settings, added packages, system logs, etc. to the storage partition created in the LiveUSB version of FuguIta, and recalls it at the next startup. can do.
Run the usbfadm command to save the data. Usbfadm requires administrator privileges to run, so use the doas command to run usbfadm.
 fugu-demo$ doas usbfadm
 doas (yoshi@fugu-demo.localnet) password: 
 
 Welcome to usbfadm.
 USB flash drive administration tool for FuguIta
 
  Version/Arch: 7.2/amd64  (FuguIta-7.2-amd64-202302081)
     Boot mode: manual
 Target device: /dev/sd0d
 Data saved as: fugu-demo
 
 readline capability available
 TAB to complete the reserved words
 
 Type ? for help.
 
 ? : ? ->
First, specify the destination partition using the target command. ~
After confirming that the storage device is installed, press ENTER to scan the device. ~
Devices with a + sign in front of the device name are devices that can be used for saving.
 ? : ? --> target
 
 Searching USB flash drives
 Please make sure the device inserted.
 Then press ENTER ->
 cd0a sd0a +sd0d
 
 targe device--> sd0d

Then name the data you want to save using the saveas command. ~
If the name is omitted, the host name will be used as the save
 sd0d : ? --> saveas
 Name of saved data --> fugu-demo
 
 Your data will be saved as ``fugu-demo''.
Notice that the prompt string, which was originally "? : ?", has changed.
The values ?k?kset by the target command and saveas just now are displayed in the prompt so that you can check them.

Finally run the sync command to actually save the data.
  /dev/sd0d : fugu-demo -> sync
 
 Sync current mfs as fugu-demo, OK? -> y
 
 building file list ... done
 created directory /mnt/livecd-config/fugu-demo
 ./
 etc/
 etc/bgpd.conf
 etc/boot.conf
    :
    :
 var/yp/Makefile.yp
 var/yp/Makefile.yp.dist
 var/yp/README
 
 sent 16455591 bytes  received 232568 bytes  180412.53 bytes/sec
 total size is 15492096  speedup is 0.93
Let's display the information of the data saved with the info command.
 /dev/sd0d : fugu-demo -> info
 
 Filesystem     Size    Used   Avail Capacity  Mounted on
  /dev/sd0d     218M   18.9M    179M   9.6%    /mnt
 
 scanning...
 
 18.9M   6.0/amd64/fugu-demo
The data seems to be saved without problems, so exit usbfadm.
 /dev/sd0d : fugu-demo -> bye
 
 fugu-demo$
>''[Memo]''~
Saving with usbfadm can also be done from the shell command line.
 fugu-demo$ doas usbfadm -r
 doas (yoshi@fugu-demo.localnet) password: 
 
 ========================================
 = Sync current mfs as fugu-demo into /dev/sd0d
 =
 sending incremental file list
 deleting etc/X11/xenodm/authdir/authfiles/A:0-G4H73h
    :
 var/spool/smtpd/purge/
 var/spool/smtpd/temporary/
 #
Option -r tells usbfadm to re-save the file. ~
~
You can also use cron to run periodically in the background.
 # crontab -l
 #minute hour    mday    month   wday    command
   --- omit ---
 #save session periodically
 0       */4     *       *       *       PATH=$PATH:/usr/local/bin /usr/fuguita/sbin/usbfadm -rq
This causes usbfadm saves to happen in the background every 4 hours. -q is a "quiet" option that does not show progress etc.

>''[Memo]''~
''⇒''You can use any partition that is formatted in the OpenBSD FFS format and has a directory named /livecd-config, even if it is not created with the usbfadm command.

***Exit Fuguita [#o83b9962]
To terminate FuguIta operation, log in as root and execute the [[shutdown>man:shutdown.8]] command. ~
Or as a normal user, execute the shutdown command using the doas.
 fugu-demo$ doas shutdown -h -p now
 doas (yoshi@fugu-demo.localnet) password: 
 Shutdown NOW!
 shutdown: [pid 4771]
 fugu-demo$
 *** FINAL System shutdown message from root@fugu-demo.localnet ***
 System going down IMMEDIATELY
 
 
 
 System shutdown time has arrived
 
 fugu-demo$ syncing disks... done
In the above example, the -h option is specified as a specification to the shutdown command, so the system is halted. 
In addition, since the -p option is specified at the same time, the power will be automatically turned off immediately after stopping (some PC models do not support turning off the power with the -p option. In this case, to turn off the unit). ~
If you specify the -r option instead of the -h or -p options, the system will reboot. ~
In Fuguita, user-created data and system configuration files are held in memory. It will disappear.
 
The fact that the operations performed on Fuguita disappear when the system is stopped means that from a different point of view, it is less likely to affect existing systems installed on the internal hard disk. ~
In other words, deleting files, stopping processes, etc. as root has limited impact, so you can practice system administration with confidence.

#aname(boot_mode3)
*** Read saved settings and files [#cee39c36]
The data saved by the method described in [[Save settings and files>#usbfadm_sync]] can be read at subsequent startups to restore the environment. ~
To restore the data, select mode 3 in the boot mode selection.
 Boot modes:
   0: fresh boot - standard mode as a live system
   1: fresh boot - less memory, faster boot (/usr is non-writable, can't pkg_add)
   2: fresh boot - works using only RAM (about 1GB or more of RAM required)
   3: boot with retrieving saved files from storage device
      or enter passphrase for an encrypted volume
   4: boot with retrieving saved files from floppy disk
   5: interactive shell for debugging
 ->3
 scanning partitions: sd0a sd0d sd0i cd0a
 Device(s) found:
   loadable from: sd0d
 Which is FuguIta's storage device? [default: sd0d] -> sd0d
 /dev/sd0d : available data;
 
 fugu-demo
 
 config name -> fugu-demo
 Copying files from flash to ram ... 
If you specify the saved data name, the saved data will be restored and the startup will be restarted. ~
Since all setting values ?k?kare restored, network settings are not asked, unlike boot mode 0 explained
at the beginning.

After logging in, you can also save more data. The procedure is the same as described in [[Save settings and files>#usbfadm_sync]], but  Since files are already saved on LiveUSB, only changed files and directories are targeted. ~
And since the save device name and save name have already been set, it is OK to execute the sync command immediately.

When shutting down, data is not saved automatically by default, so you need to manually execute the usbfadm command each time.
If you want to automate this, please set [[Save data automatically when exiting>fge3:autosave]].

*** Try starting the X Window System. [#vebc1691]
OpenBSD ships with a graphics environment called the X Window System, and FuguIta can also use this X Window System.
>''[Memo]''~
''⇒''The X Window System may be abbreviated as ''X'' or ''X11''. The X Window System is abbreviated as X hereafter.

To use X, select X Window System as the login method as described in [[Login method selection>fge1:loginmethod]] in the preparation section.
 Do you login with Console or X Window System?
 [default: Console] -> x

When X starts up, the following login screen will be displayed, so enter your user name and password.
#ref(河豚板ガイド/xenodm-login.png,null,50%)
If the login is successful, the following screen will appear.
#ref(河豚板ガイド/startx.png)
The white window on the upper left of the screen is called a "terminal emulator", and it is a program for working with a character terminal, such as a session with a shell on X. ~
A clock is displayed in the upper right corner. ~
The one on the bottom left is called "xconsole" and is a program that displays system log information. Immediately after launching, this program is iconized. ~
Something like the table on the bottom right is called "virtual desktop", and it allows you to switch between multiple desktop screens. With the standard settings, you can switch between 3 columns
x 3 rows = 9 desktop screens.

The menu appears when you press the left mouse button on the wallpaper part (called "root window" in
X). From this menu you can select X apps to run. Those not on the menu can also be executed by inputting commands from the terminal emulator.

The following screen is an example of actually running the application.
#ref(河豚板ガイド/various-xclt.png,wrap)
In the root window, another menu is displayed by pressing the middle or right mouse button.
>''[Memo]''~
''⇒''X operation is designed assuming operation with a 3-button mouse. For mice without a
middle button, press both left and right buttons at the same time, or press the wheel.

To exit X, select "Exit" from the left mouse button menu, and then select "Exit" to the window that asks if you really want to exit.
#ref(河豚板ガイド/quit-verify-win.png,wrap)

>''[Memo]''~
''⇒''OpenBSD has several types of software (desktop environment) for using X Window, and you can also add software for Japanese display and input. This will be explained in [[Introducing a Japanese desktop environment>fge3:dtjsetup]] in the advanced version.

* Learning how to use Unix and OpenBSD [#naba8bbc]
#aname(useunix)
** Check how to use Unix-like OS [#h19a6ead]
As explained at the beginning of this guide, FuguIta is based on OpenBSD, a kind of Unix-like OS.

Unix was developed in 1969, about half a century ago, and has since been implemented in various computer implementations. Today, Unix-based operating systems are used in a variety of environments, from supercomputers to smartphones, home appliances, and even small embedded devices.

Unix-based operating systems are very different from operating systems such as Microsoft Windows, and some people may have no idea how to use them at first.

Fundamentals of Unix-like OS are not made for consumer users. OpenBSD is no exception, and almost no friendly user interface is provided in the initial state assuming users without prior knowledge. In other words, it doesn't mean ``I figured out how to use it by playing around with it''.

What approach should be taken to understand and utilize such a Unix-like OS?

***Book preparation [#u17669c8]
Prepare a book that explains the basics of Unix-like operating systems.

There are various implementations of Unix-based OS, but they include [[Unix philosophy>https://ja.wikipedia.org/wiki/UNIX%E5%93%B2%E5%AD%A6]]. There is a common concept called Understanding this concept and being able to put it into practice is the key to mastering a Unix-based OS.

The content of the book should not be limited to specific implementations, but should comprehensively and systematically explain everything from the basic concept to the entry point of application.

It's hard to find a book that says "Read this one and you'll be fine", but here are some that have a good reputation:
-はじめてUNIXで仕事をする人が読む本 / 木本彦 他 著 / KADOKAWA アスキーメディアワークス
-新 The Unix Super Text [上]  / 山口和紀・古瀬一隆 著 / 技術評論社

Reading the following as supplementary readings may help you understand better:
-Unixという考え方-その設計思想と哲学 / Mike Gancarz著 芳尾桂訳 / オーム社
-Linuxを「読む」 / こじまみつひろ著 / 毎日コミュニケーションズ

#aname(man)
*** Use the online manual [#k6e2dbd8]
After all, moving your hands by yourself is the basis for effective skill acquisition.

At that time, don't try blindly, but use the online manual (man command) built into the system. The online manual does not have the weak point that the description is based on a different implementation.
>''[Memo]''~
''⇒''Unix online manuals are divided into several chapters. ~
Items with the same name may appear in multiple chapters.~
For example, "sleep" is found in both chapter 1 (general commands) and chapter 3 (library), and is described as sleep(1) and sleep(3) respectively. So if you want to know the command line of the sleep command,
 $ man 1 sleep
If you are programming in C and want to know how to use the sleep function,
 $ man 3 sleep
displays the description of the sleep function in Chapter 3.~
~
Therefore, the notation such as "ls (1)" will appear after this, but this is "execute "man 1 ls" and refer to the "ls" section in chapter 1 of the online manual Please.
>''[Memo]''~
''⇒''Online manuals are sometimes called manual pages. They have the same meaning.

Apart from online manuals, many Unix commands have the ability to display their own instructions:
 $ man
 usage: man [-acfhklw] [-C file] [-I os=name] [-K encoding] [-M path] [-m path]
            [-O option=value] [-S subsection] [-s section] [-T output] [-W level]
            [section] name ...
 $ cp -?
 cp: unknown option -- ?
 usage: cp [-fip] [-R [-H | -L | -P]] source target
        cp [-fip] [-R [-H | -L | -P]] source ... directory
The above example displays help messages for the man and cp commands. ~
Since command help messages are so brief, they are often used as reminders to remind you of forgotten command line options.

*** Utilizing the net as "reference information" [#vbed8ecc]
Using the Internet, you can easily obtain information related to Unix-based OS.

But it also has its weaknesses, as explained in the previous section. In particular, it is necessary to judge by yourself whether the search results in the search engine apply to the actual machine in front of you. The results of the search site should be used as "reference information".

In addition, many Unix-like OSes now have "official sites" by the development community. The information on the official website can be used as primary information. 

***Summary [#x9df3154]
Applying the above to the topic "File Attributes", for example, would look something like this:
-Grab the basics with books ~
→ Find out what the file owner/group/permissions are and what commands are used to operate them.
-Actual operation while checking online manual etc. ~
→ Actually execute chown, chgrp, chmod commands and check the result. Use the man command to find out what command line options are available.
- Get related and reference information on the internet~
→Check out things to watch out for, things that are easy to get stuck in, various applied methods, etc. ~
→ Check related information on the official website ... Is there any change in specifications or information on security holes?

FuguIta is also suitable for learning Unix OS as mentioned above. In other words, by taking advantage of the feature of the live system, which does not require installation work, we provide an environment in which users can easily try various things, and an environment in which they can easily start over if they make a mistake.

#aname(useopenbsd)
** Find out how to use OpenBSD [#hd212d2a]
In the previous section [[Find out how to use Unix>#useunix]], I explained hints for those who have little experience using Unix-based OSs to learn how to use them. I will explain the information sources when using them and the points to use them.

***introduction [#f51dcbf5]
After logging in as root, you will receive an email from Theo de Raadt, the OpenBSD project leader. [#ia43b3e0]

 # mail
 Mail version 8.1.2 01/15/2001.  Type ? for help.
 "/var/mail/root": 1 message 1 new
 >N  1 deraadt@do-not-re  Sun Oct 18 07:58   86/4565  Welcome to OpenBSD 5.8!
 & more 1
 Message 1:
 From deraadt@do-not-reply.openbsd.org Sun Oct 18 07:58:58 MST 2015
 Date: Oct 18 07:58:58 MST 2015
 From: deraadt@do-not-reply.openbsd.org (Theo de Raadt)
 To: root
 Subject: Welcome to OpenBSD 5.8!
 
 This message attempts to describe the most basic initial questions that a
 system administrator of an OpenBSD box might have.  You are urged to save
 this message for later reference.
 ....continued....

This email addresses some of the first questions an OpenBSD installer might have. By following the information source written in the mail body, you can get various know-how on using OpenBSD.
There is some overlap with the content of this email below, but I will touch on various sources of information on the system.

*** documents in the system [#rd484046]
As mentioned in [[How to use Unix>#useunix]], online manuals are the most basic source of information for Unix-like operating systems, and OpenBSD is no exception. ~
It is also emphasized in the mail addressed to root immediately after installation as follows
 Again, PLEASE READ THE MANUAL PAGES.  Our developers have spent countless
 hours improving them so that they are clear and precise.

The man page also has some entries specifically for introductory
purposes.
:[[help>man:help.1]]|This entry is for Unix beginners. This entry will also appear if you run the ``help'' command on the command line.
:[[man>man:man.1]]|Description of the man command. OpenBSD reimplements the manual page system with a program called mandoc, but the man command is used in much the same way as other Unix-like operating systems.
:[[afterboot>man:afterboot.8]]|Explains items that should be checked immediately after installation. It is more detailed and comprehensive than [[Introduction>fge2:pagetop]] in this document, so I recommend reading it.
:intro|The manual page is divided into chapters by category, and describes each chapter. for example,
 man 1 intro
means that the description of the general command category is
 man 5 intro
displays a general description of the file format category.

On OpenBSD, the man page chapters are
organized like this;
|1|General Commands|
|2|System calls and error numbers|
|3|Libraries|
|4|Device Drivers|
|5|File Formats|
|6|Games|
|7|Others|
|8|System maintenance commands|
|9|Kernel|
The content of each section of the manual continues to follow the current system and is constantly being updated and refined. ~
Also, in other Unix-based OS, chapter 4 (device driver) and other chapters provide almost no information on some implementations, but OpenBSD has such information, such as Wi-Fi Sufficient information can be obtained even if setting information that depends on the hardware to be used is required, such as the setting of .
>''[Memo]''~
''⇒''The online manual built into OpenBSD can be read with the man command, but it can also be read by accessing man.openbsd.org with a web browser. ~
In the FuguIta guide, you can refer to the online manual on the web for the part linked like [[ls(1)>man:ls.1]] in the command explanation.
#ref(河豚板ガイド/emacsinfo.png,around,right)
For commands originating from the GNU project and applications that run on Emacs, Info format documentation may be provided. ~
To view the Info document, run the [[info>man:info.1]] command.
>''[Memo]''~
''⇒''If you have additionally installed an Emacs editor, Info documents can be accessed from the Emacs editor with ''<Meta>-x info<Enter>'' or ''<Escape> x info<Enter>''. You can browse it by typing.
#clear

There are application-specific documentation besides man pages and
Info.
They are mainly located under the following directories:
-/usr/share/doc
-/usr/X11R6/share/doc
-/usr/local/share/doc
-/usr/local/share/gtk-doc

*** File on system [#a20dea4c]
All configuration files for servers and application software are gathered under /etc. ~
///Software added by the package management tool ports/packages is installed under /usr/local, but configuration files are placed under /etc. The same is true for X-related configuration files.

System operation logs are located under /var/log. Only cron creates a log file called /var/cron/log.
Kernel messages displayed at boot time, as described in [[Boot Settings>fge1:bootsetup]], are logged
in a file called /var/run/dmesg.boot. By viewing the contents of this file after system startup is complete, you can investigate how the system started.

*** Information on the Internet [#h9ec9da1]
:http://www.openbsd.org/|Official site run by the project. [[Detailed guide to OpenBSD in general>http://www.openbsd.org/faq/index.html]] and [[System updates>http://www.openbsd.org/errata72.html]] , is the starting point for OpenBSD-related information on the web.
:http://undeadly.org/|``OpenBSD Journal'' OpenBSD related news site. Every time OpenBSD's seasonal topic is taken up, you can also know the state of the front line of OpenBSD development. Previously, [[Introductory article on Fuguita>http://undeadly.org/cgi?action=article&sid=20131210093950]] was also posted.  There is a
:mailing list|[[officially managed mailing list>http://www.openbsd.org/mail.html]]. There is also an
archive site for these, and you can view them on the web without subscribing to the mailing list.

*** Books [#y291b608]
As far as the author knows, no Japanese books written for OpenBSD users have been published as of
2023. ~
Some books for BSD Unix,
-BSD HACKS ~
100 Techniques & Tools Used by Professionals / Written by Dru Lavigne, Supervised by Yasunari Momoi, Translated by Hideyuki Hayashi / O'Reilly Japan

Some books, such as, partially mention OpenBSD.

For English books, please refer to [[description on official site>http://www.openbsd.org/books.html]]. ~
It seems that some books for OpenBSD have been published, such as '''''Absolute OpenBSD, 2nd Edition''''' and '''''The book of PF, 3rd Edition'''''.

#navi(FuguItaGuide)


Front page   New Page list Search Recent changes   Help   RSS of recent changes