Due to business needs, it is necessary to create multiple users on the server to facilitate multi-person maintenance, then you can use certificate login to create multiple user logins, and then users can manually switch if they need root privileges. The following briefly introduces how to perform multi-user on Linux Create and log in with a certificate.
Add user
adduser 用户名
set user password
passwd 用户名
Add user to docker user group
Use the user to operate the docker command line
gpasswd -a 用户名 docker
Add user wheel
to usergroup
For systems based on RedHat distributions, such as CentOS and Fedora, the user group wheel has been granted sudo privileges; therefore, we can obtain sudo privileges by adding new users to the wheel user group:
usermod -aG wheel 用户名
# 查看用户所属组
groups 用户名
Enable SSH key login for new users
switch to user
su 用户名
create key
ssh-keygen -t rsa
Rename the public key to authorized_keys
mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
Download private key certificate login
Use tools to download the private key id_rsa or directly use cat
the command to copy the content to the file
This article was originally created by " Cheng Ge Blog " and complies with the CC 4.0 BY-SA copyright agreement. For reprinting, please attach the original source link and this statement.
Original link: Create a new user in Linux and log in remotely using a certificate