Samba迁移(从Centos5.8至Centos6.4)
目的:A服务器Samba迁移至B服务器(Samba都是RPM安装)
******A服务器******
OS: Centos5.8
安装samba:
yum install samba
设置配置文件:
/etc/samba/smb.conf添加如下几行
[share]
comment = share file
path = /share
writable = yes
write list = @it
create mask = 0664
directory mask = 0775
创建共享用户share:
groupadd –u 700 it
useradd –u 600 –g it share
创建共享账户:smbpasswd –a share
查看用户
# id share
uid=600(share) gid=700(it) groups=700(it)
创建共享目录:
mkdir /share
chown root.it /share
chmod 2770 /share
查看文件
# ll -d /share/
drwxrws--- 4 root it 4096 Mar 4 19:25 /share/
启动服务
service smb start
chkconfig smb on
******B服务器******
OS: Centos6.4
安装samba:
yum install samba
迁移至B服务器
1.迁移samba配置文件,B服务器samba配置文件中添加A服务器的共享文件夹
[share]
comment = share file
path = /share
writable = yes
write list = @it
create mask = 0664
directory mask = 0775
2.迁移共享用户
在/etc/passwd复制用户share
share:x:600:700::/home/share:/bin/bash
在/etc/group复制组it
it:x:700:share
在/etc/shadow复制share
share:!!:16133:0:99999:7:::
迁移家目录用户:
rsync –av /home/share B服务器:/home/
3.迁移samba账户信息
scp /etc/samba/{passwd.tdb,secrets.tdb} B服务器:/var/lib/samba/private
Centos5配置信息在/etc/samba/下
Centos6配置信息在/var/lib/samba/private下
4.迁移共享目录
rsync –av /share B服务器:/
启动服务
service smb start
chkconfig smb on
注:如果原来配置文件中账户密码是如下配置:
security = user
passdb backend = smbpasswd
那么scp /etc/samba/{passwd.tdb,secrets.tdb} B服务器:/var/lib/samba/private需要改为
scp /etc/smbpasswd B服务器:/var/lib/samba/private
默认配置是,密码保存在passwd.tdb和secrets.tdb这两个文件中
security = user
passdb backend = tdbsam
/var/lib/samba/private可以改为/etc/samba/下,需修改配置如下
security = user
smbpasswd file = /etc/samba/smbpasswd
passdb backend = smbpasswd