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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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. > |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
>>>>> "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 |
|
|||
|
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 |