Linux
3 User Catogories
SuperUser Acount User Acount /home/user Service Acount eg. mysql user only for mysql
Permissions
cat /etc/passwd Has registered user z Format USERNAME : PASSWORD : UID : GID : GECOS : HOMEDIR : SHELL
To create a new user : adduser USERNAME
Creating a group
1
| usermod -aG sudo <username>
|
adding a user to the sudo group
File Permissions and Ownership
Ownership
- Two owners the user and the group
1
| chown USERNAME:GPOUPNAME FILENAME
|
1
| sudo chgrp GROUPNAME FILENAME
|
d rwx-rwx-rwx Owner (u) - Group (g) - Other (o)
Modyfying file permissions
remove the execcute permisdsion for all the owners
RWX R– RW-
| Â | Â | Â |
|---|
| Number | Permission Type | Symbol |
| 1 | No Permission | –x |
| 2 | Execute | -w- |
| 3 | Write | -wx |
| 4 | Execute + Write | r__ |
| 5 | Read | r-x |
| 6 | Read + Execute | rwx |
| 7 | Read +Write | Symbol |
Pipeline
using the output of the previous command as the input of the next command
1
| cat /var/log/syslog | less
|
less is a program that displays large content in good manner
Redirection
redirects the content of the previous commands to a new file
Environment Variables
Setting a env variable
1
| export DB_USERNAME = dbuser
|
Deleting an environment variable
Persisting an env variable
1
2
3
| nano .bashrc
source .bashrc # used to load the newly added environment variables
|
Base 64 encoding
1
| echo -n 'username' | base64
|