On Tue, Dec 24, 2013 at 03:19:16PM +0400, Anton Yuzhaninov wrote:
> On 12/24/13 14:59, Alexander Yerenkow wrote:
> > То есть, руту даётся возможность прочитать файл без прав. Тест показал что
> > поведение одинаковое на zfs и ufs.*
> > *
> > Кто-то может подсказать хотя бы где это описано, и можно ли это поведение 
> > как-то
> > контролировать?
> 
> Где это написано сходу не нашел, но насколько знаю так сложилось исторически 
> во 
> времена старых UNIX-систем, и все современные UNIX-like OS это поведение 
> сохраняют.
> 
> А вообще тесты лучше запускать не от рута.

man 2 intro (две нижние процитированные строчки):

File Access Permissions

    Every file in the file system has a set of access permissions.  These
    permissions are used in determining whether a process may perform a
    requested operation on the file (such as opening a file for writing).
    Access permissions are established at the time a file is created.  They may
    be changed at some later time through the chmod(2) call.

    File access is broken down according to whether a file may be: read,
    written, or executed.  Directory files use the execute permission to
    control if the directory may be searched.

    File access permissions are interpreted by the system as they apply to
    three different classes of users: the owner of the file, those users in the
    file's group, anyone else.  Every file has an independent set of access
    permissions for each of these classes.  When an access check is made, the
    system decides if permission should be granted by checking the access
    information applicable to the caller.

    Read, write, and execute/search permissions on a file are granted to a
    process if:

    The process's effective user ID is that of the super-user.  (Note: even the
    super-user cannot execute a non-executable file.)

Ниже этого места тоже интересно, там есть в частности ответ на вопрос,
который многие не знают: будет ли предоставлен доступ, если ты владелец
файла, права владельца на файле не допускают допуска, а права группы на
файле его допускают?

Ответить