PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > touch question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

touch question

Réponse
 
LinkBack Outils de la discussion
Vieux 07/01/2008, 15h50   #1
Robert Latest
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut touch question

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
  Réponse avec citation
Vieux 07/01/2008, 17h26   #2
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: touch question

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.
  Réponse avec citation
Vieux 08/01/2008, 03h41   #3
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: touch question

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 ***
  Réponse avec citation
Vieux 08/01/2008, 08h58   #4
Robert Latest
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: touch question

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h03.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11650 seconds with 12 queries