hnakamur’s blog

ものすごい勢いで忘れる私のために未整理でもいいからとりあえずメモ

ラベル Debian の投稿を表示しています。 すべての投稿を表示
ラベル Debian の投稿を表示しています。 すべての投稿を表示

2008-12-03

Debianにはデフォルトではwheelグループが無い



新山 祐介さん著の入門OpenSSHサポートページ)で/etc/sudoersでwheelグループに対して許可を与える設定を使っているというのを呼んでまねしようとしたのですが(私はそれまでは直接ユーザーに許可を与えていた)、CentOSではwheelグループがあるのにDebianには無いことに気づきました。


検索するとDebian referenceに9.2.2 "Why GNU su does not support the wheel group"という節があることを発見。じゃあadmグループで代用するのかと思いきや、Securing Debian Manualに4.10 Providing secure user accessという節があり、wheelグループを追加するのがもっともきれいな方法だとされている。


で、/etc/pam.d/suを見ると以下のようなセクションがある。



# Uncomment this to force users to be a member of group root
# before they can use `su'. You can also add "group=foo"
# to the end of this line if you want to use a group other
# than the default "root" (but this may have side effect of
# denying "root" user, unless she's a member of "foo" or explicitly
# permitted earlier by e.g. "sufficient pam_rootok.so").
# (Replaces the `SU_WHEEL_ONLY' option from login.defs)
# auth required pam_wheel.so


とりあえず



auth required pam_wheel.so group=wheel


と書き換えた後、



# addgroup --gid 11 wheel
# usermod -a -G wheel root
# usermod -a -G wheel rails # railsはsudoを許可したい一般ユーザー


を実行して(wheelのgidはCentOS5では10だが/etc/groupを見るとuucpにとられていて10の次は12だったので11にしてみた)



# su - rails
$ sudo whoami
Password:
rails is not in the sudoers file. This incident will be reported.


と試してみたがエラーになった。


/etc/sudoersへの追加は結局必要らしい(というかPAMのことがよくわかっていないことに今気づいた。後日勉強すること)。



# visudo




%wheel ALL=(ALL) ALL


という行を追加して再度sudoを試すと今度はできた。


その後再度/etc/pam.d/suを見てたら、さっきの節の前に



# This allows root to su without passwords (normal operation)
auth sufficient pam_rootok.so


と書かれていることを発見。rootユーザーをwheelグループに追加するというのは不要でした。





2008-11-29

時計のずれを修正



Debian FAQ - Silicon Linux Wikiを参考にしました。



# vi /etc/default/rcS




UTC=no


に修正。



# tzconfig


で反映しようと思ったら



WARNING: the tzconfig command is deprecated, please use:
dpkg-reconfigure tzdata


と言われたので



# dpkg-reconfigure tzdata


と実行し、CUIでのタイムゾーンで[Asia]/[Tokyo]を選択。


すると



Current default timezone: 'Asia/Tokyo'
Local time is now: Sat Nov 29 10:21:38 JST 2008.
Universal Time is now: Sat Nov 29 01:21:38 UTC 2008.


と表示されて正しくなりました。





2008-11-25

一部のパッケージだけ手動でtestingレポジトリから取得する




/etc/apt/source.listに以下の内容を追加。



# testing
deb http://cdn.debian.or.jp/debian/ testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free


apt-pin止め(apt-pinning)。/etc/apt/preferencesを以下の内容で作成。



ackage: *
Pin: release a=testing
Pin-Priority: 90


aptitude updateで以下のようなエラーが発生するので



# aptitude update
...
Reading package lists... Error!
E: Dynamic MMap ran out of room
E: Error occurred while processing tkman (NewVersion1)
E: Problem with MergeList /var/lib/apt/lists/cdn.debian.or.jp_debian_dists_testing_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
E: Couldn't rebuild package cache


以下のような内容で/etc/apt/apt.confを作成して



APT::Cache-Limit "100000000";
APT::Default-Release "stable";


再度実行して今度はOK。



# aptitude update
...
Reading package lists... Done


aptitude upgradeで何もアップグレードされないことも確認。


testingのutil-vserverパッケージのバージョン確認。



# aptitude -t testing show util-vserver
Package: util-vserver
State: not installed
Automatically installed: no
Version: 0.30.216~r2772-4
...


testingのutil-vserverパッケージのバージョンインストール。



# aptitude -t testing install util-vserver
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages are BROKEN:
libc6 libc6-dev libncurses5-dev
The following packages have been kept back:
adduser apt apt-utils aptitude base-files base-passwd bash binutils bison
bsdmainutils bsdutils busybox bzip2 coreutils cpio cpp cpp-4.1 cron dctrl-tools
debconf debconf-i18n debian-archive-keyring debianutils debootstrap dhcp3-client
dhcp3-common dialog diff dpkg dpkg-dev e2fslibs e2fsprogs ed exim4 exim4-base
exim4-config exim4-daemon-light file findutils flex gcc gcc-4.1 gcc-4.1-base
gettext gettext-base gnupg gpgv grep groff-base gzip hostname ifupdown info
initramfs-tools initscripts iproute iproute-doc iptables iputils-ping
kernel-package klibc-utils klogd less libacl1 libatm1 libattr1 libbeecrypt6
libblkid1 libbz2-1.0 libcomerr2 libcompress-zlib-perl libdb4.2 libedit2 libexpat1
libgcc1 libgcrypt11 libgpg-error0 libklibc libkrb53 liblocale-gettext-perl
liblockfile1 libmagic1 libmail-sendmail-perl libmudflap0 libmudflap0-dev
libncursesw5 libneon25 libpam-modules libpam-runtime libpam0g libpcre3 libpopt0
libreadline5 libsasl2-2 libsepol1 libsigc++-2.0-0c2a libsqlite0 libsqlite3-0 libss2
libssl0.9.8 libstdc++6 libtasn1-3 libtext-charwidth-perl libtext-iconv-perl
libtext-wrapi18n-perl libusb-0.1-4 libuuid1 libvolume-id0 libwrap0 libxml2 login
logrotate lsb-base lvm2 m4 mailx make makedev man-db mawk mime-support mktemp
module-init-tools mount nano ncurses-base ncurses-bin net-tools netbase
openbsd-inetd openssh-blacklist openssh-client openssh-server passwd patch perl
perl-base perl-doc perl-modules po-debconf procps psmisc python python-celementtree
python-central python-elementtree python-libxml2 python-minimal python-rpm
python-sqlite python-support python-urlgrabber python2.4 python2.4-minimal
python2.5 python2.5-minimal readline-common rpm screen sed sharutils ssh sudo
sysklogd sysv-rc sysvinit sysvinit-utils tar tcpd telnet texinfo tzdata udev unzip
update-inetd vim vim-common vim-runtime wget xml-core yum zlib1g
The following packages will be upgraded:
libncurses5 libselinux1 libslang2 util-linux util-vserver
The following packages are RECOMMENDED but will NOT be installed:
libgpm2 libpng12-0
6 packages upgraded, 0 newly installed, 0 to remove and 184 not upgraded.
Need to get 6376kB of archives. After unpacking 811kB will be used.
The following packages have unmet dependencies:
libc6-dev: Depends: libc6 (= 2.3.6.ds1-13etch7) but 2.7-16 is to be installed.
libncurses5-dev: Depends: libncurses5 (= 5.5-5) but 5.6+20080830-1 is to be installed.
libc6: Conflicts: tzdata-etch which is a virtual package.
Resolving dependencies...
The following actions will resolve these dependencies:

Remove the following packages:
linux-kernel-headers

Install the following packages:
libgpm2 [1.20.4-3 (testing)]
libpng12-0 [1.2.27-2 (testing)]
linux-libc-dev [2.6.26-10 (testing)]

Upgrade the following packages:
binutils [2.17-3 (stable, now) -> 2.18.1~cvs20080103-7 (testing)]
libc6-dev [2.3.6.ds1-13etch7 (stable, now) -> 2.7-16 (testing)]
libncurses5-dev [5.5-5 (stable, now) -> 5.6+20080830-1 (testing)]
tzdata [2008e-1etch3 (stable, now) -> 2008h-2 (testing)]

Score is -226

Accept this solution? [Y/n/q/?]


libc6-devとかあがって大丈夫なのかわからないがとりあえずYで行ってみた。





ブログ アーカイブ