Change permissions of files to -xw +r for all other users

Change permissions of files to -xw +r for all other users

am 26.05.2005 19:44:36 von Rhys Hardwick

Hey there,

I know this may be a case of RTM, but I am getting confused on it.

I want to change the permissions of all the files in my home folder to read
only for all users but myself, but to leave directories executable so that
they can be opened. I have had difficulty doing this for only other users,
and have ended up -xw for myself as well, even tyring many variations of the
-o tag. Any help would be fantastic.

--
Rhys Hardwick

-----------------------------------------------------
| rhys@rhyshardwick.co.uk | www.rhyshardwick.co.uk |
| PGP-id - 0x63AB126D | |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| Windows: Just another pain in the glass. |
*****************************************************


___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 26.05.2005 20:36:46 von mailing-lists

On Thu, 26 May 2005, Rhys Hardwick wrote:

> Hey there,
>
> I know this may be a case of RTM, but I am getting confused on it.
>
> I want to change the permissions of all the files in my home folder to read
> only for all users but myself, but to leave directories executable so that
> they can be opened. I have had difficulty doing this for only other users,
> and have ended up -xw for myself as well, even tyring many variations of the
> -o tag. Any help would be fantastic.

What program are you talking about ? The program `find` perhaps ? Or using
just `chmod` ?

If you want to find any file in the current directory not owned by you
then:

~: find . -type f ! -user imyselfandi -maxdepth 1

The `!' exclamation mark means NOT .

If you want to change the permission of all files which were found by the
previous command you could tell find to exec chmod with the desired
permissions, for example:

~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;

Or you could use a command line shell filter:

~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do
chmod 0744 ${FILE} ; done

Note; the command is actualy one line, the format breaks because of the
text width in the e-mail message..

Hope this answers your question ...

> --
> Rhys Hardwick

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 26.05.2005 21:21:43 von Rhys Hardwick

I was just using chmod. This helps. I can use find to only select files, not
directories, and change the permissions. However, the real question is how
to make chmod not alter the permissions for the files owner, but to remove
write and exectute permissions for group and others. That is the bit that
has stumped me.

Cheers,

Rhys


On Thursday 26 May 2005 19:36, J. wrote:
> On Thu, 26 May 2005, Rhys Hardwick wrote:
> > Hey there,
> >
> > I know this may be a case of RTM, but I am getting confused on it.
> >
> > I want to change the permissions of all the files in my home folder to
> > read only for all users but myself, but to leave directories executable
> > so that they can be opened. I have had difficulty doing this for only
> > other users, and have ended up -xw for myself as well, even tyring many
> > variations of the -o tag. Any help would be fantastic.
>
> What program are you talking about ? The program `find` perhaps ? Or using
> just `chmod` ?
>
> If you want to find any file in the current directory not owned by you
> then:
>
> ~: find . -type f ! -user imyselfandi -maxdepth 1
>
> The `!' exclamation mark means NOT .
>
> If you want to change the permission of all files which were found by the
> previous command you could tell find to exec chmod with the desired
> permissions, for example:
>
> ~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;
>
> Or you could use a command line shell filter:
>
> ~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do
> chmod 0744 ${FILE} ; done
>
> Note; the command is actualy one line, the format breaks because of the
> text width in the e-mail message..
>
> Hope this answers your question ...
>
> > --
> > Rhys Hardwick
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs

--
Rhys Hardwick

-----------------------------------------------------
| rhys@rhyshardwick.co.uk | www.rhyshardwick.co.uk |
| PGP-id - 0x63AB126D | |
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
| Windows: Just another pain in the glass. |
*****************************************************




___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 26.05.2005 22:50:39 von mailing-lists

On Thu, 26 May 2005, Rhys Hardwick wrote:

> I was just using chmod. This helps. I can use find to only select files, not
> directories, and change the permissions. However, the real question is how
> to make chmod not alter the permissions for the files owner, but to remove
> write and exectute permissions for group and others. That is the bit that
> has stumped me.

