◆sambaサーバ構築
とりあえずメモです。
[root@hackerbobchan ~]# yum -y install samba
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
* addons: rsync.atworks.co.jp
* base: rsync.atworks.co.jp
* extras: rsync.atworks.co.jp
* updates: rsync.atworks.co.jp
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 1.1 kB 00:00
updates | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.i386 0:3.0.33-3.15.el5_4.1 set to be updated
--> Processing Dependency: samba-common = 3.0.33-3.15.el5_4.1 for package: samba
--> Processing Dependency: perl(Convert::ASN1) for package: samba
--> Running transaction check
---> Package perl-Convert-ASN1.noarch 0:0.20-1.1 set to be updated
---> Package samba-common.i386 0:3.0.33-3.15.el5_4.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================
Package Arch Version Repository Size
=========================================================================================
Installing:
samba i386 3.0.33-3.15.el5_4.1 updates 16 M
Installing for dependencies:
perl-Convert-ASN1 noarch 0.20-1.1 base 42 k
samba-common i386 3.0.33-3.15.el5_4.1 updates 8.7 M
Transaction Summary
=========================================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 25 M
Downloading Packages:
(1/3): perl-Convert-ASN1-0.20-1.1.noarch.rpm | 42 kB 00:00
(2/3): samba-common-3.0.33-3.15.el5_4.1.i386.rpm | 8.7 MB 00:28
(3/3): samba-3.0.33-3.15.el5_4.1.i386.rpm | 16 MB 00:53
-----------------------------------------------------------------------------------------
Total 308 kB/s | 25 MB 01:22
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : samba-common 1/3
Installing : perl-Convert-ASN1 2/3
Installing : samba 3/3
Installed:
samba.i386 0:3.0.33-3.15.el5_4.1
Dependency Installed:
perl-Convert-ASN1.noarch 0:0.20-1.1 samba-common.i386 0:3.0.33-3.15.el5_4.1
Complete!
[root@hackerbobchan ~]# useradd fedora
[root@hackerbobchan ~]# passwd fedora
Changing password for user fedora.
New UNIX password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@hackerbobchan ~]# pdbedit -a fedora
tdbsam_open: Converting version 0 database to version 3.
new password:
retype new password:
account_policy_get: tdb_fetch_uint32 failed for field 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 10 (refuse machine password change), returning 0
Unix username: fedora
NT username:
Account Flags: [U ]
User SID: S-1-5-21-3568868896-2162012733-1341180622-1000
Primary Group SID: S-1-5-21-3568868896-2162012733-1341180622-513
Full Name:
Home Directory: \\hackerbobchan\fedora
HomeDir Drive:
Logon Script:
Profile Path: \\hackerbobchan\fedora\profile
Domain: HACKERBOBCHAN
Account desc:
Workstations:
Munged dial:
Logon time: 0
Logoff time: never
Kickoff time: never
Password last set: 日, 21 2月 2010 01:03:40 JST
Password can change: 日, 21 2月 2010 01:03:40 JST
Password must change: never
Last bad password : 0
Bad password count : 0
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
[root@hackerbobchan ~]# vi mkhomedir.sh
#!/bin/bash
for user in `ls /home`
do
id $user > /dev/null 2>&1
[ $? -eq 0 ] && \
[ ! -d /home/$user/samba ] && \
mkdir /home/$user/samba && \
chown $user:$user /home/$user/samba && \
echo "/home/$user/samba create"
done
[root@hackerbobchan ~]# ls
anaconda-ks.cfg install.log mkhomedir.sh
cpan2rpm-2.027-1.noarch.rpm install.log.syslog
[root@hackerbobchan ~]# sh mkhomedir.sh
/home/centos/samba create
/home/fedora/samba create
/home/ogura/samba create
[root@hackerbobchan ~]# mkdir /etc/skel/samba
[root@hackerbobchan ~]# mkdir /home/samba
[root@hackerbobchan ~]# chown nobody:nobody /home/samba
[root@hackerbobchan ~]# cp -p /etc/samba/smb.conf /etc/samba/smb.conf_20100221
[root@hackerbobchan ~]# vi /etc/samba/smb.conf
[root@hackerbobchan ~]# diff /etc/samba/smb.conf /etc/samba/smb.conf_20100221
74c74
< workgroup = WORKGROUP
---
> workgroup = MYGROUP
80c80
< hosts allow = 127. 192.168.11.
---
> ; hosts allow = 127. 192.168.12. 192.168.13.
221c221
< load printers = no
---
> load printers = yes
250d249
< path = %H/samba
255,261d253
< vfs objects = recycle
< recycle:repository = .recycle
< recycle:keeptree = no
< recycle:versions = yes
< recycle:touch = no
< recycle:maxsize = 0
< recycle:exclude = *.tmp ~$*
297,310d288
<
< [public]
< comment = Public Stuff
< path = /home/samba
< public = yes
< writable = yes
< only guest = yes
< vfs objects = recycle
< recycle:repository = .recycle
< recycle:keeptree = no
< recycle:versions = yes
< recycle:touch = no
< recycle:maxsize = 0
< recycle:exclude = *.tmp ~$*
[root@hackerbobchan ~]# /etc/rc.d/init.d/smb start
SMB サービスを起動中: [ OK ]
NMB サービスを起動中: [ OK ]
[root@hackerbobchan ~]# /etc/rc.d/init.d/nmb start
-bash: /etc/rc.d/init.d/nmb: そのようなファイルやディレクトリはありません
※最近はnmbを別で起動しなくてもいいんですね。
[root@hackerbobchan ~]# chkconfig smb on
[root@hackerbobchan ~]# chkconfig --list smb
smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@hackerbobchan ~]# vi /etc/cron.weekly/recyclewatch
#!/bin/bash
for user in `ls /home/`
do
if [ -d /home/$user/.recycle ]; then
tmpwatch -f 720 /home/$user/.recycle/
fi
done
"/etc/cron.weekly/recyclewatch" [New] 8L, 139C written
[root@hackerbobchan ~]# chmod +x /etc/cron.weekly/recyclewatch