You can use the chown command to change the user:group associated with a file. For example:
!# chown root:root testing.txt Will change the user:group permissions to root:root. Anyone other than the root user will have to be under the group "root" to access this file.
You can also change the permissions for file access with the 'chmod' command. File permissions are Read, Write and Execute, and are broken up into 3 fields: Owner, Group, and World.
So, for example:
-rwxr--r-- 1 root root 81 Jan 1 12:00 testing.txt The owner (root) has read, write and execute permissions. The group (root) has only read permissions. World access (everyone else) has only read permissions.
When changing permissions with "chmod" you will can use the numerical value for the permissions you want to set. These are:
0 = no permissions whatsoever; this person cannot read, write, or execute the file
1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)
So the command:
!# chmod 777 testing.txt would change the permissions of that file to:
-rwxrwxrwx 1 root root 81 Jan 1 12:00 testing.txt And the file can now be edited or executed (if it were a script) by anyone, regardless if they are associated with the user or group.
- 2 brukere syntes dette svaret var til hjelp