[NTLUG:Discuss] how do I get a list of files that are set read-only?
Carl Haddick
sysmail at glade.net
Thu Jan 30 20:15:59 CST 2003
Seems like a nice scripting exercise if you want to automate the
process, but be careful on a live system.
You can find all the readonly files in your 'home' directory, for
example, with this command:
find /home ! -perm +222
You'll need to have read permissions in all the subdirectories for that
to work, so this might be a command to run as root.
Anyway, the first find arg is the path to start the search from, the
bang character (!) indicates a logical not, the -perm is the option to
search based on file permissions, and '+umask' is a mask of bits.
Without the '!', -perm +bits will look for files that have any of the
bits set that are also set in the -perm argument.
With the '!', it will trigger on files that have none of the bits
included in the mask set. 222 is the bits for owner write, group write,
and all the other bozos write.
Did I get that right?
Regards,
Carl
On Thu, Jan 30, 2003 at 07:49:27PM -0600, Jack Snodgrass wrote:
>
> I have a list of files ( lots of files... lots of sub directories. ) and
> I need to
> find out which ones are read-only. find is supposed to have a -perm
> option
> that seems like it would help, but I can't figure out how to run it.
>
> I could do a ls -lR and grep for something like -r-* ro dr-* but
> ls -lR would only tell me the file name and not the full path.
>
> I need to get a list of files ( full path ) that are read only.
>
> I accidently did a chmod +w on the files. I didn't want to do that.
> I have another, similar directory that is set up like I need. I would
> like to use that as a 'template' so to speak... get a list of files that
> are read only so I can fix the directory that I messed up.
>
> Thanks - jack
>
> --
> Jack Snodgrass <jack+ntlug at mylinuxguy.net>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
--
Carl Haddick http://www.glade.net
GladeNet Communications alt email: support at glade.net
200 South Red River (254) 562-6381
Mexia, TX 76667 (877) 373-3882
More information about the Discuss
mailing list