zoukankan      html  css  js  c++  java
  • [REPRINT]MODIFYING USER ACCOUNTS(usermod)

    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
    
  • 相关阅读:
    bzoj:1299: [LLH邀请赛]巧克力棒
    [51nod][cf468D]1558 树中的配对
    HDU5447 Good Numbers
    Timus Online Judge:ural:1006. Square Frames
    poj1830:开关问题
    bzoj:1776: [Usaco2010 Hol]cowpol 奶牛政坛
    bzoj:1725: [Usaco2006 Nov]Corn Fields牧场的安排
    bzoj:1828: [Usaco2010 Mar]balloc 农场分配
    bzoj:1584: [Usaco2009 Mar]Cleaning Up 打扫卫生
    bzoj:1598: [Usaco2008 Mar]牛跑步
  • 原文地址:https://www.cnblogs.com/yaos/p/14014317.html
Copyright © 2011-2022 走看看