5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【エラー解決方法】...is not in the sudoers file. This incident will be reported.

Last updated at Posted at 2022-11-06

概要

環境構築中のサーバー(Ubuntu)で新しく作ったユーザーでsudoコマンドを使用したら怒られました、、。

エラー内容

daichi@160-251-98-255:/$ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_`date +%Y%m%d-%H%M%S`
daichi is not in the sudoers file.  This incident will be reported.

解決方法

解決手順

1.ログアウト

daichi@160-251-xx-xxx::/$ logout

2.ルートユーザーでログインし直す

160-251-xx-xxx login: root
Password:

3./etc/sudoers ファイルにユーザーdaichiを追加

root@160-251-xx-xxx:~# usermod -G sudo daichi

4.確認

root@160-251-xx-xxx:~# cat /etc/group | grep daichi
sudo:x:27:daichi
daichi:x:1000:

5.再度ユーザーdaichiでログインし直し、sudoコマンド実行

daichi@160-251-xx-xxx:~$ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_`date +%Y%m%d-%H%M%S`

完了

参考記事

5
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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?