在Debian Squeeze下安装配置SAMBA

Samba可以使我们在Linux和Windows计算机间分享文件。在目前的版本(v3),不仅可存取及分享SMB的资料夹及印表机,本身还可以整合到Windows Server的网域、扮演为网域控制站(Domain Controller)以及加入Active Directory成员。简而言之,可用该应用在Windows与UNIX系列OS之间搭起一座桥梁,让两者的资源可互通有无。

下面为大家介绍如何在Debian Squeeze下安装配置SAMBA。

#1假定服务器IP为:192.168.58.142

#2安装Samba打开终端,输入命令,安装Samba及相关依赖:

sudo apt-get install libcupsys2 samba samba-common

你会遇到下面的问题:

Workgroup/Domain Name:

这里我们填写一个工作组的名字即可。

编辑smb.conf文件,使用命令:

vi /etc/samba/smb.conf

下面激活行“security = user”,让Linux操作系统可以

[…]# “security = user” is always a good idea. This will require a Unix account# in this server for every user accessing the server. See# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html# in the samba-doc package for details.security = user[…]

保存文件,退出,重启Samba

/etc/init.d/samba restart

#3 添加Samba分享创建文件分享目录,,向用户组开放:

mkdir -p /home/samba-share/alluserschown -R root:users /home/samba-share/allusers/chmod -R ug+rwx,o+rx-w /home/samba-share/allusers/

在文件 /etc/samba/smb.conf添加下面行,首先,使用命令,打开:

vi /etc/samba/smb.conf

接下来,添加下面内容:

[allusers]comment = All Userspath = /home/samba-share/allusersvalid users = @usersforce group = userscreate mask = 0660directory mask = 0771writable = yes

如果你希望所有的用户可以通过Samba服务器来读、写他们的主目录,可以在文件 /etc/samba/smb.conf 添加下面的内容:

[…][homes]comment = Home Directoriesbrowseable = novalid users = @userswritable = yescreate mask = 0700directory mask = 0700

然后保存,重启Samba服务器:

/etc/init.d/samba restart

不要忘记设置配置文件为只读:{这个地方有点不懂,原文讲的是“Dont forget to set read only to noin the config file”}

# By default, the home directories are exported read-only. Change the# next parameter to ‘no’ if you want to be able to write to them.read only = no

#4 添加、管理用户比如,添加用户Bentutu,命令如下:

useradd Bentutu -m -G users

为Bentutu设置密码:

root@oss:~# passwd Bentutu

Enter new UNIX password:Retype new UNIX password:

现在把Bentutu添加到Samba用户数据库:

root@oss:~# smbpasswd -a BentutuOutputNew SMB password:Retype new SMB password:Added user Bentutu.root@oss6:~#

现在,就可以从文件管理器登录了,别忘了地址{地址是\\192.168.58.142或者\\192.168.58.142\Bentutu},其中Bentutu为你设置的用户名。

孤单不是与生俱来,而是由你爱上一个人的那一刻开始。

在Debian Squeeze下安装配置SAMBA

相关文章:

你感兴趣的文章:

标签云: