LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-29-2002, 10:42 PM   #1
MelLinux
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Rep: Reputation: 0
How to conver Permissions? Help


guys I need your help, I want to convert the following:

Convert the following symbolic permissions to numeric:

eg: r w x r w x r w x = 777

r - s r - x - - -

r w s r w s r w t
 
Old 09-29-2002, 10:56 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
r-Sr-x-- would be chmod 4450
rwsrwsrwt is chmod 7777
 
Old 09-29-2002, 11:24 PM   #3
MelLinux
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks Neo, by the way can you please give more info. how to convert this. Thanks
 
Old 09-29-2002, 11:35 PM   #4
MelLinux
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Well, I think that if you can tell me how to do this two, I will get an idea:

4755
5755
 
Old 09-29-2002, 11:43 PM   #5
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
the permissions are interpreted by linux in octal numbers (from 0 to 7), if we start with basics, the octal number can be represened with 3-bit binary number (0 or 1), so lets see
octal binary
0 000
1 001
2 010
3 011
------------------
7 111
Now, every permission bit can be turned on with 1 and turned off with 0 in binary, so lets see
rwx is 111 (turn on r -> 1, turn on w -> 1 and turn on x -> 1) in octal it is 7

Part II (Intermediate).
s, S, t, T permissions are given a special attention
s - suid
S - sgid
and t and T are sticky bits
suid bit is 4, sgid is 2 and sticky bit is 1
If you want a program to run in a user space of the owner of the file suid bit is given, if you want it to run in user space of group - sguid bit is presented, and if you want a file to be created in the user space of the current user, then sticky bit makes sence, for instance /tmp directory has a sticky bit with full writtable, readable and executable permissions - what it means that you as a user can create files in the /tmp that will only can be at least writtable by the user they were created and nobody else except root.
Now, how would you set it up? well you give forth octal number to chmod directive (the first number), in reality it is always four octal digits in the permission set (if none of the suid, sgid or sticky bit is used that number is simply 0, so chmod 755 is equivalent to chmod 0755).
so to create sticky bit permissions on the directory (it is mostly used on drectories) you would use
chmod 1777 /tmp
so it will look like
drwxrwxrwt
I hope you are not confused.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
how to conver binary to opcode ? ssg14j Linux - General 1 07-29-2005 02:42 PM
permission ... permissions .... permissions alaios Linux - General 1 05-31-2005 04:16 AM
how can conver and use .ttf fonts in linux satishpatel Linux - Software 8 04-13-2004 06:01 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration