52 lines
896 B
Markdown
52 lines
896 B
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.
|
||
|
|
||
|
---
|
||
|
|
||
|
### 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
|
||
|
```
|