Use a `0' a.k.a. zero with `chmod` in the last position

If I would use the command `ls -l` on an arbitrary file in my directory:
-rw-rw-r-- 1 jason donovan 201 Apr 23 04:14 todo.txt

Now you can see that the user `jason' has [r]ead[w]rite permissions the
same goes for the group named `donovan' and all other users have only
[r]ead permissions .

chmod 0660 todo.txt

-rw-rw---- 1 jason donovan 201 Apr 23 04:14 todo.txt

Now the permissions for jason and donovan stayed the same; except for all
other users [the world] which have no permissions.

Hope that helped...

J.

> Cheers,
>
> Rhys

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 26.05.2005 23:00:22 von mailing-lists

On Thu, 26 May 2005, Rhys Hardwick wrote:

> I was just using chmod. This helps. I can use find to only select files, not
> directories, and change the permissions. However, the real question is how
> to make chmod not alter the permissions for the files owner, but to remove
> write and exectute permissions for group and others.


> That is the bit that has stumped me.

Ok, I was just reading your message again.. and I got it this time, You
are mixing up symbolic mode with the octal mode.. oeff.. Sorry.. I'ts late
here already.. ;-)

the command:
~: chmod o-rwx todo.txt

Will remove rwx from the third field e.g. others or `the world' . The `-'
hyphen does not signal an option but stands for remove, instead of the
hyphen `-' you could als use the plus `+' sign to add rights.
The first character in this case is the `o' of others.. you could also use
the u etc.. that's explained in the manual page..

~: chmod u-rwx todo.txt

J.

> Cheers,
>
> Rhys
>
>
> On Thursday 26 May 2005 19:36, J. wrote:
> > On Thu, 26 May 2005, Rhys Hardwick wrote:
> > > Hey there,
> > >
> > > I know this may be a case of RTM, but I am getting confused on it.
> > >
> > > I want to change the permissions of all the files in my home folder to
> > > read only for all users but myself, but to leave directories executable
> > > so that they can be opened. I have had difficulty doing this for only
> > > other users, and have ended up -xw for myself as well, even tyring many
> > > variations of the -o tag. Any help would be fantastic.
> >
> > What program are you talking about ? The program `find` perhaps ? Or using
> > just `chmod` ?
> >
> > If you want to find any file in the current directory not owned by you
> > then:
> >
> > ~: find . -type f ! -user imyselfandi -maxdepth 1
> >
> > The `!' exclamation mark means NOT .
> >
> > If you want to change the permission of all files which were found by the
> > previous command you could tell find to exec chmod with the desired
> > permissions, for example:
> >
> > ~: find . -type f ! -user imyselfandi -maxdepth 1 -exec chmod 0744 '{}' \;
> >
> > Or you could use a command line shell filter:
> >
> > ~: find . -type f ! -user imyselfandi -maxdepth 1 | while read FILE ; do
> > chmod 0744 ${FILE} ; done
> >
> > Note; the command is actualy one line, the format breaks because of the
> > text width in the e-mail message..
> >
> > Hope this answers your question ...
> >
> > > --
> > > Rhys Hardwick
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.linux-learn.org/faqs
>
> --
> Rhys Hardwick
>
> -----------------------------------------------------
> | rhys@rhyshardwick.co.uk | www.rhyshardwick.co.uk |
> | PGP-id - 0x63AB126D | |
> |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
> | Windows: Just another pain in the glass. |
> *****************************************************
>
>
>
>
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>

Thursday, May 26 22:56:06



--
Don't worry Ma'am. We're university students, - we know what we're doing.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 27.05.2005 19:17:45 von Rhys Hardwick

> Hope that helped...
>
> J.
>

Gotcha, thanks for the help. I did figure out that bit, it was the part about
only selecting files, so when I -x 'd them, I wouldn't take list privileges
away from the directories.

Thanks,

Rhys




___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Change permissions of files to -xw +r for all other users

am 09.06.2005 18:11:29 von Stephen Samuel

Rhys Hardwick wrote:

>Hey there,
>
>I know this may be a case of RTM, but I am getting confused on it.
>
>I want to change the permissions of all the files in my home folder to read
>only for all users but myself, but to leave directories executable so that
>they can be opened. I have had difficulty doing this for only other users,
>and have ended up -xw for myself as well, even tyring many variations of the
>-o tag. Any help would be fantastic.
>
>
What it sounds like you want to do is set permissions to read-only for
others and group.

The proper command would be:

find ~ -type f -print0 | xargs -0 chmod og=r

The '0' causes each filename to be terminated with a null ('\0') rather
than a
newline (which is actually legal in a filename)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

oops Re: Change permissions of files to -xw +r for all other users

am 13.07.2005 13:52:53 von Stephen Samuel

Stephen Samuel wrote:
> Rhys Hardwick wrote:
>
>> Hey there,
>>
>> I know this may be a case of RTM, but I am getting confused on it.
>>
>> I want to change the permissions of all the files in my home folder to
>> read only for all users but myself, but to leave directories
>> executable so that they can be opened. I have had difficulty doing
>> this for only other users, and have ended up -xw for myself as well,
>> even tyring many variations of the -o tag. Any help would be fantastic.


> find ~ -type f -print0 | xargs -0 chmod og=r

On second thought:
Presuming that you really just want to remove write access, I'd
try 'chmod og-w' or 'chmod og-wx'

That would remove the write bit or the write and execute bits,
but not add the read bit. There tend to be some files in a users
directory that you don't want readable all (like ssh private keys,
cert files etc.)

--
Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
http://www.bcgreen.com/~samuel/
Powerful committed communication. Transformation touching
the jewel within each person and bringing it to light.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs