вторник, 1 января 2013 г.

Права и папки пользователей в Linux (Centos) и SELinux

После заливки дистрибутива Drupal (сборка Commons) не смог начать установку из-за 403 ошибки "You don't have permission to access /commons/ on this server" На эти грабли я уже наступал, но не смог вспомнить решение. Проблема решается # chcon -R -t httpd_sys_content_t commons См. последний фрейм от Fedora


Сначала о правах пользователя. В Linux есть владелец процесса, группа процеса и все остальные. В книге Д. Колесниченко Linux на ноутбуке"в гл.23 все изложено довольно подробно. Через меню Wiki Linux можно найти соответсвующие описания. А здесь остановимся на местах хранения файлов.
При добавлении нового пользователя создается запись в файле etc/passwd, сами пароли записываются в файле etc/shadow (зашифрованные), каждый пользователь влючен по умолчанию в одну группу (см. файл etc/groups). Все файлы эти файлы из моего ноутбука приведены внизу в комментариях.
[root@localhost html]# ls -Z
drwxr-xr-x 6226 6226 root:object_r:user_home_t commons
drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t drupal-7.9 [root@localhost html]# chcon -R -t httpd_sys_content_t commons
[root@localhost html]# ls -Z
drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t commons
drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t drupal-7.9
После прочтения 5.7. Контексты SELinux - Маркирование файлов выполнил комманду изменения контекста (см. в блоке кода). Оказалось, что проблема была именно в SELinux.
Ссылки раздела меню SELinux описывают все аспекты сервиса..., примеры комманд приведены в комментариях.
Похожие посты внизу.

