Debian 管理ノート http://www.rad51.net/blog/linuxnote/ Debian 管理ノート ja Jeans CMS © Weblog http://backend.userland.com/rss https://www.rad51.net/jeans/skins/jeans/images/jeans2.gif Debian 管理ノート http://www.rad51.net/blog/linuxnote/ SAMBA http://www.rad51.net/blog/linuxnote/?itemid=713
apt-get install samba
apt-get install swat

設定は、http://192.168.1.xx:901/から行う。
色々行って動くようになった。ポイントは、
1)valid usersの設定
2)ユーザーパスワードの登録
3)read only = Noの設定
4)ディレクトリのパーミッション設定
あたりかな?思い出せない。


/var/www/ディレクトリの所有者をrootから通常ユーザに変更し、このユーザ権限でファイル操作のほとんどを行うことにした。当然、SAMBAでこのディレクトリに読み書きできるようにしてある。]]>
SAMBA http://www.rad51.net/blog/linuxnote/?itemid=713 Sat, 28 Feb 2009 23:38:17 PST ITEM713_20090228
Apache/PHP/SQLite http://www.rad51.net/blog/linuxnote/?itemid=712
apt-get install apache2
apt-get install php5
apt-get install php5-sqlite
apt-get install php5-sqlite3
/usr/sbin/apache2ctl restart

ちなみに、Apacheの設定ファイルは/etc/apache2/apache2.confのようで、このファイルで次のように記述されている。
# Include all the user configurations:
Include /etc/apache2/httpd.conf
細かな設定は、このhttpd.confに記述すればよさそう。(追記:/etc/apache2/sites-enabled/000-default 要設定:下記参照)

PHPの設定ファイルは、/etc/php5/apache2/php.ini にある。ざっと見た感じデフォルトの設定で気がついたのは、register_globals=off, magic_quote_gpc=on, memory_limit=16M。あとで修正する。

追記:上記の方法でmb_stringはインストールされるが、GDはされないので、別途 apt-get install php5-gd の必要アリ。

/etc/apache2/sites-enabled/000-defaultの設定(抜粋)
        <Directory /var/www/>
                AuthUserFile /root/.htpasswd
                AuthGroupFile /dev/null
                AuthName "Please enter username and password"
                AuthType Basic
                require valid-user

                #Options Indexes FollowSymLinks MultiViews
                Options FollowSymLinks
                AllowOverride All
                Order deny,allow
                deny from all
                allow from 192.168.0.0/16
                allow from 129.16.97.0/24
        </Directory>

/etc/php5/apache2/php.iniの設定(変更部分抜粋)
short_open_tag = Off
memory_limit = 128M
magic_quotes_gpc = Off
allow_url_fopen = Off
]]>
Apache http://www.rad51.net/blog/linuxnote/?itemid=712 Sat, 28 Feb 2009 19:43:02 PST ITEM712_20090228
start up scripts http://www.rad51.net/blog/linuxnote/?itemid=711
#!/bin/sh
#chmod 700
/root/startup.sh


現在のところ、/root/startup.shは、次の通り
#!/bin/sh
#chmod 700
/root/iptables.sh

ついでに、次の内容で /root/.bash_logout を作成(locate用のデータベース更新用)
updatedb
]]>
General http://www.rad51.net/blog/linuxnote/?itemid=711 Sat, 28 Feb 2009 18:47:24 PST ITEM711_20090228
新しくLinux serverを構築 http://www.rad51.net/blog/linuxnote/?itemid=708 VIA EMIA-M)に256MBのRAMを挿入し、amazonで購入した40GB(およそ$20)のHDDを接続して、サーバとした。

Debianのインストール時のみCD-ROMを接続し、今ははずしてある。その後の管理にはネットを使えばよいので、CD-ROMは必要ない。ただ、この状態でapt-getするとCD-ROMを読みにいこうとするので、/etc/apt/sources.listファイルを編集して、CD-ROMをリストから除外した。

まずapt-get sshでSSHをインストール。これを行えばサーバを直接触る必要は無い。次に、iptablesをセットした。次の内容でiptables.shを用意し、ファイアウォールの設定変更のたびに実行する形。これを公開するのはあまりよくないのだが、今回は家庭内サーバとしての使用で接続先クライアントが限られているため、ここにメモしておくことにした。

#!/bin/sh
#/root/iptables.sh
#chmod 700

iptables -F

#Forward policy: DROP
iptables -P FORWARD DROP

#Output policy: ACCEPT
iptables -P OUTPUT ACCEPT

#Set time before limitting input
iptables -P INPUT ACCEPT
ntpdate xxxxx
hwclock --systohc

#Input policy: DROP
iptables -P INPUT DROP

#localhost
iptables -A INPUT -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT

#intranet
iptables -A INPUT -s 192.168.0.0/16 -p udp -j ACCEPT
iptables -A INPUT -s 192.168.0.0/16 -p tcp -j ACCEPT

#DNS lookup
iptables -A INPUT -s 192.168.0.0/16 -p udp --sport 53 --dport 1024: -j ACCEPT

#limit ping (accept once every second)
iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT

#accesss from office (http, ssh & ftp)
iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 20 -j ACCEPT

#http server
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p udp --dport 80 -j ACCEPT

#https server
#iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 443 -j ACCEPT

#Samba server
#iptables -A INPUT -s xxx.xxx.xxx.0/24 -p udp --dport 137 -j ACCEPT
#iptables -A INPUT -s xxx.xxx.xxx.0/24 -p udp --dport 138 -j ACCEPT
#iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 139 -j ACCEPT
#iptables -A INPUT -s xxx.xxx.xxx.0/24 -p tcp --dport 445 -j ACCEPT

