http://landoflinux.com/linux_usermod_command.html

Append Additional Groups to an exiting account

usermod -a -G group1,group2,group3 userid

[root@fedsrv01a ~]# id testuser
uid=1001(testuser) gid=1004(testuser) groups=1004(testuser) [root@fedsrv01a ~]# groups testuser
testuser : testuser [root@fedsrv01a ~]# usermod -a -G group1,group2,group3 testuser [root@fedsrv01a ~]# id testuser
uid=1001(testuser) gid=1004(testuser) groups=1004(testuser),1001(group1),1002(group2),1003(group3) [root@fedsrv01a ~]# groups testuser
testuser : testuser group1 group2 group3

Change a Users Home Directory

usermod -d /new/home userid

root@john-desktop:/home# grep testuser /etc/passwd
testuser:x:1003:1235:testuser:/home/testuser:/bin/sh root@john-desktop:/home# usermod -d /home/new testuser root@john-desktop:/home# grep testuser /etc/passwd
testuser:x:1003:1235:testuser:/home/new:/bin/sh

Change a Users Default Shell

usermod -s /bin/bash userid

The "-s" option is used to specify a shell to be used with the specified user. By default most Linux systems will assign the "Bash Shell". However, many systems often have other shells available or shells that can be installed. To display what shells are available on your system, simply issue the command: "cat /etc/shells". In the example below we are going to change the users shell from the default "Bash Shell" to the "Korn Shell".

[root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1001:1004:Test User Account:/home/testuser:/bin/bash [root@fedsrv01a ~]# usermod -s /bin/ksh testuser [root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1001:1004:Test User Account:/home/testuser:/bin/ksh

Change User Comment Description - ( gecos )

usermod -c "Change my comment info" testuser

[root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1001:1004:Test User Account:/home/testuser:/bin/ksh [root@fedsrv01a ~]# usermod -c "Testing Account Only" testuser [root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1001:1004:Testing Account Only:/home/testuser:/bin/ksh

Change a users UID

usermod -u UID testuser

This option allows you to change the "UID", a numerical value that identifies a user's account.

[root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1001:1004:Testing Account Only:/home/testuser:/bin/ksh [root@fedsrv01a ~]# usermod -u 1010 testuser [root@fedsrv01a ~]# grep testuser /etc/passwd
testuser:x:1010:1004:Testing Account Only:/home/testuser:/bin/ksh

[REPRINT]MODIFYING USER ACCOUNTS(usermod)的更多相关文章

  1. A Complete Guide to Usage of ‘usermod’ command– 15 Practical Examples with Screenshots

    https://www.tecmint.com/usermod-command-examples/ -------------------------------------------------- ...

  2. (译)"usermod"命令使用完全指导---15个练习例程截图

    "usermod"命令使用完全指导---15个练习例程截图 By Babin Lonston Under: Linux Commands On: November 11, 2014 ...

  3. 【Linux命令】用户身份(useradd,groupadd,usermod,passwd,userdel)

    目录 用户身份 useradd userdel usermod groupadd groupdel passwd chage 用户身份 在linux系统中和windows一样有用户之分.root用户为 ...

  4. mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES

    AutoMySQLBackup备份时,出现mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@' ...

  5. Linux – Usermod命令参数解析和实例说明

    usermod 命令修改系统帐户文件来反映通过命令行指定的变化 1. 首先看看usermod都是有哪些参数 [root@hxweb101 ~]$ usermod --help Usage: userm ...

  6. Linux 新建用户、用户组,给用户分配权限(chown、useradd、groupadd、userdel、usermod、passwd、groupdel)

    Linux 系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统.用户的账号一方面可以帮助系统管理员对使用系统的用户进行 ...

  7. This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.

    -- :::] This application is modifying the autolayout engine from a background thread, which can lead ...

  8. Net accounts命令

    Net accounts 将用户帐户数据库升级并修改所有帐户的密码和登录请求. 语法 net accounts [/forcelogoff:{minutes | no}] [/minpwlen:len ...

  9. linux-15基础命令之-用户与用户组(useradd,userdel,usermod,passwd,groupadd)

    1.useradd 命令用于创建新的用户,格式为:useradd[选项] 用户名 useradd参数 参数 作用 -d 指定用户的家目录(默认/home/username) -D 展示默认值 -e 帐 ...

随机推荐

  1. 最强CP!阿里云联手支付宝小程序如何助力双11?

    作为首次“全面上云”的双11,阿里云征服了每秒订单峰值54.4万笔的世界新记录.正是在阿里云的保驾护航下,即使访问量是平时的5到6倍,小程序也鲜少出现卡顿或者宕机的现象,“依靠阿里云,我们整个天猫双1 ...

  2. php ucfirst()函数 语法

    php ucfirst()函数 语法 作用:字符串首字母大写 语法:ucfirst(string) 参数: 参数 描述 string 必须,规定要转换的字符串 说明:把字符串中的首字符转换为大写.直线 ...

  3. PHP curl_multi_getcontent函数

    curl_multi_getcontent — 如果设置了CURLOPT_RETURNTRANSFER,则返回获取的输出的文本流 说明 string curl_multi_getcontent ( r ...

  4. 4412 Linux设备总线

    总线_设备_驱动注册流程详解 注册流程图 • 设备一般都需要先注册,才能注册驱动– 现在越来越多的热拔插设备,反过来了.先注册驱动,设备来了再注册 设备 • 本节使用的命令– 查看总线的命令#ls / ...

  5. Python基础教程(021)--Pycharm简介

    前言 学习Pycharm开发工具 内容 项目:就是一个功能复杂的软件 目标 必须掌握的工具

  6. operator函数操作符

    函数操作数() 可以实现将对象当函数使用. class Square{ public: double operator()(double x)const{return x*x;} };

  7. Delphi界面篇之ListView控件

    //增加项或列(字段) ListView1.Clear; ListView1.Columns.Clear; ListView1.Columns.Add; ListView1.Columns.Add; ...

  8. IIS的站点配置存储在applicationHost.config

    C:\Windows\System32\inetsrv\Config\applicationHost.config

  9. LCA 总结

    代码: //RMQ求LCA struct node { int v, w; }; class LCA { private: vector<int>dep, pos, olx, dis; v ...

  10. flysql 里两种传参的方式

    传参的方式,两个标清楚: for lists_bx_goods in out_list: sql = XDO().get_update_sql('init_goods_test', { "一 ...