On Tue, 2005-05-17 at 14:39 -0500, israel.garcia at cimex.com.cu wrote:> List, How can I check the permissions of all the files of my CentOS > server? > I'm looking for some kind of report with this information.. > Is there some command? Some tool?rpm -Va -- Ignacio Vazquez-Abrams <ivazquez at ivazquez.net> http://centos.ivazquez.net/ gpg --keyserver hkp://subkeys.pgp.net --recv-key 38028b72 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.centos.org/pipermail/centos/attachments/20050517/aa5fa160/attachment-0004.sig>
israel.garcia at cimex.com.cu
2005-May-17 19:39 UTC
[CentOS] check permissions of all my files!
List, How can I check the permissions of all the files of my CentOS server? I'm looking for some kind of report with this information.. Is there some command? Some tool? Regards, Israel
Bryan J. Smith
2005-May-17 20:52 UTC
[CentOS] check permissions of all my files! -- find example, short script
On Tue, 2005-05-17 at 14:39 -0500, israel.garcia at cimex.com.cu wrote:> List, How can I check the permissions of all the files of my CentOS > server? I'm looking for some kind of report with this information.. > Is there some command? Some tool?Here is a command that will give you the entire list of all files on your system in the format: "user:group mode path" $ find / -printf "%u:%g %m %p\n" Note that it _will_ cross filesystems, including any NFS mounts. Use the "-mount" option to keep it from crossing filesystems. If you want to create a script to reapply all standard UNIX permissions to all files in a tree, here is a script (saveperm.sh) that outputs such a script: #!/bin/bash mydir="${1}" if [ "${mydir}" == "" ]; then echo "Syntax: " echo " saveperm.sh (path)" echo "NOTE: saveperm.sh does not cross filesystems" echo "NOTE: saveperm.sh does not handle spaces in filenames" exit 127 fi if [ ! -d "${1}" ]; then echo "${1} is not a directory" exit 127 fi echo "#!/bin/bash" echo "# Created by saveperm.sh" echo "# Run from `pwd` targeting ${mydir}" echo "" for mypath in `find ${mydir} -mount`; do find "${mypath}" -maxdepth 0 -printf "chown %u:%g %p\n" find "${mypath}" -maxdepth 0 -printf "chmod %m %p\n" done You'd typically run it with (examples): $ saveperm.sh /abspath > /perms_abspath.sh [ save absolute path /abspath to a script /perms_abspath.sh ] $ saveperm.sh . > ../perms_subdir.sh [ save perms on current directory to script perms_subdir.sh in parent ] The above script outputs (echos) a script to the screen. You can redirect that into a file for execution later. Note that the above script will NOT handle spaces in filenames! I have found different bash versions to be exceedingly difficult in handling spaces in filenames when returning from a find. Setting IFS="\n" typically doesn't work well or consistently. I would use an equivalent tcsh script instead of dorking with bash.** -- Bryan **NOTE: Ed Schaffer keeps bothering me for a script for his column, so I might just have to just write the tcsh version. ;-> -- Bryan J. Smith b.j.smith at ieee.org ----------------------------------------------------------------- Beware of those who define their preference in terms of hate of another option, and not on the positive merits of their selection
cd / ls -laR Regards Bogdan --- israel.garcia at cimex.com.cu wrote:> List, How can I check the permissions of all the > files of my CentOS > server? > I'm looking for some kind of report with this > information.. > Is there some command? Some tool? > > Regards, > Israel > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
israel.garcia at cimex.com.cu
2005-May-18 03:05 UTC
[CentOS] RE: check permissions of all my files!
> I'm looking for some kind of report with this information.. > Is there some command? Some tool?>>Define "check". I have no idea what you mean, so I'm going to take >>a couple of guesses. Don't take this the wrong way, but you've ....I mean, How do I know if some of my users changed the original permissions of any of my files? I mean, How do I know if my files have the correct (original)permissions? I'd like, if it's possible, some kind of report daily by email or in some log file with this information...? Tripwire do that? Thanks for your soon answers! Regards, Israel