そういうのがいいブログ

SIerで働く30代サラリーマンSEがインフラエンジニアに憧れてLinux・クラウド・AWSの勉強をするブログ

Proxmox7.4のインストール後に行う初期設定(2)管理者ユーザー追加

※[PR]当ブログの記事の中にはプロモーションが含まれています。

・Proxmox7.4のインストール後に行う初期設定について知りたい。
・具体的な手順を分かりやすく教えてほしい。

こういった疑問に答えます。

本記事の内容

  1. Proxmox7.4のインストール後に行う初期設定(管理者ユーザー追加)

サトナカ (@souiunogaii)

この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。

こういった私が、解説していきます。

私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。

Proxmox7.4のインストール後に行う初期設定(理者ユーザー追加)

データセンターの管理者追加

グループの作成

データセンター > アクセス権限 > グループ で「追加」ボタン

グループにアクセス権限を付与

データセンター > アクセス権限

「追加」ボタンで「グループのアクセス権限」を選択

  • パス: /
  • ロール: PVEAdmin, Administrator

ホストの再起動、シャットダウンを行うためには、「Administrator」も必要になります。
それ以外の機能は、「PVEAdmin」で十分みたいです。

ユーザの作成

データセンター > アクセス権限 > ユーザ で「追加」ボタン

レルム:「PAM」を選んだ場合

レルム「PAM」の方は、ホストOS自体にも同じ名前のユーザー追加が必要になります。

レルム:「Proxmox VE authentication」を選んだ場合

最後にログインできるか確認

ホストOSにユーザー追加

mkdir /home/ユーザー名
useradd ユーザー名 -d /home/ユーザー名
passwd ユーザー名
root@sv-sirius:~# cd /home
root@sv-sirius:/home# mkdir /home/satonaka
root@sv-sirius:/home# useradd satonaka -d /home/satonaka
root@sv-sirius:/home# passwd satonaka
新しい パスワード:
新しい パスワードを再入力してください:
passwd: パスワードは正しく更新されました

sudoインストール

apt-get install sudo
root@sv-sirius:/home# apt-get install sudo
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
以下のパッケージが新たにインストールされます:
  sudo
アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
1,061 kB のアーカイブを取得する必要があります。
この操作後に追加で 4,699 kB のディスク容量が消費されます。
取得:1 http://ftp.jp.debian.org/debian bullseye/main amd64 sudo amd64 1.9.5p2-3+deb11u1 [1,061 kB]
1,061 kB を 1秒 で取得しました (1,294 kB/s)
以前に未選択のパッケージ sudo を選択しています。
(データベースを読み込んでいます ... 現在 51143 個のファイルとディレクトリがインストールされています 。)
.../sudo_1.9.5p2-3+deb11u1_amd64.deb を展開する準備をしています ...
sudo (1.9.5p2-3+deb11u1) を展開しています...
sudo (1.9.5p2-3+deb11u1) を設定しています ...
man-db (2.9.4-2) のトリガを処理しています ...

sudoersに追加

/etc/sudoers

ユーザー名  ALL=(ALL:ALL) ALL
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "@include" directives:

@includedir /etc/sudoers.d

satonaka  ALL=(ALL:ALL) ALL

wheelグループへのユーザー追加

groupadd wheel
usermod -g wheel ユーザー名
root@sv-sirius:~# groupadd wheel
root@sv-sirius:~# usermod -g wheel satonaka
root@sv-sirius:~# id satonaka
uid=1000(satonaka) gid=1001(wheel) groups=1001(wheel),27(sudo)

suコマンドの設定ファイルを変更

/etc/pam.d/su
# This allows root to su without passwords (normal operation)
auth       sufficient pam_rootok.so

# Uncomment this to force users to be a member of group wheel
# before they can use `su'. You can also add "group=foo"
# to the end of this line if you want to use a group other
# than the default "wheel" (but this may have side effect of
# denying "root" user, unless she's a member of "foo" or explicitly
# permitted earlier by e.g. "sufficient pam_rootok.so").
# (Replaces the `SU_WHEEL_ONLY' option from login.defs)
auth       required   pam_wheel.so ★コメントを解除して有効化