473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CHMOD- Permissions

In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.
Jul 11 '07 #1
4 2652
skyy
109 100+
In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.

Hi..

Are u sure google doesnt explain?

Anyway a file's permission is group into user-group-others
For each file there is read(r) write(w) and executable(x) permission for each group. To turn on the permission, u just have to set it to '1'. Hence a 777 will allow all user(user-group-others) all the permission.

A digit '7' is represent by "111" in binary. which specifies the permission for read(r) write(w) and executable(x).

hope that helps...
Jul 11 '07 #2
hi

I would not suggest you to use 777 anytime. Any file with 777 permission can be accessed, modified or deleted by anyone.

Permissions are given as owner-group and others. For each of the 3 above, you can set on or off, read, write and executable permissions.
[owner]rwx[group]rwx[others]rwx
can be specified using its binary code, r=1 means read permission is set.
So it you set 755, you are allowing to read, write and execute and any others can only read or execute. [101 is 5].

For a file, read and write permissions are self-explanatory. Execute permission is needed only when you have an executable file. scripts,etc

For a directory, read permission allows you to enter the directory. Execute permission lets you to list the files, and write permission is needed to create or delete any file in the directory
Jul 11 '07 #3
numberwhun
3,509 Expert Mod 2GB
In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.
Here is the easiest way that I know of, to explain the number based permissions in *nix.

The permissions look like this:

rwx rwx rwx

This is noticably broken down into 3 groups. The first group, on the left, is Owner, the middle group is...well.....Group, and the group on the right is User.

If you think of them as numbers, then it would look like this:

421 421 421

Where "4" stands for read, "2" stands for write and "1" stands for execute.

Lets say you want permissions of "rw- rw- rw-", you would convert that to numbers as such: "42- 42- 42-", then, add each group up to obtain the number: 666.

So, to set permissions of rw- rw- rw-, you would need to do a "chmod 666 file".

I hope this helps as I know this has helped others that I have explained it to.

Regards,

Jeff
Jul 12 '07 #4
Motoma
3,237 Expert 2GB
I have a link for you.
Jul 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Fronq | last post by:
Hi ! The entire (PHP-) world seems to have the same problem: Many providers let you upload as one user, lets say "ftpuser", yet then apache and your script will run as another user e.g....
5
by: Daniel | last post by:
Hi, From what I read from the PHP manual, chmod on a Windows platform should have no effect, and that seems totally normal (unless someone on sourceforge has a windows port of that!). I...
6
by: Ask Josephsen | last post by:
Hi NG If I write the following: <?php $file="myfile.JPG"; if ( getmyuid()==fileowner ( $file ) ) { chgrp ( $file, getmygid() ); chown ( $file, getmyuid() );
1
by: Xuan Yuan | last post by:
I'm using Windows XP Professional and have no FTP installed. Instead, I use Command Promt. I need to CHMOD a PHP file, so I type "CHMOD 775 file-path",but get "'CHMOD'is not recognized as an internal...
1
by: Michael Lubavin | last post by:
Hi, I am having a perl cgi script that needs to be able to create and write a new file. Is there a way I can use chmod within the script to give temporary world access to my directory, and then...
4
by: Ian N | last post by:
Hi i'm having a problem with file permissions of upload, they appear to be being set to only readable by the administrator, so anyone browsing the site gets a 403 forbidden error when they try and...
3
by: webhead | last post by:
I have a web where users can upload photos, but they want to also be able to delete them. The directory can have chmod changes but it won't let me chmod the files and unlink them. I'm assuming it...
3
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if...
1
nallinattu
by: nallinattu | last post by:
How do I change CHMOD of a folder / file through a PHP script ? (I do not want it done by an FTP client ) Many a times I have had problem to change CHMOD of a file but when I empty the folder and...
1
by: lawrence k | last post by:
I've a simple script to transfer some files from one domain to another, with both domains living on the same server. The files in both directories are already chmod 777. Yet after transfer, I try...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.