//Fedora Linux 系统Samba服务器架设攻略
rpm -qa | grep smb // 首先检查是否已经安装好了Samba
/*如果出现一下三行则已经安装好了;
libsmbios-libs-0.13.10-1.fc8
libsmbios-bin-0.13.10-1.fc8
pam_smb-1.1.7-7.2.2
*/
mount /dev/cdrom /mnt/cdrom/ //mount:block device /dev/sr0/ is write-protected,mounting read-only
cd /mnt/cdrom/
ls
/* fedora.css isolinux README-BURNING-ISOS-en_US.txt repoview RPM-GPG-KEY-fedora RPM-GPG-KEY-rawhide
GPL media.repo RELEASE-NOTES-en_US.html RPM-GPG-KEY RPM-GPG-KEY-fedora-rawhide stylesheet-images
images Packages repodata RPM-GPG-KEY-beta RPM-GPG-KEY-fedora-test TRANS.TBL
*/
cd Packages/
rpm -ivh -aid smb*
//安装成功
cd /etc/samba/ //进入samba目录
ls
/*文件为:lmhosts smb.conf smbpasswd smbusers //smb.conf是服务器的主要配置文件
smbpasswd文件用来存储用户账号以及经过md5加密之后的密码
*/
//编辑:smb.conf文件
vi smb.conf
/*
#=============== Global Settings ===========================
[global]
workgroup = MSHOME //将linux 加入的工作组名,我这里加入了MSHOME工作组。
server string = Samba //这是服务器描述信息,方便标志资源。可以随便输入。
encrypt passwords = yes //表示是否对用户的密码进行加密,这里选择加密,安全!
public = yes //定义一个共享是否对公共访问开放。当设置为 yes 时,在系统上没有帐户用户将基于所定义的客户帐户的属性来接收访问。
smb passwd file = /etc/samba/smbpasswd //这是账号密码的存放文件
netbios name = mm's samba //在外部访问该samba服务器时,显示的信息。
# --------------------------- Logging Options -----------------------------
# logs split per machine
log file = /var/log/samba/log.%m //log文件的存放位置。
# max 50KB per log file, then rotate
max log size = 0 //log 文件的大小限制,设置为0表示不做限制。
# ----------------------- Standalone Server Options ------------------------
security = user
//共享的安全级别,samba有四种安全等级:
//user:由提供服务的samba服务器负责检查账户及密码(默认)
//share:用户不需要账户及密码即可登录samba服务器
//server:检查账户及密码的工作由另一台windows或samba服务器负责
//domain;指定windows域控制服务器来验证用户的账户及密码
passdb backend = tdbsam
*/
//加入共享目录/opt
【rose】
comment=This is my samba server ! //设置共享信息,随便输入
path= /opt//共享目录
valid users = testuser //可以访问次共享目录的用户,这里设置为testuser
public=yes
writable=yes//用户是否可写,yes代表允许
wq!//保存退出
//启动smb服务
service smb start
Starting SMB services:[OK]
service nmb start
Starting NMB services:[ok]
//添加刚才设置共享目录的用户;testuser
useradd testuser //建立一个名叫testuser的用户
passwd t //给testuser用户添加密码
Changing password for user samba
New password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new password: (确认密码)
passwd: all authentication tokens updated successfully
cat /etc/passwd |mksmbpasswd.sh > /etc/samba/smbpasswd //更新/etc/samba/smbpasswd 文件
smbpasswd -a testuser //创建smba账户
New SMB password:
Retype new SMB password:
Added user testuser.
service smb restart //重启smb服务
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@cisco samba]# service nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]
//访问!
smbclient -L //192.168.1.10 //在Linux 下访问Windows的共享资源,显示信息为:
Password:
Domain=[XPSP3] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename Type Comment
--------- ---- -------
Printer Adobe PDF Office Document Image Writer
session request to 192.168.1.10 failed (Called name not present)
session request to 192 failed (Called name not present)
Domain=[XPSP3] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Server Comment
--------- -------
Workgroup Master
--------- -------
smbclient -L //192.168.1.12 //在Linux 下访问自己的samba服务器,显示信息为:
Password:
Anonymous login successful
Domain=[MSHOME] OS=[Unix] Server=[Samba 3.0.26a-6.fc8]
Sharename Type Comment
--------- ---- -------
homes Disk Home Directories
rose Disk This is my samba server!
test-1 Disk This is my samba server!
IPC$ IPC IPC Service (Samba)
Anonymous login successful
Domain=[MSHOME] OS=[Unix] Server=[Samba 3.0.26a-6.fc8]
Server Comment
--------- -------
MM'S SAMBA Samba
Workgroup Master
--------- -------