$ ls ~yifei/notes/

Linux 命令行账户管理

Posted on:

Last modified:

添加一个用户的完整流程, 以 ubuntu 为例

useradd -m ubuntu  # add a user
echo 'ubuntu ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
usermod -G sudo ubuntu

mkdir -p /home/ubuntu/
cp -r .ssh /home/ubuntu/
chown -R ubuntu /home/ubuntu
chmod 600 /home/ubuntu/.ssh/*

chsh -s /bin/bash ubuntu

users

userdel USERNAME  # delete a user
passwd -e  # password expire next time user login

groups username  # view username groups
usermod -G groupname username  # add user to a group
usermod -g groupname username # set user to a group

newgrp
make newly added group work immediately without login/out

chsh 提示输入密码的问题

Changing /etc/pam.d/chsh: from:

auth       required   pam_shells.so

to

auth       sufficient   pam_shells.so
WeChat Qr Code

© 2016-2022 Yifei Kong. Powered by ynotes

All contents are under the CC-BY-NC-SA license, if not otherwise specified.

Opinions expressed here are solely my own and do not express the views or opinions of my employer.

友情链接: MySQL 教程站