Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to log all file that has been move,chmod,chown? Post 302876517 by jim mcnamara on Monday 25th of November 2013 07:32:41 AM
Old 11-25-2013
This is confusing. Let's say you want to block access to /path/to/files, then find all the chmod (or created) and modified changes for the last 24 hours.

Code:
#Run as root to block other  and group access:
chmod 700 /path/to/files   # sets  read + execute off  [you are root (or owner)] 
# now find regular files that have either been "chmoded" 
echo 'start chmod, created list' 
find /path/to/files -type f -atime -1 -exec ls -l {} \;
echo 'end chmod, created list'
# now find files that have been modified in the last day
echo 'start recently modified list' 
find /path/to/files -type f -mtime -1 -exec ls -l {} \;
echo 'end recently modified list'
chmod 755 /path/to/files

NOTE: blocking access to some directories, like I showed, is not needed and is dangerous and can actually hang the whole system or cause other important processes to fail. Therefore it is really a bad idea. Be very careful. I personally would not do that.
This User Gave Thanks to jim mcnamara For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trying to untar then chown, and chmod

I'm changing (trying to anyway) a script that will need to unrar a file, this file will create a directory with files in it. Then I need to change the owner ship and permission on that directory. Finally, I will rsync the directory to another machine. This is what I have so far. #!/bin/bash ... (1 Reply)
Discussion started by: walkerl
1 Replies

2. Shell Programming and Scripting

use a file to chmod

Hi! I need help becouse I've server to backup and I've a lot of files with 700 permission and I need to change the mode to 755 before copy So the point is. With find . -perm 700 -exec echo {} > textfile.txt \; I got a text file with 3156 line which one... (3 Replies)
Discussion started by: ruben.rodrigues
3 Replies

3. UNIX for Dummies Questions & Answers

chmod of remote file

I would like to chmod the file which I am pulling from remote server onto my server. I am using the following script: sftp <server detail> get abc xyz chmod 666 xyz bye Though I could fetch the file successfully but I am not able to change the permission of xyz file on my server. umask... (1 Reply)
Discussion started by: kdtrica
1 Replies

4. Shell Programming and Scripting

File permission by chmod

Hi, I have a typical problem. Consider the scenario: Folder1 ------> Folder2 ------> File1 ------> Folder3 Above is my folder structure, currently the user group "other" has no permissions. I wish to give "read" permission for "others" to File1 using a single command. chmod -R... (5 Replies)
Discussion started by: animesh303
5 Replies

5. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

6. UNIX for Dummies Questions & Answers

chown: <file>: Not owner on Solaris 9

Hi, on a Solaris 5.9 machine no user except for root is able to use chown. for exmaple: > touch iamgal > ls -la iamgal -rw-r--r-- 1 galtest1 other 0 Dec 19 08:40 iamgal > chown galu iamgal chown: iamgal: Not owner I have checked about /etc/system and rstchown - it is... (5 Replies)
Discussion started by: galuzan
5 Replies

7. Shell Programming and Scripting

excluding a directory with chown, chmod

does anyone know how to exclude a directory with chown or chmod? im trying to do something like this chown $username:$username $directory/* chown $username:$username $directory/.* chown $username:$username $directory and find $directory/* -type f -exec... (1 Reply)
Discussion started by: vanessafan99
1 Replies

8. UNIX for Dummies Questions & Answers

chown: Read-only file system

Hi, I am logged in as super use and want to set owner of a root folder to a specific user. #chown -R user1:group1 /u01 This gives the message: chown: /u01: Read-only file system chown: lost+found: Read-only file system #ls -l drwxr-xr-x 3 root system 256 Mar 21 16:42... (2 Replies)
Discussion started by: shoefiend
2 Replies

9. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies
CHMOD(3)								 1								  CHMOD(3)

chmod - Changes file mode

SYNOPSIS
bool chmod (string $filename, int $mode) DESCRIPTION
Attempts to change the mode of the specified file to that given in $mode. PARAMETERS
o $filename - Path to the file. o $mode - Note that $mode is not automatically assumed to be an octal value, so to ensure the expected operation, you need to prefix $mode with a zero (0). Strings such as "g+w" will not work properly. <?php chmod("/somedir/somefile", 755); // decimal; probably incorrect chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect chmod("/somedir/somefile", 0755); // octal; correct value of mode ?> man 1 chmod' and ' man 2 chmod'. <?php // Read and write for owner, nothing for everybody else chmod("/somedir/somefile", 0600); // Read and write for owner, read for everybody else chmod("/somedir/somefile", 0644); // Everything for owner, read and execute for others chmod("/somedir/somefile", 0755); // Everything for owner, read and execute for owner's group chmod("/somedir/somefile", 0750); ?> RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Note The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems. Note This function will not work on remote files as the file to be examined must be accessible via the server's filesystem. Note When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed. In addition, you cannot set the SUID, SGID and sticky bits. SEE ALSO
chown(3), chgrp(3), fileperms(3), stat(3). PHP Documentation Group CHMOD(3)
All times are GMT -4. The time now is 03:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy