Bluehost.com Web Hosting $6.95

File permissions

This is a discussion on File permissions within the Linux Networking forums, part of the Linux Forums category; Hi all, I'm pretty new to Linux and looking for some help with file permissions. I have a folder ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-12-2006
gdf1903@hotmail.com
 
Posts: n/a
Default File permissions

Hi all,

I'm pretty new to Linux and looking for some help with file
permissions.

I have a folder called Folder1. Folder1 has other folders and files
inside it.

I'd like to amend the permissions for Folder1 and everything inside it
so that everyone has read/write access.

Is it possible to do this with one command?

Thanks for any help.

Reply With Quote
  #2 (permalink)  
Old 09-12-2006
Ali Al-Shabibi
 
Posts: n/a
Default Re: File permissions

Hi,

Permissions are different for folder and files...

* read determines if a user can view the directory's contents,
i.e. do ls in it.
* write determines if a user can create new files or delete
file in the directory. (Note here that this essentially means
that a user with write access toa directory can delete files in
the directory even if he/she doesn't have write permissions for
the file! So be careful with this.)
* execute determines if the user can cd into the directory.

and for files it's as the permissions state.

The command you are looking for is:

chmod -R +rw <dir_name>

Cheers,

Ali


gdf1903@hotmail.com wrote:
> Hi all,
>
> I'm pretty new to Linux and looking for some help with file
> permissions.
>
> I have a folder called Folder1. Folder1 has other folders and files
> inside it.
>
> I'd like to amend the permissions for Folder1 and everything inside it
> so that everyone has read/write access.
>
> Is it possible to do this with one command?
>
> Thanks for any help.
>

Reply With Quote
  #3 (permalink)  
Old 09-12-2006
Floyd L. Davidson
 
Posts: n/a
Default Re: File permissions

gdf1903@hotmail.com wrote:
>Hi all,
>
>I'm pretty new to Linux and looking for some help with file
>permissions.


Great! The first thing you need to know about is *RTFM*. (and
despite rumors, the "F" is not "Fine"...)

It would actually be a good idea to spend a few hours looking at
the man pages for virtually everything that is in /bin and
/sbin, just to find out what can be done. You don't need to
remember details, but it's nice to have some idea where to
start.

For example, the answers to your questions are relatively easy
to get by simply reading the man pages for "chmod" and "find".

>I have a folder called Folder1. Folder1 has other folders and files
>inside it.


Actually what you have is a _directory_ named "Folder1", which
contains other directories as well as files.

>I'd like to amend the permissions for Folder1 and everything inside it
>so that everyone has read/write access.
>
>Is it possible to do this with one command?


Easy.

chmod -R 777 /path_to/Folder1

No that you necessarily want to do it the easy way though! That
also makes every file executable, which you probably don't want.
But you do want that bit set for all of the directories (on
directories the execute bit allows access).

So the question then becomes how to distinguish between files
and directories as things get changed. The /find/ program makes
that almost easy.

First, set permissions as needed on all of the directories and
sub-directories,

find /path_to/Folder1 -type d -exec chmod 777 {} \;

Then change all of the files to the desired permissions,

find /path_to/Folder1 -type f -exec chmod 666 {} \;

*Do* read at leasst the man pages for both /chmod/ and for
/find/ before doing that.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Reply With Quote
  #4 (permalink)  
Old 09-13-2006
David Schwartz
 
Posts: n/a
Default Re: File permissions


gdf1903@hotmail.com wrote:
> Hi all,
>
> I'm pretty new to Linux and looking for some help with file
> permissions.
>
> I have a folder called Folder1. Folder1 has other folders and files
> inside it.
>
> I'd like to amend the permissions for Folder1 and everything inside it
> so that everyone has read/write access.
>
> Is it possible to do this with one command?
>
> Thanks for any help.


Nobody got it right. What you want is most likely:

chmod -R a+rwX Folder1

DS

Reply With Quote
  #5 (permalink)  
