Dear Friends,
In open system call we have three arguments.
First: file descriptor
Second: flag
Third: Mode
for example we use
open (fd, O_RDWR | O_CREAT , 0764)
Here i used 764 only but it doesn't work fine. If i use 0764 it worked fine.
I know
7 (File owner 4-Read 2-Write 1-Execute)
6 (File owner 4-Read 2-Write )
4 (File owner 4-Read 2-Write 1-Execute)
But what is that 0 before the 764 ??
Advance Thanks
Rengaraj.R
6 8631
The zero is in the position of the "sticky bit". If it's zero, the user has normal permissions but if it's set to 1, then the user can only delete or rename files they own and have write permission for the directory. This bit can only be set on directories.
The zero is in the position of the "sticky bit". If it's zero, the user has normal permissions but if it's set to 1, then the user can only delete or rename files they own and have write permission for the directory. This bit can only be set on directories.
Thank You Sir
Dear Friends,
In open system call we have three arguments.
First: file descriptor
Second: flag
Third: Mode
for example we use
open (fd, O_RDWR | O_CREAT , 0764)
Here i used 764 only but it doesn't work fine. If i use 0764 it worked fine.
I know
7 (File owner 4-Read 2-Write 1-Execute)
6 (File owner 4-Read 2-Write )
4 (File owner 4-Read 2-Write 1-Execute)
But what is that 0 before the 764 ??
Advance Thanks
Rengaraj.R
I thought the leading 0 indicated an octal numeric constant with 0764 represents rwxrw-r---, see http://rabbit.eng.miami.edu/info/fun...ixio.html#mode
the constant 764 would be a decimal numeric value
That's true but when setting the system you refer to the first bit as 0 or 1. A C coder has to adjust for that.
The '0' in 0764 is for the use of "sticky bit", "setuid", "setgid" etc...
here is how that bit is set
4 - setuid
2 - setgid
1 - sticky bit setuid will yield a file that will be executed as the "owner" regardless of the user that executes the file setgid will yield the same as setuid but with "group" instead of owner.
you can typically see the use of sticky bit on /tmp
drwxrwxrwt .... /tmp
this allows for only the "owner" of the file to manipulate a file in a world writable directory... among other things.
example 4755 would yeald an ls -l that looks like
-rwsr-xr-x ..... filename
Horace1 is, in fact, correct.
This is due both to the way that permissions are specified in Linux as well as the way numbers are handled in C. In linux, file permissions are set using an octal notation. When you see the number 755, the internal representation is not actually the value seven hundred fifty-five decimal, rather, it is 493 decimal.
Incorporating the leading zero, allows a programmer to maintain a numbering schema consistent with the way a user would set permissions on the command line - octal.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ST |
last post by:
This is my other error when I click on Immunoflourescence. I believe this is
related to the other error I just posted (Input string was not in a correct
format.) Please let me know if you have...
|
by: Marshall Dudley |
last post by:
When I do the following line in Netscape, the popup loads as it should,
but the parent window usually, but not always, reloads as well.
<a href="#"...
|
by: Charles F McDevitt |
last post by:
I'm trying to upgrade some old code that used old iostreams.
At one place in the code, I have a path/filename in a wchar_t string
(unicode utf-16).
I need to open an ifstream to that file. ...
|
by: Jorge Ponte |
last post by:
hi
I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In
that WUC I want have a textbox and a button. I want to click on the button
and open a popup (I use javascript for...
|
by: Daniel Walzenbach |
last post by:
Hi,
Imagine the following situation: I have an asp.net
application which allows uploading files to a SQL Server
2000 database (Files are stored as type "images"). As a
next step I would like to...
|
by: Karan |
last post by:
I am calling finalize when form2 loads and deactivates form1 which closes
form1. However, same thing is not happening in form2 because finalize is
already called. Does anybody has solution to it....
|
by: Chris Johnson |
last post by:
I have what seems to be such a simple thing yet I cannot figure out how
to do it.
I am using a streamwriter to build a text file. At the end of the
process I want to open that same text file in...
|
by: mix01 |
last post by:
Hi,
I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help.
Many thanks,
Mix01
Version of the program
|
by: magicman |
last post by:
Is difference lies in the fact that fopen part of c library and
platform in-depended, whereas open is a system call? what about
functionalities?
thx
|
by: Bill David |
last post by:
I know it's very strange to do that since we have the file name when
we call:
int open(const char *pathname, int oflag,...);
And we can store the file name for later usage.
But I just wonder if...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |