|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
is it correct or a bug that only the owner of a file can use "touch" to set the modification time of a file to some arbitrary time? For testing purposes, I've got a file with mode 666 in a mode 777 directory, owned by another user, but I can't "touch" it. Why? robert |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, 07 Jan 2008 15:50:57 +0000, Robert Latest wrote:
> Hello, > > is it correct or a bug that only the owner of a file can use "touch" to > set the modification time of a file to some arbitrary time? For testing > purposes, I've got a file with mode 666 in a mode 777 directory, owned > by another user, but I can't "touch" it. Why? > > robert From the man page for utimes NAME utime, utimes - change access and/or modification times of an inode SYNOPSIS #include <sys/types.h> #include <utime.h> int utime(const char *filename, const struct utimbuf *buf); #include <sys/time.h> int utimes(const char *filename, const struct timeval times[2]); DESCRIPTION utime() changes the access and modification times of the inode specified by filename to the actime and modtime fields of buf respectively. If buf is NULL, then the access and modification times of the file are set to the current time. Changing time stamps is permitted when: either the process has appropriate privileges (Linux: has the CAP_FOWNER capability), or the effective user ID equals the user ID of the file, or buf is NULL and the process has write per- mission to the file. So the behaviour is correct. You have to have an EUID equal to the owner of the file to set an arbitary time. You can set it to the current time just by having write permission. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
In article <478260ae$0$84195$742ec2ed@news.sonic.net>,
Icarus Sparry <usenet@icarus.freeuk.com> wrote: > So the behaviour is correct. You have to have an EUID equal to the owner > of the file to set an arbitary time. You can set it to the current time > just by having write permission. I presume the intent is that the owner might want to know when people have written to his file. They shouldn't be able to write to the file and then hide it by reverting the modification time. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Barry Margolin wrote:
> I presume the intent is that the owner might want to know when people > have written to his file. They shouldn't be able to write to the file > and then hide it by reverting the modification time. Yeah, makes sense. robert |
|
![]() |
| Outils de la discussion | |
|
|