已复制到剪贴板

usermod

`usermod` 命令行工具可用于修改现有用户的属性、权限和组成员资格。

例子

  • 将用户 jdoe 添加到组 salessudo usermod -a -G sales jdoe
  • 将用户 jdoe 的主目录更改为 /home/jdoe-newsudo usermod -d /home/jdoe-new jdoe
  • 更改用户 jdoe 的注释信息为 "John Doe, Engineering"sudo usermod -c "John Doe, Engineering" jdoe
  • 更改用户 jdoe 的默认 shell 为 zshsudo usermod -s /bin/zsh jdoe
  • 更改用户 jdoe 的 UID 为 1001sudo usermod -u 1001 jdoe