Is there a way to check when the permissions for the file got changed in AIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Is there a way to check when the permissions for the file got changed in AIX
# 1  
Old 11-24-2013
Is there a way to check when the permissions for the file got changed in AIX

Is there a way to check when the permissions for the file got changed in AIX

IS there some file which logs all these details?



Best regards,
Vishal

Last edited by Scott; 11-24-2013 at 08:21 AM.. Reason: Thread moved, not an AIX-specific question
# 2  
Old 11-24-2013
Hi Vishal_dba...

If you are not sure experiment longhand first, this checks on the fly.
Admittedly it is not AIX but I am sure you can adapt the principle.
OSX 10.7.5, default bash terminal.
Code:
#!/bin/bash --posix
echo "This is a test string..." > /tmp/currentfile
chmod 755 /tmp/currentfile
cp /tmp/fileone /tmp/oldfile
chmod 755 /tmp/oldfile
hold=2
while true
do
	filecurrent=`ls -l /tmp/currentfile`
	fileold=`ls -l /tmp/oldfile`
	if [ "${filecurrent:0:10}" == "${fileold:0:10}" ]
	then
		echo "No change in permissions..."
		: # Do other stuff as required...
		sleep $hold
	else
		echo "Permissions changed..."
		break
	fi
	cp /tmp/currentfile /tmp/oldfile
	# The line below added for this DEMO...
	chmod 744 /tmp/oldfile
done
echo `date`

Results on above machine...
Code:
Last login: Sun Nov 24 09:44:12 on ttys000
AMIGA:barrywalker~> chmod 755 permissions.sh
AMIGA:barrywalker~> ./permissions.sh
No change in permissions...
Permissions changed...
Sun 24 Nov 2013 09:46:43 GMT
AMIGA:barrywalker~> _

# 3  
Old 11-24-2013
Unix file systems store the last attribute change in the ctime attribute. Can be displayed with
Code:
ls -lc filename

the ctime changes if
- permission/owner changes
- a time (mtime,atime) changes
- the length changes by a write
# 4  
Old 11-25-2013
Is there not a way to specifically check for the permission changes irrespective of writes to the file?


Best regards,
Vishal
# 5  
Old 11-25-2013
Moderator's Comments:
Mod Comment varathaneie: Please add relevant information here and not simply post links to other sites, especially with just a handful of posts here.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What's the best way to check file permissions before moving files if needed?

Hello, I would like to know if it's a good practice to check the file permissions of the contents of a directory before moving them. For example: mv -- "$directory"/* "$directory"/.* "$directory"/..?* "$destination"The variables $directory and $destination contain the path to an existing... (6 Replies)
Discussion started by: Cacializ
6 Replies

2. Shell Programming and Scripting

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem... (1 Reply)
Discussion started by: arjun_arippa
1 Replies

3. Programming

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem here... (0 Replies)
Discussion started by: arjun_arippa
0 Replies

4. Shell Programming and Scripting

Script to echo "File permissions or ownership changed from required " when accidentally changed.

Hi All, I have to work in the late nights some times for server maintenance and in a hurry to complete I am accidentally changing ownership or permission of directories :( which have similar names ( /var in root and var of some other directory ).:confused: Can some one suggest me with the... (1 Reply)
Discussion started by: shiek.kaleem
1 Replies

5. Windows & DOS: Issues & Discussions

Interrupted Cygwin install changed permissions on C drive

I was installing cygwin on my Windows 7 desktop. I guess I picked a bad mirror site because the download speed was very slow and it wasn't able to give me all the packages I wanted. I closed the setup in too much haste. I think it was still downloading and not yet installing though. It said that... (1 Reply)
Discussion started by: ethoma7329
1 Replies

6. Emergency UNIX and Linux Support

Accidentally Changed File Ownership to Include a "Comment" [AIX]

Hi. I've had a little mishap. To cut a long story short, I've accidentally recursively ran chown on a directory (actually a bunch of 'em). Not a problem in itself, but I had a slight error in the code I used to get the list of directories and ended up with a comment in the file ownership. ... (15 Replies)
Discussion started by: Scott
15 Replies

7. Post Here to Contact Site Administrators and Moderators

Permissions Changed?

I cannot seem to post within any thread as I require moderator approval. I believe my permissions have been changed and was wondering whats the reason behind this. Thanks. (3 Replies)
Discussion started by: Banned
3 Replies

8. Shell Programming and Scripting

How to check file permissions from a script.

hello, I have to write a script to run the other script inside it.So iam planning to write like this? first check the perimissions of the file. Alogorthim ---------- if(!filepermissions == execute) then echo" Permissions denined" else execute the script. file name is : load_mf.sh... (1 Reply)
Discussion started by: rajkumar_g
1 Replies

9. Shell Programming and Scripting

Using grep - check the permissions of the file searched

What I need to do is: I need to use the grep command to search for pattern in directory and sub-directories. And also I need to show the permission of file been seached by the grep command. Could any one please suggest me? ----------------- $> cat file1.txt A -----------------... (8 Replies)
Discussion started by: Johny001
8 Replies

10. Solaris

file permissions changed to nobody4

Hi there We have had a weird problem arise recently whereby a file owned by cjo:cjogroup suddenly had it's permissions changed to nobody4:nogroup. The file is mounted off a NetApp Filer volume with the NFS permissions set to Read-Write Access (All Hosts) but no Root Access. When we tried to... (1 Reply)
Discussion started by: skewbie
1 Replies
Login or Register to Ask a Question