Diff for /wikisrc/tutorials/user_management.mdwn between versions 1.4 and 1.9

version 1.4, 2019/04/04 15:24:29 version 1.9, 2019/04/05 09:53:52
Line 7 Line 7
 Before you start to do user and group management you must:   Before you start to do user and group management you must: 
   
 1. For security reasons, create substitute user and name it as you like, here it is referred as _noroot_:   1. For security reasons, create substitute user and name it as you like, here it is referred as _noroot_: 
 <pre><code>      
     # useradd -m -G wheel _noroot_  [[!template id=programlisting text="""
 </code></pre>      # useradd -m -G wheel _noroot_
   """]]
   
 2. Set password for _noroot_ user:   2. Set password for _noroot_ user: 
 <pre><code>      
     # passwd _noroot_  [[!template id=programlisting text="""
 </code></pre>  # passwd _noroot_
   """]]
   
 3. Exit and log in as _noroot_ user.   3. Exit and log in as _noroot_ user. 
   
 4. Use the **su** command to obtain the root privileges for _noroot_:   4. Use the `su` command to obtain the root privileges for _noroot_: 
           
     $ su  [[!template id=programlisting text="""
   $ su
   """]]
           
   
 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.   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. 
   
       
 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:   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: 
           
     # usermod -G wheel _noroot_  [[!template id=programlisting text="""
   # usermod -G wheel _noroot_
   """]]
           
   
 #[**User**](http://netbsd.gw.com/cgi-bin/man-cgi?user++NetBSD-current)  #[**User**](http://netbsd.gw.com/cgi-bin/man-cgi?user++NetBSD-current)
   
 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:   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: 
           
     - user name   - user name
     - password   - password
     - group   - group
     - base_dir   - base_dir
     - skel_dir   - skel_dir
     - shell   - shell
     - class   - class
     - homeperm   - homeperm
     - inactive   - inactive
     - expire   - expire
           
   
 The superuser called root has no limitations on its privileges.   The superuser called root has no limitations on its privileges. 
   
 To limit user priveleges consider to set limits by: coredumpsize, cputime, filesize, quota, maxproc, memory, openfiles etc.   To limit user priveleges consider to set limits by: coredumpsize, cputime, filesize, quota, maxproc, memory, openfiles etc. 
   
 **user** is frontend to the useradd, usermod, userinfo and userdel commands, it helps to manage users in the system.   `user` is frontend to the useradd, usermod, userinfo and userdel commands, it helps to manage users in the system. 
   
 Use [id](http://netbsd.gw.com/cgi-bin/man-cgi?id+1+NetBSD-current) to see user identity:   Use [id](http://netbsd.gw.com/cgi-bin/man-cgi?id+1+NetBSD-current) to see user identity: 
   
 **$ id**      $ id
           
   
 Use [w](http://netbsd.gw.com/cgi-bin/man-cgi?w+1+NetBSD-current) to see who present and what they are doing:   Use [w](http://netbsd.gw.com/cgi-bin/man-cgi?w+1+NetBSD-current) to see who present and what they are doing: 
   
 **$ w**      $ w
           
   
 Use [last](http://netbsd.gw.com/cgi-bin/man-cgi?last+1+NetBSD-current) to see last logins:   Use [last](http://netbsd.gw.com/cgi-bin/man-cgi?last+1+NetBSD-current) to see last logins: 
   
   
 **$ last**      $ last
           
   
 ##  [useradd](http://netbsd.gw.com/cgi-bin/man-cgi?useradd++NetBSD-current)  ##  [useradd](http://netbsd.gw.com/cgi-bin/man-cgi?useradd++NetBSD-current)
   
 To add user do:   To add user do: 
           
     **user add** [options] _user_      user add [options] _user_
           
   
 To add a user and create a new home directory:   To add a user and create a new home directory: 
           
     **# useradd -m** _myuser_      # useradd -m _myuser_
           
   
 Look into the NetBSD Guide [Chapter 5.6](http://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-adding-users)  Look into the NetBSD Guide [Chapter 5.6](http://netbsd.org/docs/guide/en/chap-boot.html#chap-boot-adding-users)
Line 87  Look into the NetBSD Guide [Chapter 5.6] Line 93  Look into the NetBSD Guide [Chapter 5.6]
   
 To see user information do:   To see user information do: 
           
     **$ userinfo** _myuser_      $ userinfo _myuser_
           
   
 ##  [usermod](http://netbsd.gw.com/cgi-bin/man-cgi?usermod++NetBSD-current)  ##  [usermod](http://netbsd.gw.com/cgi-bin/man-cgi?usermod++NetBSD-current)
   
 To modify existing user login do:   To modify existing user login do: 
           
     **# user mod** [options] _user_      # user mod [options] _user_
           
           
     **# usermod -C yes** _username_             ; set Close lock on user account      # usermod -C yes _username_             ; set Close lock on user account
           
           
     **# usermod -C no** _username_              ; unlock user account      # usermod -C no _username_              ; unlock user account
           
           
     **# usermod -G wheel** _username_           ; add user to group _wheel_      # usermod -G wheel _username_           ; add user to group _wheel_
           
           
     **# usermod -s /sbin/nologin** _username_   ; remove login shell      # usermod -s /sbin/nologin _username_   ; remove login shell
           
           
     **# usermod -s /bin/sh** _username_         ; set login shell      # usermod -s /bin/sh _username_         ; set login shell
           
           
     **# usermod -F** _username_                 ; force user to change password      # usermod -F _username_                 ; force user to change password
           
   
 ##  [userdel](http://netbsd.gw.com/cgi-bin/man-cgi?userdel++NetBSD-current)  ##  [userdel](http://netbsd.gw.com/cgi-bin/man-cgi?userdel++NetBSD-current)
   
 To remove a user from the system do:   To remove a user from the system do: 
           
     **# userdel** _myuser_      # userdel _myuser_
           
   
 ##  [passwd](http://netbsd.gw.com/cgi-bin/man-cgi?passwd++NetBSD-current)  ##  [passwd](http://netbsd.gw.com/cgi-bin/man-cgi?passwd++NetBSD-current)
Line 140  Use [chpass, chfn, chsh]((http://netbsd. Line 146  Use [chpass, chfn, chsh]((http://netbsd.
   
 To change the shell of _myuser_, for an exapmle to /bin/ksh:   To change the shell of _myuser_, for an exapmle to /bin/ksh: 
           
     **# chpass -s /bin/ksh** _myuser_      # chpass -s /bin/ksh _myuser_
           
   
       
Line 148  To change the shell of _myuser_, for an  Line 154  To change the shell of _myuser_, for an 
   
 #  [**Group**](http://netbsd.gw.com/cgi-bin/man-cgi?group++NetBSD-current)  #  [**Group**](http://netbsd.gw.com/cgi-bin/man-cgi?group++NetBSD-current)
   
 To manage groups check **/etc/group** file which maintains name of each group, group id and list of users who is a group member.   To manage groups check `/etc/group` file which maintains name of each group, group id and list of users who is a group member. 
   
 **group** is frontend to the groupadd, groupmod, groupinfo and groupdel commands, it helps to manage groups in the system.   `group` is frontend to the groupadd, groupmod, groupinfo and groupdel commands, it helps to manage groups in the system. 
   
 To add group do:   To add group do: 
           
     **group add** [options] _group_      group add [options] _group_
           
   
 To delete group do:   To delete group do: 
           
     **group del** [options] _group_      group del [options] _group_
           
   
 To obtain group information do:   To obtain group information do: 
           
     **group info** [options] _group_      group info [options] _group_
           
   
 To modify existing group do:   To modify existing group do: 
           
     **group mod** [options] _group_      group mod [options] _group_
           
   
 To remove user from the group you have to do **user del** and then add user again.   To remove user from the group you have to do `user del` and then add user again. 
   
 ##  [groupadd](http://netbsd.gw.com/cgi-bin/man-cgi?groupadd+8+NetBSD-current)  ##  [groupadd](http://netbsd.gw.com/cgi-bin/man-cgi?groupadd+8+NetBSD-current)
   

Removed from v.1.4  
changed lines
  Added in v.1.9


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