当前位置: 首页 > news >正文

ubuntu和centos创建用户的区别

  • 在CentOS下习惯使用使用useradd进行用户的创建,但是ubuntu下,如果单纯使用useradd进行用户创建,则不会自动生成该用户的home目录和邮箱之类的。

  • 在ubuntu下使用adduser进行用户创建,会进入交互模式,可同时对用户进行多种信息的录入

  • CentOS useradd创建用户
    默认创建用户家目录
    默认 shell 解释器为 bash免交互创建密码–stdin

  • Ubuntu useradd创建用户
    默认不创建用户家目录
    默认 shell 解释器为 sh免交互创建密码 chpasswd

[root@U20-ptyhon-191 ~]# adduser --htlp
Unknown option: htlp
adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID]
[--disabled-password] [--disabled-login] [--add_extra_groups]
[--encrypt-home] USER
   Add a normal user

adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password]
[--disabled-login] [--add_extra_groups] USER
   Add a system user

adduser --group [--gid ID] GROUP
addgroup [--gid ID] GROUP
   Add a user group

addgroup --system [--gid ID] GROUP
   Add a system group

adduser USER GROUP
   Add an existing user to an existing group

general options:
  --quiet | -q      don't give process information to stdout
  --force-badname   allow usernames which do not match the
                    NAME_REGEX[_SYSTEM] configuration variable
  --extrausers      uses extra users as the database
  --help | -h       usage message
  --version | -v    version number and copyright
  --conf | -c FILE  use FILE as configuration file

[root@U20-ptyhon-191 ~]# adduser python
Adding user `python' ...
Adding new group `python' (1001) ...
Adding new user `python' (1001) with group `python' ...
The home directory `/home/python' already exists.  Not copying from `/etc/skel'.
adduser: Warning: The home directory `/home/python' does not belong to the user you are currently creating.
New password: 
Retype new password: 
Sorry, passwords do not match.
passwd: Authentication token manipulation error
passwd: password unchanged
Try again? [y/N] y
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for python
Enter the new value, or press ENTER for the default
	Full Name []: python
	Room Number []: 302
	Work Phone []: 302
	Home Phone []: 302
	Other []: 
Is the information correct? [Y/n] y
[root@U20-ptyhon-191 ~]# su - python
python@U20-ptyhon-191:~$ pwd
/home/python
python@U20-ptyhon-191:~$ 

  • useradd
NAME
       useradd - create a new user or update default new user information

SYNOPSIS
       useradd [options] LOGIN

       useradd -D

       useradd -D [options]

DESCRIPTION
       useradd is a low level utility for adding users. On Debian,
       administrators should usually use adduser(8) instead.

       When invoked without the -D option, the useradd command creates a new
       user account using the values specified on the command line plus the
       default values from the system. Depending on command line options, the
       useradd command will update system files and may also create the new
       user's home directory and copy initial files.

       By default, a group will also be created for the new user (see -g, -N,
       -U, and USERGROUPS_ENAB).
  • adduser
NAME
       adduser, addgroup - add a user or group to the system
DESCRIPTION
       adduser  and  addgroup  add users and groups to the system according to
       command  line  options  and  configuration  information   in   /etc/ad‐
       duser.conf.  They are friendlier front ends to the low level tools like
       useradd, groupadd and usermod programs, by default choosing Debian pol‐
       icy  conformant  UID  and  GID  values,  creating a home directory with
       skeletal configuration, running a custom script,  and  other  features.
       adduser and addgroup can be run in one of five modes:

相关文章:

  • 常见编程语言都是什么类型的?不同类型的语言有什么区别?
  • False等价布尔值bool(value)
  • 写shell脚本的一种开头方式,给你的脚本加个保险
  • 离线安装pyenv的shell脚本
  • Python语言的特点
  • Python中标识符的命名规则
  • Python 仅有33个系统关键字
  • [TroubleShooting]CentOS8使用pyenv部署多版本python时报 python: command not found
  • Linux设置pip国内源
  • CentOS8部署多版本共存Python开发环境
  • Win10部署python多版本开发环境
  • Linux常用Shell脚本测试命令
  • Linux常用Shell函数参数
  • Linux脚本shell编程通过数组实现石头剪刀布小游戏
  • CentOS8快速安装Docker
  • JS中 map, filter, some, every, forEach, for in, for of 用法总结
  • 【技术性】Search知识
  • 【知识碎片】第三方登录弹窗效果
  • angular组件开发
  • Docker 笔记(2):Dockerfile
  • eclipse(luna)创建web工程
  • express + mock 让前后台并行开发
  • Linux下的乱码问题
  • Magento 1.x 中文订单打印乱码
  • MaxCompute访问TableStore(OTS) 数据
  • October CMS - 快速入门 9 Images And Galleries
  • Python_网络编程
  • Ruby 2.x 源代码分析:扩展 概述
  • SegmentFault 2015 Top Rank
  • SpringCloud集成分布式事务LCN (一)
  • TCP拥塞控制
  • 编写符合Python风格的对象
  • 给新手的新浪微博 SDK 集成教程【一】
  • 记一次用 NodeJs 实现模拟登录的思路
  • 坑!为什么View.startAnimation不起作用?
  • 腾讯大梁:DevOps最后一棒,有效构建海量运营的持续反馈能力
  • 携程小程序初体验
  • 一道闭包题引发的思考
  • 正则表达式-基础知识Review
  • ​io --- 处理流的核心工具​
  • (2)(2.10) LTM telemetry
  • (3)nginx 配置(nginx.conf)
  • (Matalb分类预测)GA-BP遗传算法优化BP神经网络的多维分类预测
  • (附源码)ssm基于jsp高校选课系统 毕业设计 291627
  • (附源码)ssm教材管理系统 毕业设计 011229
  • (原創) 如何解决make kernel时『clock skew detected』的warning? (OS) (Linux)
  • (原創) 系統分析和系統設計有什麼差別? (OO)
  • *上位机的定义
  • .NET Core 2.1路线图
  • .NET CORE Aws S3 使用
  • .net 前台table如何加一列下拉框_如何用Word编辑参考文献
  • .net 设置默认首页
  • .net/c# memcached 获取所有缓存键(keys)
  • .NET开源项目介绍及资源推荐:数据持久层
  • @angular/cli项目构建--Dynamic.Form