Old 09-13-2006
gdf1903@hotmail.com
 
Posts: n/a
Default Re: File permissions

Thanks for everyones help. I think the one from David was what I
needed, seemed to work as expected anyway! Thanks again.

Reply With Quote
  #6 (permalink)  
Old 09-19-2006
Lee Sau Dan
 
Posts: n/a
Default Re: File permissions

>>>>> "Floyd" == Floyd L Davidson <floyd@apaflo.com> writes:


Floyd> gdf1903@hotmail.com wrote:
>> Hi all,
>>
>> I'm pretty new to Linux and looking for some help with file
>> permissions.


Floyd> Great! The first thing you need to know about is *RTFM*.
Floyd> (and despite rumors, the "F" is not "Fine"...)
...
(see far down below)



>> I'd like to amend the permissions for Folder1 and everything
>> inside it so that everyone has read/write access.
>>
>> Is it possible to do this with one command?


Floyd> Easy.

Floyd> chmod -R 777 /path_to/Folder1

Floyd> No that you necessarily want to do it the easy way though!
Floyd> That also makes every file executable, which you probably
Floyd> don't want. But you do want that bit set for all of the
Floyd> directories (on directories the execute bit allows access).

In that case, you should have recommended the following instead:

chmod -R a+-rwX /path_to/Folder1

Note the uppercase "X".

Learn to use symbolic permission specifiers. They're easier to
memorize and more versatile than the numeric octal codes. esp. for
people who aren't that good with numbers, let alone octal arithmetics.


Floyd> So the question then becomes how to distinguish between
Floyd> files and directories as things get changed. The /find/
Floyd> program makes that almost easy.

What an overkill! "chmod" can do that with the permission specifier
"X". Have you read the man page yourself?


--
Lee Sau Dan +Z05biGVm- +AH4-{@nJX6X+AH4-}

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/+AH4-danlee
Reply With Quote
  #7 (permalink)  
Old 09-19-2006
Floyd L. Davidson
 
Posts: n/a
Default Re: File permissions

Lee Sau Dan <danlee@informatik.uni-freiburg.de> wrote:
>>>>>> "Floyd" == Floyd L Davidson <floyd@apaflo.com> writes:

>
> Floyd> gdf1903@hotmail.com wrote:
> >> Hi all,
> >>
> >> I'm pretty new to Linux and looking for some help with file
> >> permissions.

>
> Floyd> Great! The first thing you need to know about is *RTFM*.
> Floyd> (and despite rumors, the "F" is not "Fine"...)
> ...
>(see far down below)


And note what I said it means!

> Floyd> chmod -R 777 /path_to/Folder1
>
> Floyd> No that you necessarily want to do it the easy way though!
> Floyd> That also makes every file executable, which you probably
> Floyd> don't want. But you do want that bit set for all of the
> Floyd> directories (on directories the execute bit allows access).
>
>In that case, you should have recommended the following instead:


You don't read well Lee. The above is *not* a recommendation. It is
an example to demonstrate something, which is an invitation to read the
man pages to learn *exactly* which options etc would be appropriate.

> chmod -R a+-rwX /path_to/Folder1
>
>Note the uppercase "X".
>
>Learn to use symbolic permission specifiers. They're easier to
>memorize and more versatile than the numeric octal codes. esp. for
>people who aren't that good with numbers, let alone octal arithmetics.


That may well be true, but since you are trying to accomplish
something entirely different than I was, there actually was a
good reason for not mentioning that in my post.

> Floyd> So the question then becomes how to distinguish between
> Floyd> files and directories as things get changed. The /find/
> Floyd> program makes that almost easy.
>
>What an overkill! "chmod" can do that with the permission specifier
>"X". Have you read the man page yourself?


Not overkill; just a much more versatile way. If you carefully
read the man page, you will see that your command line does not
do the same thing that I am suggesting can be done. A subtle
difference, but it just depends on what the intended results
are.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:33 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0