| Adding users and user groups in Linux |
|
N.B. To continue with this guide, access to the administrator or super user is required, if you do not have access to such a user then please consult you system administrator. Furthermore I will not be held responsible for any damage or harm that could be caused by using this guide. Further to the guide A Basic Guide To Understanding Permissions In Linux/Unix this article will go through the steps of adding a user , adding a group and then assigning the user to the new group. To add a user in Linux , the administrator (root) user must be logged in first. In this guide the username that is to be added will be john and a home folder will be created as well. In addition to adding the user, a password of john will be used. Realistically this password is not a good example, as a password should be difficult to guess, especially if someone who should not be logging in as this user wanted to gain access. The group that will be added for the user john isĀ admin . The command used to add groups is called groupadd .Please make sure that before adding this group, it does not exist in the system, otherwise an error will occur. To add a group to the system type the following command : groupadd admin In order to add the user to the system,with a home folder, the command called adduser will be used. The following command will add the user john ,create the users home folder and add the user to the group admin : adduser -m -g admin john For the password the command passwd is used. So to add a password to the user john type the following command : passwd john When this command is executed, the system will prompt for the password and then ask to confirm it again. Once entered successfully it will report that it has been added to the password database. These three commands give the system administrator the ability to add system groups and users into the system. |