#cliant
iptables -A INPUT -p tcp ! --syn --dport 1024: -j ACCEPT
#ftp cliant
iptables -A INPUT -p tcp ! --sport 20 --dport 1024: -j ACCEPT

echo "The iptables has been set:"
iptables --list

ここまですれば、ルーターの設定で外に接続するようにしても大丈夫。]]>
General http://www.rad51.net/blog/linuxnote/?itemid=708 Sun, 22 Feb 2009 23:47:29 PST ITEM708_20090222
tar http://www.rad51.net/blog/linuxnote/?itemid=301
tar zcvf newfile.tar.gz *

など。]]>
tips http://www.rad51.net/blog/linuxnote/?itemid=301 Thu, 03 May 2007 20:00:33 PDT ITEM301_20070503
GD http://www.rad51.net/blog/linuxnote/?itemid=298 kandk:~# apt-get install php4-gd Reading package lists... Done Building dependency tree... Done The following extra packages will be installed:   libgd2-xpm libt1-5 libxpm4 Suggested packages:   libgd-tools The following packages will be REMOVED:   libgd2-noxpm The following NEW packages will be installed:   libgd2-xpm libt1-5 libxpm4 php4-gd 0 upgraded, 4 newly installed, 1 to remove and 0 not upgraded. Need to get 427kB of archives. After unpacking 684kB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://linux.csua.berkeley.edu etch/main libxpm4 1:3.5.5-2 [35.5kB] Get:2 http://linux.csua.berkeley.edu etch/main libgd2-xpm 2.0.33-5.2 [204kB] Get:3 http://linux.csua.berkeley.edu etch/main libt1-5 5.1.0-2 [155kB] Get:4 http://linux.csua.berkeley.edu etch/main php4-gd 6:4.4.4-8+etch1 [32.3kB] Fetched 427kB in 2s (150kB/s)   dpkg: libgd2-noxpm: dependency problems, but removing anyway as you request: analog depends on libgd2-noxpm (>= 2.0.33) | libgd2-xpm (>= 2.0.33); however:   Package libgd2-noxpm is to be removed.   Package libgd2-xpm is not installed. (Reading database ... 32205 files and directories currently installed.) Removing libgd2-noxpm ... Selecting previously deselected package libxpm4. (Reading database ... 32197 files and directories currently installed.) Unpacking libxpm4 (from .../libxpm4_1%3a3.5.5-2_powerpc.deb) ... Selecting previously deselected package libgd2-xpm. Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.33-5.2_powerpc.deb) ... Selecting previously deselected package libt1-5. Unpacking libt1-5 (from .../libt1-5_5.1.0-2_powerpc.deb) ... Selecting previously deselected package php4-gd. Unpacking php4-gd (from .../php4-gd_6%3a4.4.4-8+etch1_powerpc.deb) ... Setting up libxpm4 (3.5.5-2) ... Setting up libgd2-xpm (2.0.33-5.2) ... Setting up libt1-5 (5.1.0-2) ... Setting up php4-gd (4.4.4-8+etch1) ... kandk:~# vi /etc/php4/apache2/php.ini extension=gd.so kandk:~# /etc/init.d/apache2 restart]]> Apache http://www.rad51.net/blog/linuxnote/?itemid=298 Wed, 02 May 2007 15:40:20 PDT ITEM298_20070502 SQLite設定 http://www.rad51.net/blog/linuxnote/?itemid=297
kandk:~# apt-get install php4-sqlite
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  libsqlite0
The following NEW packages will be installed:
  libsqlite0 php4-sqlite
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 203kB of archives.
After unpacking 573kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://linux.csua.berkeley.edu etch/main libsqlite0 2.8.17-2 [181kB]
Get:2 http://linux.csua.berkeley.edu etch/main php4-sqlite 1.0.2-12+b1 [22.1kB]
Fetched 203kB in 1s (108kB/s)       
Preconfiguring packages ...
Selecting previously deselected package libsqlite0.
(Reading database ... 32192 files and directories currently installed.)
Unpacking libsqlite0 (from .../libsqlite0_2.8.17-2_powerpc.deb) ...
Selecting previously deselected package php4-sqlite.
Unpacking php4-sqlite (from .../php4-sqlite_1.0.2-12+b1_powerpc.deb) ...
Setting up libsqlite0 (2.8.17-2) ...

Setting up php4-sqlite (1.0.2-12+b1) ...

kandk:~# vi /etc/php4/apache2/php.ini

extension=sqlite.so

kandk:~# /etc/init.d/apache2 restart

]]>
SQLite http://www.rad51.net/blog/linuxnote/?itemid=297 Wed, 02 May 2007 15:24:31 PDT ITEM297_20070502
SAMBA設定 http://www.rad51.net/blog/linuxnote/?itemid=296 ユーザーにwrite権限を与えないと、書き込みできない。global 設定でこれを行う。]]> SAMBA http://www.rad51.net/blog/linuxnote/?itemid=296 Wed, 02 May 2007 15:11:33 PDT ITEM296_20070502 ファイル検索 http://www.rad51.net/blog/linuxnote/?itemid=295 General http://www.rad51.net/blog/linuxnote/?itemid=295 Wed, 02 May 2007 14:49:37 PDT ITEM295_20070502 PHP設定 http://www.rad51.net/blog/linuxnote/?itemid=294
MySQL も SQLite も使えないので、インストールする必要あり。]]>
PHP http://www.rad51.net/blog/linuxnote/?itemid=294 Wed, 02 May 2007 14:44:09 PDT ITEM294_20070502