2016年12月8日木曜日

FreeBSD 11のインストール(zfs root/mirrorの場合) - 2

FreeBSD 11でミラー構成のZFSから起動する設定でのインストール方法の続きです。
  1. コンソールからrootでログインし、sudoをインストール
    # pkg install sudo
    The packet management tool is no yes intalled on your system.

    Proceed with this action? [y/N]: y
    Fetching sudo-1.8.18p1.txz: …

  2. /usr/local/etc/sudoersに以下を追加
    Defaults        timestamp_timeout = 0
    Defaults        !set_logname

    User_Alias      ADMIN = admin, user1, user2
    ADMIN           ALL = (ALL) ALL
  3. /etc/ssh/sshd_configに以下を追加
    PermitRootLogin         yes
    PasswordAuthentication  yes
    PermitEmptyPasswords    no
  4. sshdを再起動
    # /etc/rc.d/sshd restart
    #
  5. 作業用ユーザーでログインしてログイン後のメッセージを抑止
    %touch .hushlogin
    %
  6. 必要に応じて作業用ユーザーのシェルを変更
    % sudo -s
    Password:
    # pkg install bash

    New packages to be INSTALLED:
        bash: 4.4

    Proceed with this action? [y/N]: y

    # chsh user1

    #
これで、一般ユーザーで sshを使ってログインし、sudoでルート権限を得て作業できるようになります。