To add a user in Linux using command line tools, you can use the useradd
command.
For example, to add a user called john
with a home directory at /home/john
, you would run:
sudo useradd -m -d /home/john john
This will create the user john
and create a new home directory for them at /home/john
.
You can also set a password for the user at the same time using the passwd
command. For example:
sudo passwd john
This will prompt you to enter and confirm a password for the user john
.
Keep in mind that these commands only create the user account. In order to give the user access to certain resources or permissions, you may need to modify other settings or add the user to certain groups.