[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:03312] Re: why groupname = username?



小島基靖と申します.

<199712061911.EAA06713@xxxxxxxxxxxxxxxxx>の記事において
私は書きました。
>> 
>>  http://www.redhat.com/support/docs/rhl/RHL-4.2-Users-Guide-HTML/manual/doc072.html
>> が該当する文書のようです.

該当部分だけ訳してみました.原文もつけときます.
ただ,どうにもわかりにくいので,Q & A 式にまとめてみました.
別便で流します.

 http://www.redhat.com/support/docs/rhl/RHL-4.2-Users-Guide-HTML/manual/doc072.html

  10.3.3 User Private Groups
  
  Red Hat Linux では, ユーザープライベートグループ (UPG) を採用し,
  UNIX のグループが簡単に使えるようにした.UPG は 標準的なUNIXのグループ
  管理へ追加も変更もない.ただ,グループを取り扱うために,新しい
  決り事を提示する.デフォルトでは,新規ユーザーを登録すると,
  その新規ユーザーだけ所属するグループへ登録される.概要としては以下の
  ようになる.

  ユーザープライベートグループ
     各々のユーザーは,最初にユーザー名と同じ名前のグループに所属する.
     そのグループのメンバーは,そのユーザーだけである.

  umask = 002
     伝統的な UNIX の umaskは,022.この設定では,ユーザーのファイルを
     他のユーザーや 同じグループのメンバーが変更することはできない.
     UPG では, 全てのユーザーは 各個人のグループを持っているので,
     「グループからの保護」は必要ない.
     umaskが 002 であっても,他のユーザーの個人ファイルの変更はできない.
     umask は /etc/profile で設定されている.

  SGID bit on Directores
     ディレクトリに SGID ビットを付加する( chmod g+s directory )と,
     そのディレクトリ下で作成したファイルは,ディレクトリと同じグルー
     プ属性をもつ.
    
  多くのコンピューターサイトでは,大規模なプロジェクトごとにグループを作り,
  必要な人をグループに登録したがる.従来のやり方で,ファイルを取り扱う
  のは難しかった.なぜなら,ファイルを作ると,そのユーザーが最初に属して
  いるグループのファイルになってしまったから.
  一人でいくつものプロジェクトにかかわっていると,関連するプロジェクトごとに
  ファイルのグループの所属を管理するのが大変になる.
  UPG ならば,グループは自動的に プロジェクトごとにファイルに割り当てられ,
  グループ管理が簡単になる.

  例えば,「devel」というプロジェクトの場合.
  このプロジェクトでは,多くの人が devel ディレクトリ下でdevelのファイル
  を編集する.

  まず,devel というグループをつくり,devel ディレクトリを devel に chgrp する.
  devel のユーザ全員を グループ devel に登録する.
  これで,devel ユーザーは devel ディレクトリ下のファイルを編集したり
  新しいファイルをつくったりできる.そして,そのファイルは devel グルー
  プに所属したままになる.そうすると devel に属する他の ユーザーにも
  いつでも変更できる.

   devel のような 複雑なプロジェクトに属しているときや,
  複数のプロジェクトで働いているとき,プロジェクト間を移動しても,
  ユーザーは 自分の umask や group の設定を変更する必要はない.
  各プロジェクトのメインディレクトリごとにある SGID が適当な groupに
  変更する.

  各ユーザーのホームディレクトリは ユーザーとそのユーザーだけの
  グループに属していて,安全のため,ホームディレクトリには SGID bit がついている.
  デフォルトでは,作成したファイルは,ユーザーが最初に属しているグループ
  になる.だから,SGID bit は余計かもしれない.

  10.3.3.1 User Private Group の概要

  UPG は新しいので,多くの人が UGP とは何か,なぜ,必要なのか と.
  疑問もっている.次に,この概要をしめす.
    
* /usr/lib/emacs/site-lisp のファイルを取り扱う人のグループを作るとす
  る.全員ではなく何人かの人だけを信頼しているとする.そんなときは,

  chown -R root.emacs /usr/lib/emacs/site-lisp

  そして,適当な人を group に追加する.

* ユーザーがディレクトリの中にファイルを作ることができるように,

  chmod 775 /usr/lib/emacs/site-lisp
* けれども,そこで新規に作成したファイルは,そのユーザーのデフォルトの
  グループに所属してしまう.それを防ぐために

  chmod 2775 /usr/lib/emacs/site-lisp
  これで, /usr/lib/emacs/site-lisp の中では,'emacs' グループに
  所属した 新規ファイルが作成される. 
