Linux file permission
bash$ cd /tmp
bash$ ls -l
total 783
-rwx------ 1 wood users 1 Jan 25 18:28 190067haa
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
-rw------- 1 rhey19 root 395447 Jan 24 02:59 popp3a13598
-rw------- 1 rhey19 root 395447 Jan 24 03:00 popp3a13600
drwxr-xr-x 4 root root 1024 Jan 12 13:18 screens
First notice that we used a / and not \ to change to the tmp directory! linux uses the / as the root so it is backwards from DOS here.
Notice we did ls -l for the long directory. If we did 'ls' we would have what you see below.
bash$ ls
19067haa filter.14428 pop3a13598 pop3a13600 screens
With what we see here can not tell much, so most of the time we will be using ls -al with the -al we will see the hidden files also, hidden files and directories will always start with a '.'. Now watch:
bash$ ls -al
total 794
drwxrwxrwt 4 root root 8192 Jan 25 23:05 .
drwxr-xr-x 22 root root 1024 Dec 28 18:07 ..
-rw-r--r-- 1 berry users 6 Jan 25 23:05 .piinetemp.000
drwxr-xr-x 2 berry users 1024 Jan 25 23:05 .test
-rwx------ 1 wood users 1 Jan 25 18:28 190067haa
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
-rw------- 1 rhey19 root 395447 Jan 24 02:59 popp3a13598
-rw------- 1 rhey19 root 395447 Jan 24 03:00 popp3a13600
drwxr-xr-x 4 root root 1024 Jan 12 13:18 screens
.pinetemp.000 is a hidden file, and .test is a hidden directory.
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
row 1 row2 row3
----------------------------
Now here we need to learn about permissions, users, and groups.
Row #1 is the file permissions
Row #2 is who owns the file
Row #3 is the group owner of the file
File permissions are grouped together into three different groups.
If the line starts with a d, it is a directory, if there is no d, it is a file.
- --- --- ---
| | | |--------> Other = anyone on the machine can access
| | |------------> Group = certain groups can access
| |----------------> User = only the owner can access
|------------------> Directory Mark
- rw- r-- r--
| | | |--------> Other can only read the file
| | |------------> Group can only read the file
| |----------------> User can read or write to the file
|------------------> It is not a directory
- rwx rwx r-x
| | | |--------> Other can read and execute the file
| | |------------> Group can read write and execute the file
| |----------------> User can read write and execute the file
|------------------> It is not a directory
The owner is the user name in row #2 and the group owner is the name in row #3. In DOS the file has to have a .exe, .com, or .bat extension to execute, but in unix all you need is the --x in your group of user, other, group.
You can change these permissions if you own the file or have root access:
----------------------------------------------------------------------------
chmod oug+r filename will make all three groups of permissions be able to read the file.
chmod og-r filename would make the file readable only to the user that owns the file. (notice the - or + to set the file yes or no)
chmod +x filename would make the file execute by all.
chown username filename would make the file owned by another user.
chgrp groupname filename would make the file owned by another group.
----------------------------------------------------------------------------
Make sure to keep file perm's and groups the same or you will be sniffed out and booted from the system. Changing configs on the system might only break other functions, so keep your paws off or you are just asking to get cought. Only do what you are *SURE* of. Only use commands that you know, you might find yourself spending hours fixing just one typo like chown -R username /* could keep you busy for a year ;)
Just be careful!
We will get into this stuff more as we go into the needs for this.
bash$ ls -l
total 783
-rwx------ 1 wood users 1 Jan 25 18:28 190067haa
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
-rw------- 1 rhey19 root 395447 Jan 24 02:59 popp3a13598
-rw------- 1 rhey19 root 395447 Jan 24 03:00 popp3a13600
drwxr-xr-x 4 root root 1024 Jan 12 13:18 screens
First notice that we used a / and not \ to change to the tmp directory! linux uses the / as the root so it is backwards from DOS here.
Notice we did ls -l for the long directory. If we did 'ls' we would have what you see below.
bash$ ls
19067haa filter.14428 pop3a13598 pop3a13600 screens
With what we see here can not tell much, so most of the time we will be using ls -al with the -al we will see the hidden files also, hidden files and directories will always start with a '.'. Now watch:
bash$ ls -al
total 794
drwxrwxrwt 4 root root 8192 Jan 25 23:05 .
drwxr-xr-x 22 root root 1024 Dec 28 18:07 ..
-rw-r--r-- 1 berry users 6 Jan 25 23:05 .piinetemp.000
drwxr-xr-x 2 berry users 1024 Jan 25 23:05 .test
-rwx------ 1 wood users 1 Jan 25 18:28 190067haa
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
-rw------- 1 rhey19 root 395447 Jan 24 02:59 popp3a13598
-rw------- 1 rhey19 root 395447 Jan 24 03:00 popp3a13600
drwxr-xr-x 4 root root 1024 Jan 12 13:18 screens
.pinetemp.000 is a hidden file, and .test is a hidden directory.
-rw-r--r-- 1 berry mail 1 Jan 16 12:38 fillter.14428
row 1 row2 row3
----------------------------
Now here we need to learn about permissions, users, and groups.
Row #1 is the file permissions
Row #2 is who owns the file
Row #3 is the group owner of the file
File permissions are grouped together into three different groups.
If the line starts with a d, it is a directory, if there is no d, it is a file.
- --- --- ---
| | | |--------> Other = anyone on the machine can access
| | |------------> Group = certain groups can access
| |----------------> User = only the owner can access
|------------------> Directory Mark
- rw- r-- r--
| | | |--------> Other can only read the file
| | |------------> Group can only read the file
| |----------------> User can read or write to the file
|------------------> It is not a directory
- rwx rwx r-x
| | | |--------> Other can read and execute the file
| | |------------> Group can read write and execute the file
| |----------------> User can read write and execute the file
|------------------> It is not a directory
The owner is the user name in row #2 and the group owner is the name in row #3. In DOS the file has to have a .exe, .com, or .bat extension to execute, but in unix all you need is the --x in your group of user, other, group.
You can change these permissions if you own the file or have root access:
----------------------------------------------------------------------------
chmod oug+r filename will make all three groups of permissions be able to read the file.
chmod og-r filename would make the file readable only to the user that owns the file. (notice the - or + to set the file yes or no)
chmod +x filename would make the file execute by all.
chown username filename would make the file owned by another user.
chgrp groupname filename would make the file owned by another group.
----------------------------------------------------------------------------
Make sure to keep file perm's and groups the same or you will be sniffed out and booted from the system. Changing configs on the system might only break other functions, so keep your paws off or you are just asking to get cought. Only do what you are *SURE* of. Only use commands that you know, you might find yourself spending hours fixing just one typo like chown -R username /* could keep you busy for a year ;)
Just be careful!
We will get into this stuff more as we go into the needs for this.
0 comments:
Post a Comment