linux (RHEL) 添加和删除用户
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) 添加和删除用户的更多相关文章
- linux mysql添加、删除用户、用户权限及mysql最大字段数量
1. 登录: mysql -u username -p 显示全部的数据库: show databases; 使用某一个数据库: use databasename; 显示一个数据库的全部表: show ...
- 在Linux中新增与删除用户可以使用命令:Useradd
在Linux中新增与删除用户可以使用命令:Useradd 我们先使用man命令理解一下Useradd的用法 新增与删除用户操作需要先获取高级用户权限 输入命令:sudo -i 确定后输入高级用户密码 ...
- Ansible 从MySQL数据库添加或删除用户
mysql_user - 从MySQL数据库添加或删除用户. 概要 要求(在执行模块的主机上) 选项 例子 笔记 状态 支持 概要 从MySQL数据库添加或删除用户. 要求(在执行模块的主机上) My ...
- Linux命令之useradd和userdel(添加、删除用户)
一.[useradd]:添加用户命令 1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起始目录,使用权限是超级用户. 2.格式 useradd [-d home] [-s sh ...
- linux下添加,删除,修改,查看用户和用户组
标签:gpasswd, groupadd, groupdel, groupmod, linux, useradd, userdel, usermod, who 一,组操作 1,创建组 groupadd ...
- linux下创建与删除用户详细步骤 ***
linux下用户的操作还是相对容易理解的,基本操作如下: 1.新增用户 只有root用户能创建新用户 #useradd user1 新建后将会在/home目录下生成一个与用户名相同的用户主目录.同时会 ...
- centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法
修改主机名:vim /etc/sysconfig/network 1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 # ...
- mysql、添加和删除用户、添加权限
创建用户 mysql>insert into mysql.user(Host,User,Password) values("localhost","tes ...
- linux批量添加10个用户并将其随机密码和用户名写入文件
需求: 批量新建10个测试用户,并且让其密码随机,把用户名和密码写入一个文件,并有创建时间和创建者 #!/usr/bin/python # -*- coding: utf-8 -*- import o ...
随机推荐
- SQL having 子句
1.为什么存在? 在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用. 2.举例子: SELECT Customer,SUM(OrderPrice) FROM Or ...
- apt-get 与 yum的区别 (转)
一般来说著名的linux系统基本上分两大类:1.RedHat系列:Redhat.Centos.Fedora等2.Debian系列:Debian.Ubuntu等 RedHat 系列 1 常见的安装包格式 ...
- mysql中DATETIME,DATE和TIMESTAMP的区别整理
简而言之.看格式,DATE 是 年月日YYYY-MM-DD,DATETIME 是 年月日时分秒YYYY-MM-DD HH:MM:SS,TIMESTAMP是 年月日时分秒YYYY-MM-DD HH:MM ...
- C#集合u
List<T> 列表(动态数组),相当于C++的 vector Queue<T> 队列,先进先出 Stack<T> 栈,先进后出 LinkedList<T&g ...
- ExtJS + fileuploadfield上传文件代码
后台服务端接收文件的代码: /** * 后台上传文件处理Action */ @RequestMapping(value = "/uploadFile", method=Reques ...
- VTK初学一,Pro文件的配置
1. pro文件的配置 TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG += qt QT += core gui greate ...
- springMVC 缓存(入门 spring+mybaties+redis一)
使用redis之前需要咋电脑上安装redis: 使用spring+mybaties+redis的本质是扩展类 org.apache.ibatis.cache.Cache:在我们自己扩展的Cache ...
- HDOJ 1576 A/B
数论水题... A/B Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- centos systemctl指令
# systemctl #输出已激活单元 # systemctl list-units #输出已激活单元 # systemctl --failed #输出运行失败的单元 # systemctl lis ...
- MySQL编译安装
1.准备工作 其官方站点为http://www.mysql.com/ 为了避免发生端口冲突.程序冲突现象.建议先查询MySQL软件的安装情况,确认没有使用以RPM方式安装的mysql-server.m ...