< Previous | Contents | Next >
5.2.1. Creating User Accounts
Although Kali is most often run while authenticated as the root user, you may often need to create non-privileged user accounts for various reasons, particularly if you are using Kali as a primary
operating system. The most typical way to add a user is with the adduser command, which takes a required argument: the username for the new user that you would like to create.
The adduser command asks a few questions before creating the account but its usage is fairly straightforward. Its configuration file, /etc/adduser.conf, includes many interesting settings. You can, for example, define the range of user identifiers (UIDs) that can be used, dictate whether or not users share a common group or not, define default shells, and more.
The creation of an account triggers the population of the user’s home directory with the contents of the /etc/skel/ template. This provides the user with a set of standard directories and config- uration files.
In some cases, it will be useful to add a user to a group (other than their default main group) in order to grant additional permissions. For example, a user who is included in the sudo group has full administrative privileges through the sudo command. This can be achieved with a command such as adduser user group.
Using getent to Consult The getent (get entries) command checks the system databases (including those of the User Database users and groups) using the appropriate library functions, which in turn call the name service switch (NSS) modules configured in the /etc/nsswitch.conf file. The com- mand takes one or two arguments: the name of the database to check, and a possible search key. Thus, the command getent passwd kaliuser1 will return the informa- tion from the user database regarding the user kaliuser1. | |
root@kali:~# getent passwd kaliuser1 kaliuser1:x:1001:1001:Kali User ➥ ,4444,123-867-5309,321-867-5309:/home/kaliuser1:/bin/ ➥ bash | |