Linux添加、创建新用户
给Linux添加新用户,新建用户,新建帐号
添加用户组
sudo groupadd groupname
添加用户
sudo useradd username -m -s /bin/bash -d /home/username -g groupname
-s /sbin/nologin 设置不能登陆 -s /bin/false(老方法) 也行
-d 设置用户主目录
-g 用户组
-m 创建用户目录
useradd的具体参数为
[root@317304 ~]# useradd --help
Usage: useradd [options] LOGIN
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
更改用户登录权限
在增加了-s /sbin/nologin 参数后,那么这个帐号就不能登陆了,如果想要恢复登陆使用
sudo usermod -s /bin/bash username
禁用用户登录权限
sudo usermod -s /sbin/nologin username
设置密码
给用户设置密码,这样帐号就能使用了。
sudo passwd username
删除用户
删除用户
sudo userdel username
Linux添加、创建新用户的更多相关文章
- Linux中创建新用户并赋给指定文件权限
工作中用到了,写篇日志总结一下. 创建新的用户: 第一种方式: 创建用户: adduser name 创建密码: passwd name(回车后出现修改密码的提示) 该方式创建的用户目录默认在home ...
- 在linux中创建新用户-再次安装python
原来的阿里云python软件安装错了,用了root安装软件,搞得我后面的软件全部都要用root,软连接也搞不定,卸载也不好卸载.只能格式化,实例什么的都不用重建,系统也不用安装,直接创建用户就行了,磁 ...
- Linux下创建新用户
useradd -h查询使用方法 useradd -g sysadmin -d /home/devops -m -c "DevOps Installation User" -s / ...
- Linux Mysql创建新用户并允许远程连接
第一步 登陆mysql: mysql-u 数据库用户名 -h 数据库IP -p 根据提示 输入数据库密码 第二步: GRANT ALL PRIVILEGES ON *.* TO '自定义用户名'@'% ...
- linux useradd(adduser)命令参数及用法详解(linux创建新用户命令)
linux useradd(adduser)命令参数及用法详解(linux创建新用户命令) useradd可用来建立用户帐号.帐号建好之后,再用passwd设定帐号的密码.而可用userdel删除帐号 ...
- linux创建新用户及权限
在Linux中添加普通新用户 ,超级用户(也称为“root”)是一个具有修改系统中任何文件权力的特别账号.在日常工作中,最好不要使用超级用户账号进入系统,因为任何错误操作都可能导致巨大的损失.由于超级 ...
- Linux下如何创建新用户
Linux下如何创建新用户 Linux系统中,只有root用户有创建其他用户的权限.创建过程如下: useradd -d /home/newuser newuser(设定了该用户的主目录和用户名) ...
- [Linux学习--用户管理]centos中添加一个新用户,并授权
前言 有时候给root用户不太方便,新建一个用于并赋予权限这个做法相对好些 创建新用户 创建一个用户名为:cmj [root@localhost ~]# adduser cmj 为这个用户初始化密码, ...
- linux 6.5上创建新用户后,不能登陆?
linux 6.5上创建新用户后,不能登陆? 使用root账户登陆却可以! [root@ log]# useradd mtdk[root@ log]# echo 123abc |passwd --st ...
- linux私有ftp搭建与创建新用户
一.私有ftp搭建 以后补充 1. 搭建 2.修改配置文件 二.创建新用户 在linux搭建好私有ftp后,默认存放目录是 /var/ftp/ 我们有时候需要给外部公司之类的用,但又不想让他们直接在 ...
随机推荐
- WOJ 10 精英选拔
神仙dp,膜Claris 题意:给一个长度为$n$的数列,求出不超过k次交换后的最大连续子区间和. 发现交换后的最优答案一定是这样的(0和2的长度可以为0) 0 ...
- python中list的使用
1.list(列表)是一种有序的集合,可以随时添加.修改.删除其中的元素. 举例:listClassName = ['Jack','Tom','Mark'] 列表可以根据索引获取元素,如:listCl ...
- 36-OLED显示实验
1.OLED原理 有四种工作模式 先把片选拉低,如果是写的话,把RD拉高,在WR的上升沿写数据到数据线上,DC决定是数据还是命令.读类似了. 2.程序显示原理 3.代码 4.自己写代码 http:// ...
- [转]oracle11g 修改字符集 修改为ZHS16GBK
转至:http://www.cnblogs.com/jay-xu33/p/5210098.html sqlplus /nolog conn /as sysdba shutdown immediate; ...
- .NET 图片上传接收类
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- [转]Passing Managed Structures With Strings To Unmanaged Code Part 2
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (w ...
- IIS并发
https://www.cnblogs.com/xinaixia/p/5945678.html
- 用户、组或角色 'zgb' 在当前数据库中已存在。 (Microsoft SQL Server,错误: 15023)
在使用SQL Server 时,我们经常会遇到一个情况:需要把一台服务器上的数据库转移到另外一台服务器上.而转移完成后,需要给一个"登录"关联一个"用户"时,往 ...
- 公有云Docker镜像P2P加速之路:安全篇
一.问题 在使用Docker运行容器化应用时,宿主机通常先要从Registry服务(如Docker Hub)下载相应的镜像(image).这种镜像机制在开发环境中使用还是很有效的,团队成员之间可以很方 ...
- javascript拖拽事件
<!DOCTYPE html> <html> <head> <title></title> <style type="tex ...