[aklug] Re: regarding permission bits

From: Christopher Howard <choward@indicium.us>
Date: Thu Nov 20 2008 - 14:21:03 AKST

On Thu, 20 Nov 2008, bryanm@acsalaska.net wrote:

> 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.
>

Thanks.

>> 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:
>

Well, part my idea in understanding how to directly manipulate the file
type would be to better understand how the layout and location of the
appropriate bits worked. Another idea would be able to learn how to
generate such file types without relying on an intermediate GNU utlity,
which could be more efficient inside of a program, I imagine.

I've been learning lately in C how to modify individual bits of stored
data, and was exploring various possibilities of how I might apply this
knowledge.

> 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.
>
>

--
Christopher Howard
choward@indicium.us
http://www.indicium.us
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Nov 20 14:20:52 2008

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