* その 新規ファイルのモードは emacs グループに所属する他のユーザーにも
  編集できるように,ファイルのモードが 664 でなければならない.
  だから,デフォルトの umask は 002 にする.
* もしも,ユーザーのデフォルトグループを users に設定したとすると,
  自分のホームディレクトリのファイルを,users に属した他の
  全ての人に書き込み可能になってしまう.
* これを防ぐため,'private group' がデフォルトのグループになっている.


  まず,デフォルトを umask 002 とし,ユーザー全員を private group に所属
  させることで,簡単にグループ管理ができるし,ユーザーは
  余計なことをせずにグループを利用することができる.
  まず,グループをつくり,ユーザーを登録し,そのグループのディレクトリを
  先に書いたように chown と chmod すればよいのです.

-----------------------------------------------------------------------------
                                      
  10.3.3 User Private Groups
  
   Red Hat Linux uses a user private group (UPG) scheme, which makes UNIX
   groups much easier to use. The UPG scheme does not add or change
   anything in the standard UNIX way of handling groups. It simply offers
   a new convention for handling groups. Whenever you create a new user,
   by default, he or she has a unique group. The scheme works as follows:
   
   User Private Group
          Each user has it's own primary group, to which only it is a
          member.
          
   umask = 002
          The traditional UNIX umask is 022, which prevents other users
          and other members of a user's primary group from modifying a
          user's files. Since every user has their own private group in
          the UPG scheme, this ``group protection'' is not needed. A
          umask of 002 will prevent users from modifying other users'
          private files. The umask is set in /etc/profile.
          
   SGID bit on Directories
          If you set the SGID bit on a directory (with chmod g+s
          directory), files created in that directory will have their
          group set to the directory's group.
          
   Most computing sites like to create a group for each major project and
   assign people to the groups they need to be in. Managing files
   traditionally has been difficult, though, because when someone creates
   a file it is owned by the primary group he or she belongs to. When a
   single person works on multiple projects, it becomes hard to make the
   files owned by the group that is associated with that project. In the
   UPG scheme, groups are automatically assigned to files on a
   project-by-project basis, which makes managing group projects very
   simple.
   
   Let's say you have a big project called devel, with many people
   editing the devel files in a devel directory. Make a group called
   devel, chgrp the devel directory to devel, and add the all the devel
   users to the devel group. Now, all the devel users will be able to
   edit the devel files and create new files in the devel directory, and
   these files will always retain their devel group. Thus, they will
   always be edit-able by other devel users.
   
   If you have multiple projects like devel, and users who are working on
   multiple projects, these users will never have to change their umask
   or group when they move from project to project. The SGID bit on each
   project's main directory ``selects'' the proper group.
   
   Since each user's HOME directory is owned by the user and their
   private group, it is safe to set the SGID bit on the HOME directory.
   However, by default, files are created with the primary group of the
   user, so the SGID bit would be redundant.
   
    10.3.3.1 User Private Group Rationale
    
   Since the UPG scheme is new, many people have questions about it, and
   they wonder why it is necessary. The following is the rationale for
   the scheme.
   
     * You'd like to have a group of people work on a set of files in
       say, the /usr/lib/emacs/site-lisp directory. You trust a few
       people to mess around in there, but certainly not everyone.
     * So you enter:
       
chown -R root.emacs /usr/lib/emacs/site-lisp
       and you add the proper users to the group.
     * To allow the users to actually create files in the directory you
       enter:
       
chmod 775 /usr/lib/emacs/site-lisp
     * But when a user creates a new file it is assigned the group of the
       users default group (usually users). To prevent this you enter
       
chmod 2775 /usr/lib/emacs/site-lisp
       which causes everything in the directory to be created with the
       ``emacs'' group.
     * But the new file needs to be mode 664 for another user in the
       emacs group to be able to edit it. To do this you make the default
       umask 002.
     * Well, this all works fine, except that if your default group is
       ``users'', every file you create in your home directory will be
       writable by everybody in ``users'' (usually everyone).
     * To fix this, you make each user have a ``private group'' as their
       default group.
       
   At this point, by making the default umask 002 and giving everyone a
   private default group, you can easily set up groups that users can
   take advantage of without doing any magic. Just create the group, add
   the users, and do the above chown and chmod on the group's
   directories.

-----------------------------------------------------------------------------