LoginSignup
1
1

More than 1 year has passed since last update.

ディストリビューションのユーザーを変更する

Posted at

wslでUbuntuを作成しターミナルを開くをrootユーザーになっていた。
image.png
ユーザーを切り替えたい!

コマンドで一時的に変更

terminal
su  <username>

image.png
しかし、ターミナルを新しく作成するごとに毎回コマンドを打つもの面倒

デフォルトのユーザー設定

ubuntuでwsl.confを作成する。

terminal
cat << EOF > /etc/wsl.conf
[user]
default=user-name
EOF

私の場合は
default=moonlinux

ディストリビューションを再起動する
image.png
その後、Windowsターミナルで[v]を押して指定のディストリビューションを起動
Ex.
image.png
すると、ユーザーが切り替わっている
image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1