LoginSignup
0
0

More than 1 year has passed since last update.

パスワード無しでLinuxユーザー作成&ユーザー切り替えして詰んだ話

Last updated at Posted at 2022-07-21

概要

①ユーザA作成
②su コマンドでユーザ切り替え
③元のユーザーに切り替えたりsudoコマンド等を使おうとする → パスワード求められるので無理
④③をできるようにユーザAを設定するにはルートユーザーになる必要がある → wheelグループでもないし、パスワードないので詰み
⑤shutdownしてec2-userで鍵で認証して入り直してパスワード設定して対処

詳細に入ろうと思ったのですが言いたいことは概要で終わってしましました。どんなエラーが発生したか書きますね

挑戦と失敗

ユーザAからパスワードを設定しようとする

[user-a@ip-10-0-1-98 dir-b]$ passw d user-a
passwd: Only root can specify a user name.

ec2ユーザに戻ろうとする( sudoつかう

[user-a@ip-10-0-1-98 dir-b]$ sudo su- - ec2-user

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for user-a: 
#パスワード設定してないから無理。仮に設定してもwheelグループ入ってないから無理

別のユーザに切り替えようとする( sudo使わない

[user-a@ip-10-0-1-98 dir-b]$ su - user-b
Password: 
※user-bのパスワードなくて詰み。user-bのパスワード使えば切り替えはできる
0
0
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
0
0