67Chapter 2Running Commands from the (Top ten web hosting) ShellThe nine bits
Monday, April 30th, 200767Chapter 2Running Commands from the ShellThe nine bits assigned to each file for permissions define the access that you andothers have to your file. Permission bits appear as rwxrwxrwx. The first three bitsapply to the owner s permission, the next three apply to the group assigned to thefile, and the last three apply to all others. The rstands for read,the w stands forwrite,and the x stands for execute permissions. If a dash appears instead of the let- ter, it means that permission is turned off for that associated read, write, or execute. Because files and directories are different types of elements, read, write, and executepermissions on files and directories mean different things. Here s what you can dowith each of them: PermissionFileDirectoryReadView what s in the file.See what files and subdirectories it contains. WriteChange the file s content, Add files or subdirectories to the directory. rename it, or delete it. ExecuteRun the file as a program.Change to that directory as the currentdirectory, search through the directory, orexecute a program from the directory. You can see the permission for any file or directory by typing the ls -ldcommand. The named file or directory appears as those shown in this example: $ ls -ld ch3 test-rw-rw-r– 1 chris sales 4983 Jan 18 22:13 ch3drwxr-xr-x 2 chris sales 1024 Jan 24 13:47 testThe first line shows that the ch3file has read and write permission for the owner andthe group. All other users have read permission, which means they can view the filebut cannot change its contents or remove it. The second line shows the testdirec- tory (indicated by the letter dbefore the permission bits). The owner has read, write, and execute permission, while the group and other users have only read andexecute permissions. As a result, the owner can add, change, or delete files in thatdirectory, and everyone else can only read the contents, change to that directory, and list the contents of the directory. If you own a file, you can use the chmodcommand to change the permission on it asyou please. In one method of doing this, each permission (read, write, and execute), is assigned a number r=4, w=2, and x=1 and you use each set s total number toestablish the permission. For example, to make permissions wide open for yourselfas owner, you d set the first number to 7 (4+2+1), and to give the group and othersonly read permission, you d set both the second and third numbers to 4 (4+0+0), sothat the final number is 744. Any combination of permissions can result from 0 (nopermission) through 7 (full permission).
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services