[LINUX] What to do when is not in the sudoers file.This incident will be reported.

--Environment - CentOS Linux release 7.8.2003 (Core)

Event: I was told something when I created a user and sudo

Even if I entered the password I set, it didn't work ...

$ sudo chmod 700 ~/.ssh/id_rsa

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 ponsuke:
ponsuke is not in the sudoers file.  This incident will be reported.

Because the user is not in a group that can sudo

In the / etc / sudoers file, groups that can use the sudo command are prepared in advance. For Debian, the sudo group. Wheel group for CentOS. How to add a sudo user --Introduction to Linux --Webkaru

I wasn't in the wheel group


$ cat /etc/group | grep wheel
wheel:x:10:centos

Action: Add user to wheel group

  1. Switch to a user who can run sudo
  2. Add a user to the wheel group with ʻusermod`
  3. Switch users and sudo again
#Add user to wheel group
$ sudo usermod -aG wheel ponsuke

#added
$ cat /etc/group | grep wheel
wheel:x:10:centos,ponsuke

#Switch users
$ sudo su - ponsuke
Last login: Mon May  4 02:57:57 UTC 2020 on pts/0

#Sudo again
$ sudo chmod 700 ~/.ssh/id_rsa
[sudo] password for ponsuke:

#did it!
$ ls -la ~/.ssh/ | grep id_rsa
-rwx------. 1 centos     centos     1675 May  4 02:38 id_rsa

Recommended Posts

What to do when is not in the sudoers file.This incident will be reported.
What to do when the value type is ambiguous in Python?
What to do when the result downloaded via scrapy is in English
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
What to do when the graph does not appear in jupyter (ipython) notebook
What to do when Japanese is not displayed on matplotlib
What to do when only the window is displayed and nothing is displayed in pygame Note
What to do if the progress bar is not displayed in tqdm of python
What to do if the image is not displayed using matplotlib etc. in the Docker container
What to do when a Missing artifact occurs in a jar that is not defined in pom.xml
What to do when the jupyterlab extension settings are not reflected
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
What to do when a warning message is displayed in pip list
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
[Python] What to do when PEP8 is violated in the process of importing from the directory added to sys.path
What to do in my case when pyenv install is not possible after upgrading to macOS Big Sur
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
What is Jenkins? ] Installation-how to use-automatic test / automatic deployment will be explained in the world's easiest way
Example of what to do when the sample script does not work (OpenCV-Python)
What to do when "TypeError: must be string, not int…" appears when using strptime
[Ubuntu 18.04 LTS] What to do when the screen resolution cannot be selected [NVIDIA]
What to do when "TypeError: data type not understood" appears in python's numpy.zeros
What to do if abort is displayed when inputting camera video in OpenCV
[EC2] What to do when selenium is stuck and processing does not proceed
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
Do not pass self to ProcessPoolExecutor in the class
What to do if pyenv is not enabled (zsh)
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if Python IntelliSense is not displayed in VS Code on Windows
What to do when Python starts up in Anaconda does not come out unexpectedly
What to do when "Type Error: must be _socket.socket, not socket" appears on GAE
What to do if Python does not switch from the System version in pyenv
What to do if the package dependency cannot be repaired
What to do when PyCharm font is strange or garbled
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
What to do when "Invalid HTTP_HOST header" appears in Django
What to do when there is no response due to Proxy setting in Python web scraping
What to do if ʻObject arrays cannot be loaded when allow_pickle = False` occurs in numpy.load ()
[Beginner] What to do when "[Errno 2] File b'test.csv' does not exist: b'test.csv" is displayed when reading pandas csv
[AWS] What to do when the ping command causes a "timeout"
What to do when Ubuntu crashes
[For IT beginners] What to do when the rev command cannot be used with Git Bash
[virtualbox] What to do when [Could not retrieve mirrorlist] appears when yum update is performed on CentOS7
How to give and what the constraints option in scipy.optimize.minimize is
What to do when a video cannot be read by cv2.VideoCapture
[VSCode] unable to import'google.cloud' What to do when pylint (import-error) does not recognize the Python import statement
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
What to do if the inode is exhausted on EC2 Linux
What to do when a part of the background image becomes transparent when the transparent image is combined with Pillow
[Golang] "package exec is not in GOROOT" when executing the test
What to do if you can't use the trash in Lubuntu 18.04.
What to do when you get "I can't see the site !!!!"
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
Animate what happens in frequency space when the Nyquist frequency is exceeded
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do if the user name is changed and the pyenv library path does not pass
What to do if you get the message "" ~ .pkg "is corrupted and cannot be opened" when installing wxPython on Mac OS X
A story about what to do when a bad interpreter: Not such file or directory appears in Anaconda3 and how to investigate the cause.
[Mac OS] What to do when Python is not installed as a framework. Is displayed when import matplotlib is performed.
What to do when "Something is already running at port 8000" is displayed when the develop command of Gatsby is executed.