Sponsored Content
Top Forums Programming File date/time modification and permissions Post 302939487 by Pug on Wednesday 25th of March 2015 09:43:55 PM
Old 03-25-2015
I see. So you are saying that the function is supposed to work that way.
Only the owner of the file or a superuser can change it.
So in my case it can't be done.

Is there a setting I can apply to the file to allow all users to access it?
Like a group setting. Or is it hopeless?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File modification time

Does anyone know how to display the time with seconds of when a file was last modified. I can get hour & minutes but would also like seconds. --Running AIX (1 Reply)
Discussion started by: edog
1 Replies

2. UNIX for Dummies Questions & Answers

command for modification date of a file

Good morning, I would like to find all files of a certain type and display their name as well as their modification date. In order to do this, I would do the following: find ./ -name *.csv | ???????? My question: what to put after the pipe instead of the question marks? Is there a basic... (5 Replies)
Discussion started by: scampsd
5 Replies

3. UNIX for Dummies Questions & Answers

How to change the file modification time of a file on nfs mount point

Hi I am accessing a file on nfs mounted device, after completing using of the file, i am tring to restore the access time and modification times of the file. So i got the previous modified time of the file using stat() function and trying to set the date and time for the file, To set these... (6 Replies)
Discussion started by: deepthi.s
6 Replies

4. Shell Programming and Scripting

Displaying the Last Modification Time of a specific file

How can I get and display the last modification time of a file? in scripting or specifically using Batch file I want this info for me to determine whether an image has been edited or not by using the last modification time and compare it to our stored date of modification. can somebody help... (5 Replies)
Discussion started by: jaque18
5 Replies

5. Shell Programming and Scripting

ls -e to find out File modification time in secs

Hi All, I would like to know the file modification time till seconds in Unix. So I tried ls -e and it worked fine. This Solaris 5.10 -rw-rw-r-- 1 test admin 22 Sep 12 11:01:37 2008 test_message But I am not able to run the same command in SOlaris 5.6 and also in AIX/HP Is there... (3 Replies)
Discussion started by: rahulkav
3 Replies

6. Shell Programming and Scripting

File modification time comparison

Hi All, I have two files (given below) each exists under different paths. I want to compare the modification time stamp of file1.txt is lessthan the modification time of file2.txt. month1=`ls -l file1.txt | awk '{ print $6}'` date1=`ls -file1.txt | awk '{ print $7}'` time1=`ls... (1 Reply)
Discussion started by: Arunprasad
1 Replies

7. UNIX for Dummies Questions & Answers

Need Modification Time of a file

Hi all, I need the modification time of a file on a particular day say 3 days before. I just don't want the last modification time. I need all the modification times on a particualar day. Is there anyway to do it? Kindly help. Could anyone tell me where the modification time is stored?... (1 Reply)
Discussion started by: vidhyab
1 Replies

8. UNIX for Dummies Questions & Answers

How do you get the last modification date of a file?

I'm trying to get the date output to be in the form yyyy-mm-dd (e.g. 2013-01-18) !/bin/sh modDate=$(stat -c %y $1) echo $modDate >> $1 When I run this on another file (by typing ./dateScript theFile.txt), I keep getting this message: stat: illegal option -- c What's wrong with my code... (2 Replies)
Discussion started by: Nate18
2 Replies

9. Shell Programming and Scripting

How to change modification time of file?

Explain it with proper e.g (4 Replies)
Discussion started by: sidpatil
4 Replies

10. Shell Programming and Scripting

Subtract a file's modification date with current date

SunOS -s 5.10 Generic_147440-04 sun4u sparc SUNW,SPARC-Enterprise Hi, In a folder, there are files. I have a script which reads the current date and subtract the modification date of each file. How do I achieve this? Regards, Joe (2 Replies)
Discussion started by: roshanbi
2 Replies
chown(2)							System Calls Manual							  chown(2)

NAME
chown, lchown, fchown - Changes the owner and group IDs of a file SYNOPSIS
#include <unistd.h> int chown( const char *path, uid_t owner, gid_t group ); int lchown( const char *path, uid_t owner, gid_t group ); int fchown( int filedes, uid_t owner, gid_t group ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: chown(): POSIX.1, XPG4, XPG4-UNIX fchown(): POSIX.1, XPG4-UNIX lchown(): POSIX.1, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the name of the file whose owner ID, group ID, or both are to be changed. When the path parameter refers to a symbolic link, the behaviors of the chown() and the lchown() functions differ. The chown() function changes the ownership of the file pointed to by the sym- bolic link. The lchown() function changes the ownership of the symbolic link file itself. Specifies a valid open file descriptor. Speci- fies a numeric value representing the owner ID. Specifies a numeric value representing the group ID. DESCRIPTION
The chown(), lchown() and fchown() functions change the owner and group of a file. A process can change the value of the owner ID of a file only if the process has superuser privilege. A process can change the value of the file group ID if the effective user ID of the process matches the owner ID of the file, or if the process has superuser privilege. A process without superuser privilege can change the group ID of a file only to the value of its effective group ID or to a value in its sup- plementary group list. If the value of the owner ID is changed and the process does not have superuser privilege, the set-user ID attribute (the S_ISUID bit) of a regular file is cleared. The set-user ID attribute (S_ISUID bit) of a file is cleared upon successful return if: The file is a regular file. The process does not have superuser privilege. The set-group ID attribute (S_ISGID bit) of a file is cleared upon successful return if: The file is a regular file. The process does not have superuser privilege. If the owner or group parameter is specified as (uid_t)-1 or (gid_t)-1 respectively, the corresponding ID of the file is unchanged. Upon successful completion, the chown(), lchown(), and fchown() functions mark the st_ctime field of the file for update. RETURN VALUES
Upon successful completion, the chown(), lchown(), and fchown() functions return a value of 0 (zero). Otherwise, a value of -1 is returned, the owner and group of the file remain unchanged, and errno is set to indicate the error. ERRORS
If the chown() and lchown() functions fail, errno may be set to one of the following values: Search permission is denied on a component of path. The path parameter is an invalid address. The owner or group ID is not a value supported by this implementation. Too many links were encountered in translating path. The length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX. The path parameter does not exist or is an empty string. A component of path is not a directory. The effective user ID does not match the ID of the owner of the file, and the calling process does not have appropriate privilege and _POSIX_CHOWN_RESTRICTED indicates that such privilege is required. The named file resides on a read-only file system. The process' root or current directory is located in a virtual file system that has been unmounted. If the fchown() function fails, errno may be set to one of the following values: The file descriptor filedes is not valid. The owner or group ID is not a value supported by this implementation. RELATED INFORMATION
Functions: chmod(2) Commands: chown(1) Standards: standards(5) delim off chown(2)
All times are GMT -4. The time now is 09:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy