## Tips, Tricks, and Tidbits ## Michael L. Goeringer Q. I just installed FreeBSD along with X Window, but when I try to install a package I'm told I do not have X installed. Why? A. When a package is installed, it looks in the /var/db/pkg directory to check for required dependencies. If it does not find the appropriate package name it either installs it for you, or gives you an error. In the case of X Window as a dependency you get the error. To solve this, obtain root permissions and create a directory in /var/db/pkg for X Window. For example: "mkdir Xfree86-3.3.3" and your in business! File Permissions Explained: To display file permissions for a file, use the "ls" command with the "-l' option. The permissions are shown on the left-hand side of the output. At the far left, the first character of each line shows the type of file. An ordinary file is marked with a "-" and a directory is marked by a "d". There are also 5 other file type encodings: "c" for Character Device File, "b" for Block File Device, "s" for UNIX Domain Socket, "p" for a Named Pipe, and "l" for a Symbolic Link. The focus here, however, are the 9 characters to the right of the file type character. Their meaning is as follows: r = read permission w = write permission x = execution permission - = permission is not granted To analyze the permissions for a file, divide the 9 characters into three sets of 3. From left to right, these sets show the permissions for the owner of the file, the owner's group, and for everyone else. UNIX uses a compact, three-number code to represent the full set of file permissions. This code is called a FILE MODE, or usually a MODE. Within a mode, each number stands for one set of permissions. The first number represents the owner's permissions. The second number represents the group's permissions and the third for everyone else. The numbers represent the following codes: 4 = read permission 2 = write permission 1 = execute permission 0 = no permission To set permissions you add up the number of permissions granted. For example, lets have the owner have read, write, and execute permission. The group will have read and write permission while everyone else will have only read permission. Owner: read + write + execute = 4 + 2 + 1 = 7 Group: read + write = 4 + 2 + 0 = 6 Everyone: read = 4 + 0 + 0 = 4 Thus, the mode is 764. Another example working backwards. What does the file mode of 540 represent? Owner: 5 = read, execute Group: 4 = read Everyone: 0 = no permissions Hopefully these few tips and tricks will help to make your life a little easier. Michael L. Goeringer $Id: newbie.txt,v 1.1 2000/02/16 08:07:44 jim Exp $