[aklug] Re: regarding permission bits

From: <bryanm@acsalaska.net>
Date: Thu Nov 20 2008 - 00:30:56 AKST

On Wed, November 19, 2008 4:19 pm, Christopher Howard wrote:
> I just wanted to make sure I was understanding something correctly. I
> know that how to set 9 bits of file permissions, like so:
>
> chmod 755 myfile
>
> This changes the bits to 111 101 101. And each 3 bits represents read,
> write, and execute permissions.
>
> But there is another three bits before those, right? And those are the
> UID, GID, and sticky bits, right? So chmod 7755, for example, would set
> those three
> bits to true, correct? Let me know if I am misunderstanding how this
> works.

I'll fill in until the real experts wake up tomorrow. The top two
bits are setuid and setgid, and yes, your syntax is correct. The
chmod man page has the details.

> Also, as a point of curiosity: I've seen that some files (like
> directories) have a 'file
> type' character. Does this take up the space of a full character? Is it
> like a 1 byte C char; or is this just a system representation of a smaller
> set of bits? And is there a way I can manipulate those bits?

You probably don't want to directly manipulate the file type.
What would it mean to change a text file to a directory, or a
directory to a device file? Each file type can be created with
its appropriate utility:

 type utility meaning
 ---- ------- -------
   d mkdir directory
   l ln -s symbolic link
   c mknod character device
   b mknod block device
   p mkfifo named pipe
   s ??? socket

Did I forget any, list?

--
Bryan Medsker
bryanm@acsalaska.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Nov 20 00:31:14 2008

This archive was generated by hypermail 2.1.8 : Thu Nov 20 2008 - 00:31:14 AKST