File Access Permission

1
30
[root@fedora12 user1]# chmod 777 file1
[root@fedora12 user1]# ls -l file1
-rwxrwxrwx 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]# chmod ugo+x file1
[root@fedora12 user1]# ls -l file1
-rwxrwxrwx 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]# chmod 000 file1
[root@fedora12 user1]# ls -l file1
———- 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]# chmod +x file1
[root@fedora12 user1]# ls -l file1
—x–x–x 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]# chmod +r file1
[root@fedora12 user1]# ls -l file1
-r-xr-xr-x 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]# chmod +w -r file1
chmod: cannot access `+w’: No such file or directory
[root@fedora12 user1]# chmod -r file1
[root@fedora12 user1]# ls -l file1
—x–x–x 1 user1 user1 0 2009-12-22 15:31 file1
[root@fedora12 user1]#

Permissions are intended to 3

1.Owner

2.Group

3.others

for three of them 3 permissions are there

r=Read

w=Write

x=Execute

and Hence rwx rwx rwx

=

000 000 000 => for No permission

and

111 111 111 =>for Full Permission

and rest values accordingly

Eg. To add all permissions to file1

[root@fedora12 user1]# chmod 777 file1

[root@fedora12 user1]# ls -l file1

-rwxrwxrwx 1 user1 user1 0 2009-12-22 15:31 file1

Alternatively this method can be used , here user, Group,Others will be added with Read Permissions

[root@fedora12 user1]# chmod ugo+x file1

[root@fedora12 user1]# ls -l file1

-rwxrwxrwx 1 user1 user1 0 2009-12-22 15:31 file1

–Reseting

[root@fedora12 user1]# chmod 000 file1

[root@fedora12 user1]# ls -l file1

———- 1 user1 user1 0 2009-12-22 15:31 file1

Another way is to use+x,+r,+w to add corresponding Permissions to All

[root@fedora12 user1]# chmod +x file1

[root@fedora12 user1]# ls -l file1

—x–x–x 1 user1 user1 0 2009-12-22 15:31 file1

[root@fedora12 user1]# chmod +r file1

[root@fedora12 user1]# ls -l file1

-r-xr-xr-x 1 user1 user1 0 2009-12-22 15:31 file1

[root@fedora12 user1]# chmod +w -r file1

chmod: cannot access `+w’: No such file or directory

[root@fedora12 user1]# chmod -r file1

[root@fedora12 user1]# ls -l file1

—x–x–x 1 user1 user1 0 2009-12-22 15:31 file1

[root@fedora12 user1]#

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here