# Creating a New User on Fedora Linux


So, you need to create a new user account on your Fedora Linux system. Adding users is a common administrative task in Linux, allowing you to set up individual accounts for different people who need access. The process is fairly straightforward using the `useradd` command.

## Why Create User Accounts in Linux?

On a personal single-user Linux system, you may just always log in as yourself. But on servers or in a business context, having multiple user accounts brings important benefits:

- **Security** - User accounts allow tracking activity and restricting access to authorized users only. Rather than always being logged in as an admin, daily work can be done under accounts with more limited privileges.
- **Ownership** - Each user gets their own files and configuration. This prevents conflicts from stepping on other users' customizations.
- **Access Control** - User accounts facilitate controlling who can access sensitive data or make system modifications. This supports organizational security policies and compliance requirements.

## Using the `useradd` Command

The `useradd` command provides a simple way to create new users without needing to directly edit system files. This helps avoid the introduction of errors or overwriting other users' data.

Here is the basic syntax:

```plaintext
useradd [options] <username>
```

Some common options include:

- `-c` - Provide a comment describing the account's purpose
- `-d` - Specify the new user's home directory path
- `-m` - Automatically create the user's home directory
- `-G` - List any secondary groups the user should belong to

Let's look at some examples of adding new users with `useradd`.

### Simple User Creation

To create a basic new user account, just provide a username:

```plaintext
useradd jsmith
```

This will:

- Create user `jsmith`
- Set up their home folder at `/home/jsmith`
- Assign the default shell (usually Bash)

After running the command, you can set the new user's initial password with the `passwd` command:

```plaintext
passwd jsmith
```

### Creating Users in Other Groups

By default, users are only in their own primary group. To assign secondary group memberships, use the `-G` option:

```plaintext
useradd -G developers,admins jdoe
```

Now `jdoe` belongs to the `developers` and `admins` groups in addition to a personal `jdoe` group.

### Customizing the User's Home Folder

You can customize where the user's home directory gets created:

```plaintext
useradd -d /opt/users/jsmith -m jsmith
```

The `-d` option defines the path for the home folder while `-m` ensures it gets made if missing.

## Next Steps After Creating a User

After running `useradd` to create an account, a few next steps helpfully set up a functional user:

- Set an initial password with `passwd`
- Optionally create a custom `.bashrc` file with aliases/settings
- Consider adding the user to supplementary groups for access needs
- Set up SSH keys for remote logins, if applicable

And when creating the first non-root user, don't forget to disable the root password or switch to sudo! Running as root for daily use introduces major security risks.

> Also read - [**How to Back Up Your Files in Linux**](https://developnsolve.com/how-to-back-up-your-files-in-linux)

## Conclusion

Whether setting up your personal system or managing servers with multiple users, `useradd` offers a simple way to introduce new accounts. Taking just a minute per user to run the command prevents future hassles. Restrict users based on the principle of least privilege for best security practices across any Linux environment.