30 комментариев:

  1. etc/passwd
    root:x:0:0:root:/root:/bin/bash
    bin:x:1:1:bin:/bin:/sbin/nologin
    daemon:x:2:2:daemon:/sbin:/sbin/nologin
    adm:x:3:4:adm:/var/adm:/sbin/nologin
    lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
    sync:x:5:0:sync:/sbin:/bin/sync
    shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
    halt:x:7:0:halt:/sbin:/sbin/halt
    mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
    news:x:9:13:news:/etc/news:
    uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
    operator:x:11:0:operator:/root:/sbin/nologin
    games:x:12:100:games:/usr/games:/sbin/nologin
    gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
    ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
    nobody:x:99:99:Nobody:/:/sbin/nologin
    nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
    distcache:x:94:94:Distcache:/:/sbin/nologin
    vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
    pcap:x:77:77::/var/arpwatch:/sbin/nologin
    ntp:x:38:38::/etc/ntp:/sbin/nologin
    apache:x:48:48:Apache:/var/www:/sbin/nologin
    rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
    rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
    nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
    mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
    smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
    dovecot:x:97:97:dovecot:/usr/libexec/dovecot:/sbin/nologin
    squid:x:23:23::/var/spool/squid:/sbin/nologin
    xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
    hsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologin
    named:x:25:25:Named:/var/named:/sbin/nologin
    dbus:x:81:81:System message bus:/:/sbin/nologin
    avahi:x:70:70:Avahi daemon:/:/sbin/nologin
    haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
    avahi-autoipd:x:100:101:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
    gdm:x:42:42::/var/gdm:/sbin/nologin
    Altersego:x:500:500:Altersego :/home/Altersego:/bin/bash
    mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash

    ОтветитьУдалить
    Ответы
    1. Формат строки файла etc/passwd
      login:password:UID:GID:настоящее имя(ФИО):домашний каталог:/bin/bash (интерпретптор комманд)
      UID - User ID
      GID - Group ID

      вместо пароля обычно /x/, поскольку в новых дистрибутивах пароль содержится в файле
      etc/shadow (редактируется тольо root)
      если строки начинаются с
      не с $ - то алгоритм шифрования DES (старые дистрибутивы),
      с $1$ - то алгоритм шифрования MD5,
      с $2a$- то алгоритм шифрования Blowfish,

      Удалить
    2. содержание etc/shadow
      root:$1$.6lNNzsU$a4oqagiS75X2HLUipZe5Q/:14438:0:99999:7:::
      bin:*:14438:0:99999:7:::
      daemon:*:14438:0:99999:7:::
      adm:*:14438:0:99999:7:::
      lp:*:14438:0:99999:7:::
      sync:*:14438:0:99999:7:::
      shutdown:*:14438:0:99999:7:::
      halt:*:14438:0:99999:7:::
      mail:*:14438:0:99999:7:::
      news:*:14438:0:99999:7:::
      uucp:*:14438:0:99999:7:::
      operator:*:14438:0:99999:7:::
      games:*:14438:0:99999:7:::
      gopher:*:14438:0:99999:7:::
      ftp:*:14438:0:99999:7:::
      nobody:*:14438:0:99999:7:::
      nscd:!!:14438:0:99999:7:::
      distcache:!!:14438:0:99999:7:::
      vcsa:!!:14438:0:99999:7:::
      pcap:!!:14438:0:99999:7:::
      ntp:!!:14438:0:99999:7:::
      apache:!!:14438:0:99999:7:::
      rpc:!!:14438:0:99999:7:::
      rpcuser:!!:14438:0:99999:7:::
      nfsnobody:!!:14438:0:99999:7:::
      mailnull:!!:14438:0:99999:7:::
      smmsp:!!:14438:0:99999:7:::
      sshd:!!:14438:0:99999:7:::
      webalizer:!!:14438:0:99999:7:::
      dovecot:!!:14438:0:99999:7:::
      squid:!!:14438:0:99999:7:::
      xfs:!!:14438:0:99999:7:::
      hsqldb:!!:14438:0:99999:7:::
      named:!!:14438:0:99999:7:::
      dbus:!!:14438:0:99999:7:::
      avahi:!!:14438:0:99999:7:::
      haldaemon:!!:14438:0:99999:7:::
      avahi-autoipd:!!:14438:0:99999:7:::
      gdm:!!:14438:0:99999:7:::
      Altersego:$1$chmRBc2v$dKQmf2.dwVRAO8IoAvBVy0:14947:0:99999:7:::
      mysql:!!:14438::::::

      Удалить
    3. etc/groups
      root:x:0:root,Altersego
      bin:x:1:root,bin,daemon
      daemon:x:2:root,bin,daemon
      sys:x:3:root,bin,adm
      adm:x:4:root,adm,daemon
      tty:x:5:
      disk:x:6:root
      lp:x:7:daemon,lp
      mem:x:8:
      kmem:x:9:
      wheel:x:10:root
      mail:x:12:mail
      news:x:13:news
      uucp:x:14:uucp
      man:x:15:
      games:x:20:
      gopher:x:30:
      dip:x:40:
      ftp:x:50:
      lock:x:54:
      nobody:x:99:
      users:x:100:
      nscd:x:28:
      utmp:x:22:
      utempter:x:35:
      distcache:x:94:
      floppy:x:19:
      vcsa:x:69:
      pcap:x:77:
      slocate:x:21:
      ntp:x:38:
      apache:x:48:
      rpc:x:32:
      rpcuser:x:29:
      nfsnobody:x:65534:
      mailnull:x:47:
      smmsp:x:51:
      sshd:x:74:
      webalizer:x:67:
      dovecot:x:97:
      squid:x:23:
      xfs:x:43:
      hsqldb:x:96:
      named:x:25:
      dbus:x:81:
      avahi:x:70:
      haldaemon:x:68:
      avahi-autoipd:x:101:
      gdm:x:42:
      Altersego:x:500:
      mysql:x:27:
      audio:x:63:gdm
      ecryptfs:x:102:
      fuse:x:103:

      Удалить
  2. свойства папки дистрибутива commons, к которой нет доступа:
    var/www/html/commons
    owner 6226 (как и других работающих дистрибутивов)
    octal permissions 1600755....
    Единственное отличие:+
    SElinux context - Temporary data tmp_t:s0
    "...вы можете войти как root в текстовом режиме,но ене можете в графическом,,, стр. 330)
    если вы хотитет входить, как root в графическом режиме, откройте терминал (su)
    # - признак того, что вы работаете с правами суперпользователя (а не $)
    #setfiles /etc/security/selenux/file_contexts /root

    ОтветитьУдалить
    Ответы
    1. [root@localhost ~]# setfiles /?
      usage: setfiles [-dnpqvW] [-o filename] [-r alt_root_path ] spec_file pathname...
      usage: setfiles -c policyfile spec_file
      usage: setfiles -s [-dnqvW] [-o filename ] spec_file
      [root@localhost ~]#

      Удалить
  3. man CHECKPOLICY

    NAME
    checkpolicy - SELinux policy compiler

    SYNOPSIS
    checkpolicy [-b] [-d] [-M] [-U handle_unknown ] [-V] [-c policyvers] [-o out-
    put_file] [input_file]

    DESCRIPTION
    This manual page describes the checkpolicy command.

    checkpolicy is a program that checks and compiles a SELinux security policy con-
    figuration into a binary representation that can be loaded into the kernel. If no
    input file name is specified, checkpolicy will attempt to read from policy.conf or
    policy, depending on whether the -b flag is specified.

    OPTIONS
    -b Read an existing binary policy file rather than a source policy.conf file.

    -d Enter debug mode after loading the policy.

    -M Enable the MLS policy when checking and compiling the policy.

    -o filename
    Write a binary policy file to the specified filename.

    -c policyvers
    Specify the policy version, defaults to the latest.

    -U OPTION
    Tells the kernel how to handle unknown classes and permissions, where
    OPTION is one of the following:

    ОтветитьУдалить
    Ответы
    1. deny Deny unknown kernel checks

      reject Reject loading of policy with unknowns

      allow Allow unknown kernel checks

      -V Show policy versions created by this program

      SEE ALSO
      SELinux documentation at http://www.nsa.gov/selinux, especially "Configuring the
      SELinux Policy".

      AUTHOR
      This manual page was written by Arpad Magosanyi , and
      edited by Stephen Smalley . The program was written by
      Stephen Smalley .

      CHECKPOLICY(8)

      Удалить
  4. Для модифицирования учетной записи ее обладатель или суперпользователь могут применить комманду usermod
    man usermod
    NAME
    usermod - modify a user account

    SYNOPSIS
    usermod [options] LOGIN

    DESCRIPTION
    The usermod command modifies the system account files to reflect the changes that are
    specified on the command line.

    OPTIONS
    The options which apply to the usermod command are:

    -a, --append
    Add the user to the supplemental group(s). Use only with -G option.

    -c, --comment COMMENT
    The new value of the user’s password file comment field. It is normally modified
    using the chfn(1) utility.

    -d, --home HOME_DIR
    The user’s new login directory. If the -m option is given the contents of the
    current home directory will be moved to the new home directory, which is created if
    it does not already exist.

    -e, --expiredate EXPIRE_DATE
    The date on which the user account will be disabled. The date is specified in the
    format YYYY-MM-DD.

    -f, --inactive INACTIVE
    The number of days after a password expires until the account is permanently
    disabled. A value of 0 disables the account as soon as the password has expired, and
    a value of -1 disables the feature. The default value is -1.

    -g, --gid GROUP
    The group name or number of the user’s new initial login group. The group name must
    exist. A group number must refer to an already existing group. The default group
    :

    ОтветитьУдалить
    Ответы
    1. NAME
      usermod - modify a user account

      SYNOPSIS
      usermod [options] LOGIN

      DESCRIPTION
      The usermod command modifies the system account files to reflect the changes that are
      specified on the command line.

      OPTIONS
      The options which apply to the usermod command are:

      -a, --append
      Add the user to the supplemental group(s). Use only with -G option.

      -c, --comment COMMENT
      The new value of the user’s password file comment field. It is normally modified
      using the chfn(1) utility.

      -d, --home HOME_DIR
      The user’s new login directory. If the -m option is given the contents of the
      current home directory will be moved to the new home directory, which is created if
      it does not already exist.

      -e, --expiredate EXPIRE_DATE
      The date on which the user account will be disabled. The date is specified in the
      format YYYY-MM-DD.

      -f, --inactive INACTIVE
      The number of days after a password expires until the account is permanently
      disabled. A value of 0 disables the account as soon as the password has expired, and
      a value of -1 disables the feature. The default value is -1.

      -g, --gid GROUP
      The group name or number of the user’s new initial login group. The group name must
      exist. A group number must refer to an already existing group. The default group
      :

      Удалить
    2. NAME
      usermod - modify a user account

      SYNOPSIS
      usermod [options] LOGIN

      DESCRIPTION
      The usermod command modifies the system account files to reflect the changes that are
      specified on the command line.

      OPTIONS
      The options which apply to the usermod command are:

      -a, --append
      Add the user to the supplemental group(s). Use only with -G option.

      -c, --comment COMMENT
      The new value of the user’s password file comment field. It is normally modified
      using the chfn(1) utility.

      -d, --home HOME_DIR
      The user’s new login directory. If the -m option is given the contents of the
      current home directory will be moved to the new home directory, which is created if
      it does not already exist.

      -e, --expiredate EXPIRE_DATE
      The date on which the user account will be disabled. The date is specified in the
      format YYYY-MM-DD.

      -f, --inactive INACTIVE
      The number of days after a password expires until the account is permanently
      disabled. A value of 0 disables the account as soon as the password has expired, and
      a value of -1 disables the feature. The default value is -1.

      -g, --gid GROUP
      The group name or number of the user’s new initial login group. The group name must
      exist. A group number must refer to an already existing group. The default group
      :

      Удалить
    3. -Z, --selinux-user SEUSER
      The SELinux user for the user’s login. The default is to leave this field blank,
      which causes the system to select the default SELinux user.

      CAVEATS
      usermod will not allow you to change the name of a user who is logged in. You must make
      certain that the named user is not executing any processes when this command is being
      executed if the user’s numerical user ID is being changed. You must change the owner of
      any crontab files manually. You must change the owner of any at jobs manually. You must
      make any changes involving NIS on the NIS server.

      FILES
      /etc/group
      Group account information.

      /etc/passwd
      User account information.

      /etc/shadow
      Secure user account information.

      SEE ALSO
      chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8), groupdel(8),
      groupmod(8), login.defs(5), useradd(8), userdel(8).

      System Management Commands 06/24/2006 USERMOD(8)

      Удалить
  5. man chown
    chown - change file owner and group

    SYNOPSIS
    chown [OPTION]... [OWNER][:[GROUP]] FILE...
    chown [OPTION]... --reference=RFILE FILE...

    DESCRIPTION
    This manual page documents the GNU version of chown. chown changes the user and/or
    group ownership of each given file. If only an owner (a user name or numeric user ID)
    is given, that user is made the owner of each given file, and the files’ group is not
    changed. If the owner is followed by a colon and a group name (or numeric group ID),
    with no spaces between them, the group ownership of the files is changed as well. If a
    colon but no group name follows the user name, that user is made the owner of the files
    and the group of the files is changed to that user’s login group. If the colon and
    group are given, but the owner is omitted, only the group of the files is changed; in
    this case, chown performs the same function as chgrp. If only a colon is given, or if
    the entire operand is empty, neither the owner nor the group is changed.

    OPTIONS
    Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference,
    change the owner and group of each FILE to those of RFILE.

    -c, --changes
    like verbose but report only when a change is made

    --dereference
    affect the referent of each symbolic link, rather than the symbolic link itself
    (this is the default)

    -h, --no-dereference
    affect each symbolic link instead of any referenced file (useful only on systems
    that can change the ownership of a symlink)

    --from=CURRENT_OWNER:CURRENT_GROUP
    change the owner and/or group of each file only if its current owner and/or
    group match those specified here. Either may be omitted, in which case a match

    ОтветитьУдалить
    Ответы
    1. CHOWN(1)

      NAME
      chown - change file owner and group

      SYNOPSIS
      chown [OPTION]... [OWNER][:[GROUP]] FILE...
      chown [OPTION]... --reference=RFILE FILE...

      DESCRIPTION
      This manual page documents the GNU version of chown. chown changes the user and/or
      group ownership of each given file. If only an owner (a user name or numeric user ID)
      is given, that user is made the owner of each given file, and the files’ group is not
      changed. If the owner is followed by a colon and a group name (or numeric group ID),
      with no spaces between them, the group ownership of the files is changed as well. If a
      colon but no group name follows the user name, that user is made the owner of the files
      and the group of the files is changed to that user’s login group. If the colon and
      group are given, but the owner is omitted, only the group of the files is changed; in
      this case, chown performs the same function as chgrp. If only a colon is given, or if
      the entire operand is empty, neither the owner nor the group is changed.

      OPTIONS
      Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference,
      change the owner and group of each FILE to those of RFILE.

      -c, --changes
      like verbose but report only when a change is made

      --dereference
      affect the referent of each symbolic link, rather than the symbolic link itself
      (this is the default)

      -h, --no-dereference
      affect each symbolic link instead of any referenced file (useful only on systems
      that can change the ownership of a symlink)

      --from=CURRENT_OWNER:CURRENT_GROUP
      change the owner and/or group of each file only if its current owner and/or
      group match those specified here. Either may be omitted, in which case a match

      Удалить
    2. CHOWN(1)

      NAME
      chown - change file owner and group

      SYNOPSIS
      chown [OPTION]... [OWNER][:[GROUP]] FILE...
      chown [OPTION]... --reference=RFILE FILE...

      DESCRIPTION
      This manual page documents the GNU version of chown. chown changes the user and/or
      group ownership of each given file. If only an owner (a user name or numeric user ID)
      is given, that user is made the owner of each given file, and the files’ group is not
      changed. If the owner is followed by a colon and a group name (or numeric group ID),
      with no spaces between them, the group ownership of the files is changed as well. If a
      colon but no group name follows the user name, that user is made the owner of the files
      and the group of the files is changed to that user’s login group. If the colon and
      group are given, but the owner is omitted, only the group of the files is changed; in
      this case, chown performs the same function as chgrp. If only a colon is given, or if
      the entire operand is empty, neither the owner nor the group is changed.

      OPTIONS
      Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference,
      change the owner and group of each FILE to those of RFILE.

      -c, --changes
      like verbose but report only when a change is made

      --dereference
      affect the referent of each symbolic link, rather than the symbolic link itself
      (this is the default)

      -h, --no-dereference
      affect each symbolic link instead of any referenced file (useful only on systems
      that can change the ownership of a symlink)

      --from=CURRENT_OWNER:CURRENT_GROUP
      change the owner and/or group of each file only if its current owner and/or
      group match those specified here. Either may be omitted, in which case a match

      Удалить
  6. man chmod
    - change file access permissions

    SYNOPSIS
    chmod [OPTION]... MODE[,MODE]... FILE...
    chmod [OPTION]... OCTAL-MODE FILE...
    chmod [OPTION]... --reference=RFILE FILE...

    DESCRIPTION
    This manual page documents the GNU version of chmod. chmod changes the permissions of
    each given file according to mode, which can be either a symbolic representation of
    changes to make, or an octal number representing the bit pattern for the new permis-
    sions.

    The format of a symbolic mode is ‘[ugoa...][[+-=][rwxXstugo...]...][,...]’. Multiple
    symbolic operations can be given, separated by commas.

    A combination of the letters ‘ugoa’ controls which users’ access to the file will be
    changed: the user who owns it (u), other users in the file’s group (g), other users not
    in the file’s group (o), or all users (a). If none of these are given, the effect is
    as if ‘a’ were given, but bits that are set in the umask are not affected.

    The operator ‘+’ causes the permissions selected to be added to the existing permis-
    sions of each file; ‘-’ causes them to be removed; and ‘=’ causes them to be the only
    permissions that the file has.

    The letters ‘rwxXstugo’ select the new permissions for the affected users: read (r),
    write (w), execute (or access for directories) (x), execute only if the file is a
    directory or already has execute permission for some user (X), set user or group ID on
    execution (s), sticky (t), the permissions granted to the user who owns the file (u),
    the permissions granted to other users who are members of the file’s group (g), and the
    permissions granted to users that are in neither of the two preceding categories (o).

    A numeric mode is from one to four octal digits (0-7), derived by adding up the bits
    with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros. The
    first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes.
    The second digit selects permissions for the user who owns the file: read (4), write

    ОтветитьУдалить
    Ответы
    1. chmod never changes the permissions of symbolic links; the chmod system call cannot
      change their permissions. This is not a problem since the permissions of symbolic
      links are never used. However, for each symbolic link listed on the command line,
      chmod changes the permissions of the pointed-to file. In contrast, chmod ignores sym-
      bolic links encountered during recursive directory traversals.

      STICKY FILES
      On older Unix systems, the sticky bit caused executable files to be hoarded in swap
      space. This feature is not useful on modern VM systems, and the Linux kernel ignores
      the sticky bit on files. Other kernels may use the sticky bit on files for system-
      defined purposes. On some systems, only the superuser can set the sticky bit on files.

      STICKY DIRECTORIES
      When the sticky bit is set on a directory, files in that directory may be unlinked or
      renamed only by root or their owner. Without the sticky bit, anyone able to write to
      the directory can delete or rename files. The sticky bit is commonly found on directo-
      ries, such as /tmp, that are world-writable.

      OPTIONS
      Change the mode of each FILE to MODE.

      -c, --changes
      like verbose but report only when a change is made

      --no-preserve-root
      do not treat ‘/’ specially (the default)

      --preserve-root
      fail to operate recursively on ‘/’

      -f, --silent, --quiet
      suppress most error messages

      -v, --verbose
      output a diagnostic for every file processed

      --reference=RFILE
      use RFILE’s mode instead of MODE values

      Удалить
    2. chmod never changes the permissions of symbolic links; the chmod system call cannot
      change their permissions. This is not a problem since the permissions of symbolic
      links are never used. However, for each symbolic link listed on the command line,
      chmod changes the permissions of the pointed-to file. In contrast, chmod ignores sym-
      bolic links encountered during recursive directory traversals.

      STICKY FILES
      On older Unix systems, the sticky bit caused executable files to be hoarded in swap
      space. This feature is not useful on modern VM systems, and the Linux kernel ignores
      the sticky bit on files. Other kernels may use the sticky bit on files for system-
      defined purposes. On some systems, only the superuser can set the sticky bit on files.

      STICKY DIRECTORIES
      When the sticky bit is set on a directory, files in that directory may be unlinked or
      renamed only by root or their owner. Without the sticky bit, anyone able to write to
      the directory can delete or rename files. The sticky bit is commonly found on directo-
      ries, such as /tmp, that are world-writable.

      OPTIONS
      Change the mode of each FILE to MODE.

      -c, --changes
      like verbose but report only when a change is made

      --no-preserve-root
      do not treat ‘/’ specially (the default)

      --preserve-root
      fail to operate recursively on ‘/’

      -f, --silent, --quiet
      suppress most error messages

      -v, --verbose
      output a diagnostic for every file processed

      --reference=RFILE
      use RFILE’s mode instead of MODE values

      Удалить
  7. [root@localhost ~]# getsebool -a
    NetworkManager_disable_trans --> off
    aisexec_disable_trans --> off
    allow_aisexec_rw_tmpfs --> off
    allow_console_login --> off
    allow_cvs_read_shadow --> off
    allow_daemons_dump_core --> on
    allow_daemons_use_tty --> on
    allow_domain_fd_use --> on
    allow_execheap --> off
    allow_execmem --> on
    allow_execmod --> off
    allow_execstack --> on
    allow_ftpd_anon_write --> off
    allow_ftpd_full_access --> off
    allow_ftpd_use_cifs --> off
    allow_ftpd_use_nfs --> off
    allow_gpg_execstack --> off
    allow_gssd_read_tmp --> on
    allow_httpd_anon_write --> off
    allow_httpd_bugzilla_script_anon_write --> off
    allow_httpd_cvs_script_anon_write --> off
    allow_httpd_mod_auth_pam --> off
    allow_httpd_nagios_script_anon_write --> off
    allow_httpd_prewikka_script_anon_write --> off
    allow_httpd_squid_script_anon_write --> off
    allow_httpd_sys_script_anon_write --> off
    allow_java_execstack --> off
    allow_kerberos --> on
    allow_mount_anyfile --> off
    allow_mounton_anydir --> on
    allow_mplayer_execstack --> off
    allow_nfsd_anon_write --> off
    allow_polyinstantiation --> off
    allow_postfix_local_write_mail_spool --> off
    allow_ptrace --> off
    allow_rsync_anon_write --> off
    allow_saslauthd_read_shadow --> off
    allow_smbd_anon_write --> off
    allow_ssh_keysign --> off
    allow_tftp_anon_write --> off
    allow_unconfined_execmem_dyntrans --> off
    allow_unconfined_mmap_low --> on
    allow_unlabeled_packets --> on
    allow_user_mysql_connect --> off
    allow_write_xshm --> off
    allow_ypbind --> off
    allow_zebra_write_config --> on
    amanda_disable_trans --> off
    amavis_disable_trans --> off
    apmd_disable_trans --> off
    arpwatch_disable_trans --> off
    auditd_disable_trans --> off
    automount_disable_trans --> off
    avahi_disable_trans --> off
    bluetooth_disable_trans --> off
    canna_disable_trans --> off
    cardmgr_disable_trans --> off
    ccs_disable_trans --> off
    cdrecord_read_content --> off
    clamd_disable_trans --> off
    clamscan_disable_trans --> off
    clogd_disable_trans --> off
    clvmd_disable_trans --> off
    comsat_disable_trans --> off
    cron_can_relabel --> off
    crond_disable_trans --> off
    cupsd_config_disable_trans --> off
    cupsd_disable_trans --> off
    cupsd_lpd_disable_trans --> off
    cvs_disable_trans --> off
    cyrus_disable_trans --> off
    dbskkd_disable_trans --> off
    dccd_disable_trans --> off
    dccifd_disable_trans --> off
    dccm_disable_trans --> off
    dhcpc_disable_trans --> off
    dhcpc_exec_iptables --> off
    dhcpd_disable_trans --> off
    disable_evolution_trans --> off
    disable_games_trans --> off
    disable_mozilla_trans --> off
    disable_thunderbird_trans --> off
    dkim_milter_disable_trans --> off
    dlm_controld_disable_trans --> off
    dnsmasq_disable_trans --> off
    dovecot_disable_trans --> off
    fcron_crond --> off
    fenced_can_network_connect --> off
    fenced_disable_trans --> off
    fetchmail_disable_trans --> off
    fingerd_disable_trans --> off
    freshclam_disable_trans --> off
    fsdaemon_disable_trans --> off
    ftp_home_dir --> off
    ftpd_connect_db --> off
    ftpd_disable_trans --> off
    ftpd_is_daemon --> on
    gfs_controld_disable_trans --> off
    global_ssp --> off
    gpm_disable_trans --> off
    greylist_milter_disable_trans --> off
    groupd_disable_trans --> off
    gssd_disable_trans --> off
    hald_disable_trans --> off
    hotplug_disable_trans --> off
    howl_disable_trans --> off
    hplip_disable_trans --> off
    httpd_builtin_scripting --> on
    httpd_can_network_connect --> off
    httpd_can_network_connect_db --> off
    httpd_can_network_relay --> off
    httpd_can_sendmail --> on
    httpd_disable_trans --> off
    httpd_enable_cgi --> on
    httpd_enable_ftp_server --> off

    ОтветитьУдалить
    Ответы
    1. httpd_enable_homedirs --> on
      httpd_execmem --> off
      httpd_read_user_content --> off
      httpd_rotatelogs_disable_trans --> off
      httpd_setrlimit --> off
      httpd_ssi_exec --> off
      httpd_suexec_disable_trans --> off
      httpd_tty_comm --> on
      httpd_unified --> on
      httpd_use_cifs --> off
      httpd_use_nfs --> off
      inetd_child_disable_trans --> off
      inetd_disable_trans --> off
      innd_disable_trans --> off
      ipsec_disable_trans --> off
      irqbalance_disable_trans --> off
      iscsid_disable_trans --> off
      kadmind_disable_trans --> off
      klogd_disable_trans --> off
      kpropd_disable_trans --> off
      krb5kdc_disable_trans --> off
      ktalkd_disable_trans --> off
      lpd_disable_trans --> off
      mail_read_content --> off
      mailman_mail_disable_trans --> off
      mdadm_disable_trans --> off
      mozilla_read_content --> off
      mysqld_disable_trans --> off
      nagios_disable_trans --> off
      named_disable_trans --> off
      named_write_master_zones --> off
      nfs_export_all_ro --> on
      nfs_export_all_rw --> on
      nfsd_disable_trans --> off
      nmbd_disable_trans --> off
      nrpe_disable_trans --> off
      nscd_disable_trans --> off
      ntpd_disable_trans --> off
      oddjob_disable_trans --> off
      oddjob_mkhomedir_disable_trans --> off
      openvpn_disable_trans --> off
      openvpn_enable_homedirs --> off
      pcscd_disable_trans --> off
      pegasus_disable_trans --> off
      piranha_fos_disable_trans --> off
      piranha_lvs_can_network_connect --> off
      piranha_lvs_disable_trans --> off
      piranha_pulse_disable_trans --> off
      piranha_web_disable_trans --> off
      pki_ca_disable_trans --> off
      pki_kra_disable_trans --> off
      pki_ocsp_disable_trans --> off
      pki_ra_disable_trans --> off
      pki_tks_disable_trans --> off
      pki_tps_disable_trans --> off
      portmap_disable_trans --> off
      postfix_disable_trans --> off
      postgresql_disable_trans --> off
      postgrey_disable_trans --> off
      pppd_can_insmod --> off
      pppd_disable_trans --> off
      pppd_for_user --> off
      pptp_disable_trans --> off
      prelude_audisp_disable_trans --> off
      prelude_disable_trans --> off
      prelude_lml_disable_trans --> off
      privoxy_connect_any --> off
      privoxy_disable_trans --> off
      ptal_disable_trans --> off
      pyzord_disable_trans --> off
      qdiskd_disable_trans --> off
      qemu_full_network --> on
      qemu_use_cifs --> on
      qemu_use_comm --> off
      qemu_use_nfs --> on
      qemu_use_usb --> on
      racoon_disable_trans --> off
      racoon_read_shadow --> off
      radiusd_disable_trans --> off
      radvd_disable_trans --> off
      rdisc_disable_trans --> off
      read_default_t --> on

      Удалить
    2. read_untrusted_content --> off
      readahead_disable_trans --> off
      regex_milter_disable_trans --> off
      restorecond_disable_trans --> off
      rgmanager_can_network_connect --> off
      rgmanager_disable_trans --> off
      rhgb_disable_trans --> off
      rhsmcertd_disable_trans --> off
      ricci_disable_trans --> off
      ricci_modclusterd_disable_trans --> off
      rlogind_disable_trans --> off
      rpcd_disable_trans --> off
      rshd_disable_trans --> off
      rsync_client --> off
      rsync_disable_trans --> off
      rsync_export_all_ro --> off
      run_ssh_inetd --> off
      samba_domain_controller --> off
      samba_enable_home_dirs --> off
      samba_export_all_ro --> off
      samba_export_all_rw --> off
      samba_share_fusefs --> off
      samba_share_nfs --> off
      saslauthd_disable_trans --> off
      secure_mode_insmod --> off
      secure_mode_policyload --> off
      setrans_disable_trans --> off
      setroubleshootd_disable_trans --> off
      slapd_disable_trans --> off
      smbd_disable_trans --> off
      snmpd_disable_trans --> off
      spamass_milter_disable_trans --> off
      spamassassin_can_network --> off
      spamd_disable_trans --> off
      spamd_enable_home_dirs --> on
      squid_connect_any --> off
      squid_disable_trans --> off
      ssh_sysadm_login --> off
      sssd_disable_trans --> off
      staff_read_sysadm_file --> off
      stunnel_disable_trans --> off
      stunnel_is_daemon --> off
      swat_disable_trans --> off
      syslogd_disable_trans --> off
      tcpd_disable_trans --> off
      telnetd_disable_trans --> off
      tftpd_disable_trans --> off
      tzdata_disable_trans --> off
      udev_disable_trans --> off
      use_lpd_server --> off
      use_nfs_home_dirs --> off
      use_samba_home_dirs --> off
      user_direct_mouse --> off
      user_dmesg --> off
      user_net_control --> off
      user_ping --> on
      user_rw_noexattrfile --> off
      user_tcp_server --> off
      user_ttyfile_stat --> off
      uucpd_disable_trans --> off
      vhostmd_disable_trans --> off
      virt_use_comm --> off
      virt_use_fusefs --> off
      virt_use_nfs --> off
      virt_use_samba --> off
      virt_use_sysfs --> off
      virt_use_usb --> on
      virtd_disable_trans --> off
      winbind_disable_trans --> off
      write_untrusted_content --> off
      xdm_disable_trans --> off
      xdm_sysadm_login --> off
      xend_disable_trans --> off
      xfs_disable_trans --> off
      xm_disable_trans --> off
      ypbind_disable_trans --> off
      yppasswdd_disable_trans --> off
      ypserv_disable_trans --> off
      ypxfr_disable_trans --> off
      zarafa_deliver_disable_trans --> off
      zarafa_gateway_disable_trans --> off
      zarafa_ical_disable_trans --> off
      zarafa_indexer_disable_trans --> off
      zarafa_monitor_disable_trans --> off
      zarafa_server_disable_trans --> off
      zarafa_spooler_disable_trans --> off
      zebra_disable_trans --> off

      Удалить
  8. [root@localhost ~]# sestatus
    SELinux status: enabled
    SELinuxfs mount: /selinux
    Current mode: enforcing
    Mode from config file: enforcing
    Policy version: 21
    Policy from config file: targeted

    ОтветитьУдалить
  9. Пример отсюда http://centos.name/?page/tipsandtricks/SelinuxBooleans

    Пример: SELinux не позволит вашему httpd демону взаимодействовать с LDAP сервером на той же машине. Вы должны иметь возможность аутентифицироваться на LDAP. Вы знаете, что интересующие вас политики содержат слово httpd.

    [root@localhost ~]# getsebool -a | grep httpd
    allow_httpd_anon_write --> off
    allow_httpd_bugzilla_script_anon_write --> off
    allow_httpd_cvs_script_anon_write --> off
    allow_httpd_mod_auth_pam --> off
    allow_httpd_nagios_script_anon_write --> off
    allow_httpd_prewikka_script_anon_write --> off
    allow_httpd_squid_script_anon_write --> off
    allow_httpd_sys_script_anon_write --> off
    httpd_builtin_scripting --> on
    httpd_can_network_connect --> off
    httpd_can_network_connect_db --> off
    httpd_can_network_relay --> off
    httpd_can_sendmail --> on
    httpd_disable_trans --> off
    httpd_enable_cgi --> on
    httpd_enable_ftp_server --> off
    httpd_enable_homedirs --> on
    httpd_execmem --> off
    httpd_read_user_content --> off
    httpd_rotatelogs_disable_trans --> off
    httpd_setrlimit --> off
    httpd_ssi_exec --> off
    httpd_suexec_disable_trans --> off
    httpd_tty_comm --> on
    httpd_unified --> on
    httpd_use_cifs --> off
    httpd_use_nfs --> off

    ОтветитьУдалить
  10. вот листинг папки var/wwww/html
    папка commons отличается от остальных только :user_home_t
    [root@localhost html]# ls -Z
    drwxr-xr-x 6226 6226 root:object_r:user_home_t commons
    drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t drupal-7.9
    drwxrwxr-x 504 502 root:object_r:httpd_sys_content_t op6
    drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t op622
    drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t openpublish79
    drwxr-xr-x root root root:object_r:httpd_sys_content_t tattler
    -rwxr-xr-x root root root:object_r:httpd_sys_content_t test.php
    -rw------- root root root:object_r:httpd_sys_content_t test.php~
    -rw-r--r-- root root user_u:object_r:httpd_sys_content_t touch

    ОтветитьУдалить
  11. ls
    SELinux options:

    --lcontext Display security context. Enable -l. Lines
    will probably be too wide for most displays.
    -Z, --context Display security context so it fits on most
    displays. Displays only mode, user, group,
    security context and file name.
    --scontext Display only security context and file name.


    --help display this help and exit
    --version output version information and exit

    ОтветитьУдалить
  12. После прочтения http://docs.fedoraproject.org/ru-RU/Fedora/13/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html
    Выполнил комманду изменения контекста:
    [root@localhost html]# chcon -R -t httpd_sys_content_t commons
    [root@localhost html]# ls -Z
    drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t commons
    drwxr-xr-x 6226 6226 root:object_r:httpd_sys_content_t drupal-7.9
    drwxrwxr-x 504 502 root:object_r:httpd_sys_content_t op6

    ОтветитьУдалить
    Ответы
    1. После выполнени команды мой браузер сразу (без рестарта httpd) перестал выдавать 403 ошибку (на этой странице) и вывел меня на страницу
      http://localhost/commons/install.php?profile=commons
      Но проблема вроде бы не решена, поскольку надо разобраться временно ли удалось переключить контекст (как написано в docs.fedoraproject.org)
      "Команда chcon вносит изменения в контекст SELinux для файлов. Однако, изменения, вносимые с помощью команды chcon не сохраняются после перемаркирования файловой системы или выполнения команды /sbin/restorecon."

      Удалить
    2. Подробнее о SELinux можно прочитать http://wiki.centos.org/HowTos/SELinux
      на английском.
      Надо бы знать структуру файлов и папок, команды
      Все здесь есть...

      Удалить
  13. Вот опять я попададю на ошибку 403 (у вас нет доступа)
    Догадываюсь, что дело в SelinusНахожу этот пост... тупо повторяю последнюю комманду, потом догадываюсь, что надо поменять
    "commons" на "opigno"
    [root@localhost html]# chcon -R -t httpd_sys_content_t opigno
    После этого я получил доступ не сразу... ??? , набрал
    https://localhost/opigno/
    Потом обновил вид в браузере..., не понимаю, почему, но
    Строка
    https://localhost/opigno/install.php?profile=opigno_lms&locale=en
    высветилась не сразу...

    ОтветитьУдалить
    Ответы
    1. Разобрался. Для смнеы разрешений использовал влкакдку Properties контекстного меню Nautilus...
      Там есть мпана разрешений и владельцев для папок и для файлов отдельно. Я впопыхах менял для файлов... а не для папок...

      Удалить