linux添加新用户使用 useradd -----create a new user or update default new user information

删除用户使用userdel  -----delete a user account and related files

useadd options:

-c, --comment COMMENT set the GECOS field for the new user account

-d, --home-dir HOME_DIR home directory for the new user account 

-p, --password PASSWORD use encrypted password for the new user
account

 -g, --gid GROUP               force use GROUP for the new user account
-s, --shell SHELL the login shell for the new user account
-u, --uid UID force use the UID for the new user account
 

常用的 :  -d 设置新用户的home

-p 设置新用户密码

-g 设置group

-s 设置login 的shell 类型

-u 设置UID

-c 新用户描述信息

1. useradd rhel -d /home/rhel -p zxcv5678

添加新用户 rhel  默认home /home/rhel

发现使用该用户登录不上,使用passwd 修改密码,报错

Authentication token manipulation error

google之后发现,可以使用 root权限 passwd -d rhel 清空用户密码

之后su rhel 重新设置

2.使用-g 指定的gid 应该大于500

可以从/etc/group 看到对应的的gid

删除用户:

Usage: userdel [options] LOGIN

Options:
-f, --force force removal of files, even if not owned by user

-r, --remove remove home directory and mail spool

-f 强制删除

-r删除home和mail

userdel -r rhel

linux (RHEL) 添加和删除用户的更多相关文章

  1. linux mysql添加、删除用户、用户权限及mysql最大字段数量

    1.  登录: mysql -u username -p 显示全部的数据库: show databases; 使用某一个数据库: use databasename; 显示一个数据库的全部表: show ...

  2. 在Linux中新增与删除用户可以使用命令:Useradd

    在Linux中新增与删除用户可以使用命令:Useradd 我们先使用man命令理解一下Useradd的用法 新增与删除用户操作需要先获取高级用户权限 输入命令:sudo -i 确定后输入高级用户密码 ...

  3. Ansible 从MySQL数据库添加或删除用户

    mysql_user - 从MySQL数据库添加或删除用户. 概要 要求(在执行模块的主机上) 选项 例子 笔记 状态 支持 概要 从MySQL数据库添加或删除用户. 要求(在执行模块的主机上) My ...

  4. Linux命令之useradd和userdel(添加、删除用户)

    一.[useradd]:添加用户命令 1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起始目录,使用权限是超级用户. 2.格式 useradd [-d home] [-s sh ...

  5. linux下添加,删除,修改,查看用户和用户组

    标签:gpasswd, groupadd, groupdel, groupmod, linux, useradd, userdel, usermod, who 一,组操作 1,创建组 groupadd ...

  6. linux下创建与删除用户详细步骤 ***

    linux下用户的操作还是相对容易理解的,基本操作如下: 1.新增用户 只有root用户能创建新用户 #useradd user1 新建后将会在/home目录下生成一个与用户名相同的用户主目录.同时会 ...

  7. centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法

    修改主机名:vim /etc/sysconfig/network 1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 # ...

  8. mysql、添加和删除用户、添加权限

    创建用户      mysql>insert into mysql.user(Host,User,Password) values("localhost","tes ...

  9. linux批量添加10个用户并将其随机密码和用户名写入文件

    需求: 批量新建10个测试用户,并且让其密码随机,把用户名和密码写入一个文件,并有创建时间和创建者 #!/usr/bin/python # -*- coding: utf-8 -*- import o ...

随机推荐

  1. 到底instanceof是啥?

    对Js有一定了解的盆友肯定都知道instanceof 并且还很常用,比如说用[1, 2, 3] instanceof Array 来判断是否是数组.所以我们可能会简单的以为他就是一个用来判断typeo ...

  2. INSTALL_FAILED_INSUFFICIENT_STORAGE(转发)

    [2012-06-19 14:06:47 - Icontacts] Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE[2012-06-19 ...

  3. import()函数

  4. 微信电脑版真的要来了 微信Windows版客户端1.0 Alpha推出

    微信电脑版的搜索量一直很大,但只有网页版,之前也写了微信网页版APP - 网页微信客户端电脑版体验,在键盘上打字的感觉就是快.现在微信Windows版客户端1.0 Alpha推出了,来一睹芳容吧(20 ...

  5. cf558c(bfs)

    C. Amr and Chemistry time limit per test 1 second memory limit per test 256 megabytes input standard ...

  6. java 1.7

    http://superuser.com/questions/740064/how-to-install-java-1-7-runtime-on-macos-10-9-mavericks sudo r ...

  7. 用CSS画个三角形

    <!DOCTYPE html> <html> <head> <style type="text/css"> #trangle { d ...

  8. Button圆角处理

    <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="ht ...

  9. C#构造方法重载

    1.什么是构造方法? 首先,它是一个方法,它是类中 众多方法中的一个.其次,它具有类中其他方法所不具备的一些特性. 在类执行开始的时候,执行这个方法. 2.构造方法相对其他方法有哪些不同? 方法名:类 ...

  10. php之CI框架多语言的用法

    public function index() { // 加载语言包,可以加载多个 $this->lang->load('email'); echo $this->lang-> ...