68 lines
1.1 KiB
Markdown
68 lines
1.1 KiB
Markdown
|
As a linux user, we know the difference between a user having root privileges and users without. This is an important thing to understand. Sudo for the win.
|
||
|
|
||
|
![[Pasted image 20230809185553.png]]
|
||
|
|
||
|
There are 3 kinds of users on linux.
|
||
|
1. Super user
|
||
|
2. System user
|
||
|
3. Normal user
|
||
|
|
||
|
---
|
||
|
|
||
|
### Adding Users
|
||
|
|
||
|
Adding a user:
|
||
|
|
||
|
```
|
||
|
useradd usernamehere
|
||
|
```
|
||
|
|
||
|
Additional `useradd` flags:
|
||
|
|
||
|
```
|
||
|
#creates a home directory for the user 'joe'
|
||
|
useradd joe -m
|
||
|
|
||
|
#creates a default shell for the user
|
||
|
useradd joe -m -s
|
||
|
|
||
|
#using the bash as default shell for user
|
||
|
useradd joe -m -s /bin/bash/
|
||
|
|
||
|
#adds user to the default user group
|
||
|
useradd joe -g users
|
||
|
|
||
|
#adds comments to the user
|
||
|
useradd joe -c "this dude sucks"
|
||
|
```
|
||
|
|
||
|
|
||
|
Putting it all together, making a user profile for Joe.
|
||
|
```
|
||
|
sudo useradd joe -m -s /bin/bash -g users -c "this dude sucks"
|
||
|
```
|
||
|
|
||
|
Many more flags are available but go to `man` for additional info.
|
||
|
|
||
|
|
||
|
Setting a password for Joe.
|
||
|
```
|
||
|
sudo passwd joe
|
||
|
```
|
||
|
|
||
|
|
||
|
### Removing Users
|
||
|
|
||
|
Removing a user:
|
||
|
```
|
||
|
userdel joe
|
||
|
```
|
||
|
|
||
|
|
||
|
### Misc User stuff
|
||
|
|
||
|
View all users:
|
||
|
```
|
||
|
cat /etc/passwd
|
||
|
```
|