Annotation of wikisrc/tutorials/user_management.mdwn, revision 1.1

1.1     ! mspo        1: **Contents**
        !             2: 
        !             3: [[!toc levels=2]]
        !             4: 
        !             5: #Preface
        !             6: 
        !             7: Before you start to do user and group management you must: 
        !             8: 
        !             9: 1. For security reasons, create substitute user and name it as you like, here it is referred as _noroot_: 
        !            10: <pre><code>    
        !            11:     # useradd -m -G wheel _noroot_
        !            12: </code></pre>    
        !            13: 
        !            14: 2. Set password for _noroot_ user: 
        !            15: <pre><code>    
        !            16:     # passwd _noroot_
        !            17: </code></pre>
        !            18: 
        !            19: 3. Exit and log in as _noroot_ user. 
        !            20: 
        !            21: 4. Use the **su** command to obtain the root privileges for _noroot_: 
        !            22:     
        !            23:     $ su
        !            24:     
        !            25: 
        !            26: 5. Forget to use the **root** for maintenance or regular administration of the system. You free to find any secure and convenient spot for the root password be available upon your need. 
        !            27: 
        !            28:   
        !            29: If your favorite user with login password is already assigned in the system and no need to create new one. Omit first steps from above. Do modify user information by adding _your no root user_ into the wheel group and **su** anytime per your desire: 
        !            30:     
        !            31:     # usermod -G wheel _noroot_
        !            32:     
        !            33: 
        !            34: #[**User**](http://netbsd.gw.com/cgi-bin/man-cgi?user++NetBSD-current)
        !            35: 
        !            36: The NetBSD maintains information in regard of each user who logs into, access system, runs processes on so forth. This include and not limited to: 
        !            37:     
        !            38:     - user name
        !            39:     - password
        !            40:     - group
        !            41:     - base_dir
        !            42:     - skel_dir
        !            43:     - shell
        !            44:     - class
        !            45:     - homeperm
        !            46:     - inactive
        !            47:     - expire
        !            48:     
        !            49: 
        !            50: The superuser called root has no limitations on its privileges. 
        !            51: 
        !            52: To limit user priveleges consider to set limits by: coredumpsize, cputime, filesize, quota, maxproc, memory, openfiles etc. 
        !            53: 
        !            54: **user** is frontend to the useradd, usermod, userinfo and userdel commands, it helps to manage users in the system. 
        !            55: 
        !            56: Use [id](http://netbsd.gw.com/cgi-bin/man-cgi?id+1+NetBSD-current) to see user identity: 
        !            57: 
        !            58: **$ id**
        !            59:     
        !            60: 
        !            61: Use [w](http://netbsd.gw.com/cgi-bin/man-cgi?w+1+NetBSD-current) to see who present and what they are doing: 
        !            62: 
        !            63: **$ w**
        !            64:     
        !            65: 
        !            66: Use [last](http://netbsd.gw.com/cgi-bin/man-cgi?last+1+NetBSD-current) to see last logins: 
        !            67: 
        !            68: 
        !            69: **$ last**
        !            70:     
        !            71: 
        !            72: ##  [[basics/useradd]]
        !            73: 
        !            74: To add user do: 
        !            75:     
        !            76:     **user add** [options] _user_
        !            77:     
        !            78: 
        !            79: To add a user and create a new home directory: 
        !            80:     
        !            81:     **# useradd -m** _myuser_
        !            82:     
        !            83: 
        !            84: Look into the NetBSD Guide [Chapter 5.6](http://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-adding-users)
        !            85: 
        !            86: ##  [userinfo](http://netbsd.gw.com/cgi-bin/man-cgi?userinfo++NetBSD-current)
        !            87: 
        !            88: To see user information do: 
        !            89:     
        !            90:     **$ userinfo** _myuser_
        !            91:     
        !            92: 
        !            93: ##  [[basics/usermod]]
        !            94: 
        !            95: To modify existing user login do: 
        !            96:     
        !            97:     **# user mod** [options] _user_
        !            98:     
        !            99:     
        !           100:     **# usermod -C yes** _username_             ; set Close lock on user account
        !           101:     
        !           102:     
        !           103:     **# usermod -C no** _username_              ; unlock user account
        !           104:     
        !           105:     
        !           106:     **# usermod -G wheel** _username_           ; add user to group _wheel_
        !           107:     
        !           108:     
        !           109:     **# usermod -s /sbin/nologin** _username_   ; remove login shell
        !           110:     
        !           111:     
        !           112:     **# usermod -s /bin/sh** _username_         ; set login shell
        !           113:     
        !           114:     
        !           115:     **# usermod -F** _username_                 ; force user to change password
        !           116:     
        !           117: 
        !           118: ##  [userdel](http://netbsd.gw.com/cgi-bin/man-cgi?userdel++NetBSD-current)
        !           119: 
        !           120: To remove a user from the system do: 
        !           121:     
        !           122:     **# userdel** _myuser_
        !           123:     
        !           124: 
        !           125: ##  [[basics/passwd]]
        !           126: 
        !           127: To see a list of all users in the system do: 
        !           128:     
        !           129:     $ cat /etc/passwd
        !           130:     
        !           131: 
        !           132: To edit _/etc/passwd_ file do: 
        !           133:     
        !           134:     # vipw
        !           135:     
        !           136: 
        !           137: ##  [[basics/chpass]]
        !           138: 
        !           139: Use [chpass, chfn, chsh]((http://netbsd.gw.com/cgi-bin/man-cgi?chpass+1+NetBSD-current)) to add or change user database information. 
        !           140: 
        !           141: To change the shell of _myuser_, for an exapmle to /bin/ksh: 
        !           142:     
        !           143:     **# chpass -s /bin/ksh** _myuser_
        !           144:     
        !           145: 
        !           146:   
        !           147: 
        !           148: 
        !           149: #  [**Group**](http://netbsd.gw.com/cgi-bin/man-cgi?group++NetBSD-current)
        !           150: 
        !           151: To manage groups check **/etc/group** file which maintains name of each group, group id and list of users who is a group member. 
        !           152: 
        !           153: **group** is frontend to the groupadd, groupmod, groupinfo and groupdel commands, it helps to manage groups in the system. 
        !           154: 
        !           155: To add group do: 
        !           156:     
        !           157:     **group add** [options] _group_
        !           158:     
        !           159: 
        !           160: To delete group do: 
        !           161:     
        !           162:     **group del** [options] _group_
        !           163:     
        !           164: 
        !           165: To obtain group information do: 
        !           166:     
        !           167:     **group info** [options] _group_
        !           168:     
        !           169: 
        !           170: To modify existing group do: 
        !           171:     
        !           172:     **group mod** [options] _group_
        !           173:     
        !           174: 
        !           175: To remove user from the group you have to do **user del** and then add user again. 
        !           176: 
        !           177: ##  [groupadd](http://netbsd.gw.com/cgi-bin/man-cgi?groupadd+8+NetBSD-current)
        !           178: 
        !           179: ##  [groupdel](http://netbsd.gw.com/cgi-bin/man-cgi?groupdel+8+NetBSD-current)
        !           180: 
        !           181: ##  [groupinfo](http://netbsd.gw.com/cgi-bin/man-cgi?groupinfo+8+NetBSD-current)
        !           182: 
        !           183: ##  [groupmod](http://netbsd.gw.com/cgi-bin/man-cgi?groupmod+8+NetBSD-current)
        !           184: 
        !           185: #  Other
        !           186: 
        !           187: ##  [[basics/chmod]]
        !           188: 
        !           189: ##  [[basics/chown]]
        !           190: 
        !           191: To change files/directory ownership: 
        !           192:     
        !           193:     #chown -R  myuser path 
        !           194:     
        !           195: 
        !           196: Where myuser is the name of user and path is directory where files are located. 
        !           197: 
        !           198: ##  [[basics/chgrp]]
        !           199: 
        !           200: ##  [[basics/chroot]]
        !           201: 
        !           202: ##  [[basics/quota]]
        !           203: 
        !           204: Use quota to set users quotas per desire. 
        !           205: 
        !           206: #  See also
        !           207: 
        !           208:   * [[How to set up per-user timezones]]
        !           209:   * How to [[Hide other user's processes]]
        !           210:   * [[Userland version]]
        !           211:   * [[The_NetBSD_System_Manager's_Manual#Users_and_Accounts_Management]]

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb