--Environment - CentOS Linux release 7.8.2003 (Core)
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.
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
wheel
groupsudo
wheel
group with ʻusermod`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