permissions

hi,

can anyone let me know the difference between the permissions 0755 and 04755?
whspiderAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
The SUID are set. On a directory it means the group or the owner of this directory are used if a ned file is created.

See http://en.wikipedia.org/wiki/Sticky_bit
0
subratabiswasCommented:
The difference between the above two is 4 at the beginning, which is called the 'set user or group ID on execution' bit. On being set on an executable / directory, this allows the user to assume the effect userid of the owner of the executable / directory. Following is a quick test  / example.

1) Create a c file with the following contents and compile it to a.out:

#include <stdio.h>
main() {
        FILE *outfile;
        outfile = fopen("Test", "w");
        fprintf(outfile, "Hello\n");
}


2) Chown the ownership of the executable file a.out to a test user

chown root:root a,out

3) Change the permission so that other people can execute it normally:

chmod 755 a.out

4) Execute the file as a user other than the owner of a.out above, and see the permissions / ownership of the newly created file "Test" in your current folder.

5) Change the permission of the file to set the special privilege bit, you may be required to be root for this:

chmod 4755 a.out

6) Remove the file "Test" created earlier from your local directory, then execute a.out to get "Test" created again. Check the permission and ownership of the file

You will observe that in the first instance, the file "Test" is created with the ownership belonging to the user executing the file a.out.
In the second instance, the ownership of the file will be to the user that owns the executable, not the user executing the file.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
woolmilkporcCommented:
For files:
04nnn = SUID bit - program will be executed with the effective rights of the owning user, not the user starting it.
02nnn = SETGID bit - program will be executed with the effective rights of the owning group, not the group where the user starting it is in.
01nnn - SAVE-TEXT - sets the save-text attribute.

For directories:
04nnn = SUID bit - ignored for directories
02nnn = SETGID bit - new files and subdirectories created within the directory will inherit its group id, not the group id of the user creating them.
01nnn = Sticky bit - only file owners can link or unlink files in the specified directory.

wmp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.