<commit_before>---
---

### Managing users
```shell
sudo adduser test
sudo userdel -r test

sudo passwd test
```
### Add sudo permissions to user
```shell
sudo usermod -aG sudo test
```

### Allow access to x-server
```shell
xhost +SI:localuser:test
```<commit_msg>Update linux user management notes<commit_after>---
---

Most of these commands require root privileges.

## Managing users

To list existing users in the system, run `cat /etc/passwd`.

### Create user

```shell
useradd OPTIONS USERNAME
-m        # Create home folder
-p        # Set password
-G g1,g2  # Add user to groups

chfn USERNAME    # Change finger information
passwd USERNAME  # Update password
```

### Groups

To list existing groups in the system, run `getent group`.

```shell
groups USERNAME                 # List groups of a user (defaults to current user)
gpasswd OPTIONS USERNAME GROUP  # Manage groups
-a  # Add to group
-d  # Remove from group
```

### Delete user

```shell
userdel -r USERNAME
```

### Giving admin privileges

```shell
visudo

username ALL=(ALL) ALL  # Only for user
%wheel ALL=(ALL) ALL    # For all users in wheel group
```
{'fraction_non_alphanumeric': 0.11229000884173299, 'fraction_numerical': 0.0017683465959328027, 'mean_word_length': 3.370656370656371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5754653', 'n_tokens_mistral': 373, 'n_tokens_neox': 343, 'n_words': 147}