1847213 Members
3441 Online
110263 Solutions
New Discussion

Re: Small daught

 
Deepak Kulkarni
Regular Advisor

Small daught

Hi All,

Why directories has 777 and files are having 666 permission.

Regards
Deepak
12 REPLIES 12
Rajesh SB
Esteemed Contributor

Re: Small daught

Hi,

Which directories and files permission are your talking about?
Give more details.

Regards,
RAjesh
Pedro Cirne
Esteemed Contributor

Re: Small daught

Hi,

The files created have their permissions default set by the command umask. Check the man pages of umask for details.

Enjoy :)

Pedro
Simon Hargrave
Honored Contributor

Re: Small daught

Do you ask of a particular file, or in general?

In general: -

777 on a directory means anyone can read, write and search the directory. (the execute bit on a directory means you can see the contents of the directory).

666 on a file means everyone can read and write the files.
Deepak Kulkarni
Regular Advisor

Re: Small daught

Thanks for the response.

I mean why directories will have rwxrwxrwx and why files will have rw-rw-rw in generel

Thanks
Deepak
Rajesh SB
Esteemed Contributor

Re: Small daught

Hi Deepak,

The effective file permissions are depends on the umask setting.
Typically used umask is 022.


Regards,
Rajesh
Rajesh SB
Esteemed Contributor

Re: Small daught

Hi Deepak,

This recent disscussed link may help you for your doubts.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=123778

Regards,
Rajesh

PS:Don't forget to give points.
Deepak Kulkarni
Regular Advisor

Re: Small daught

Hi Simon,

Why files will not be having 777 i.e rwxrwxrwx permissions?

Regards
Deepak
Juan Manuel López
Valued Contributor

Re: Small daught

Hi.
The x permision allow access to directory instead the rw on files permit to read an write that files, not execute it.
I Hope This Help You.
Juanma
I would like to be lie on a beautiful beach spending my life doing nothing, so someboby has to make this job.
MarkSyder
Honored Contributor

Re: Small daught

The x permissions on a file are execute - these will only apply to program files (e.g. shell scripts). Text files do not need execute permission.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Deepak Kulkarni
Regular Advisor

Re: Small daught

thanks to all
Simon Hargrave
Honored Contributor

Re: Small daught

the "x" permission on a file is only useful if it is executable, ie it is a shell script, perl, binary program etc. if the file is data, text, source code etc there is no reason to have the "x" permission set on a file.

I should also note that in general, unless absolutely neccessary you should avoid having files with full worlds writability (rw-rw-rw-). You should aim for rw-rw-r-- at least, depending on your application.

umask as others have mentioned is used to set the default permissions mask for new files. I would recommend you read the man page thoroughly to understand it. It can be a strange one to understand if you're new to it, but it is very important in maintaining a secure system.
Leif Halvarsson_2
Honored Contributor

Re: Small daught

Hi,
files can can 777 permissions as well but the behaviour is different.

try the following:

create a simple file containing the command "ls -l".

set permissions to 666.
chmod 666 yourfile
try ./yourfile (you will get an error)
chmod 777 yourfile
try again ./yourfile (the command ls -l is executed)