linux共享--samba

  1. install:  system-config-samba:

  2. 配置一个文件夹为任何人都可以访问时,在xp下仍然需要输入用户名和密码, 这是因为还需要将security 设置为share, 如下:

[root@linux /]# vi /etc/samba/smb.conf

[global]下修改:

  workgroup = WORKGROUP (改成同一工作组名)

  security=user (安全及别:需要输入用户名密码,访问)

samba四种安全等级:

share:用户不需要账户及密码即可登录samba服务器

user:由提供服务的samba服务器负责检查账户及密码

server:检查账户及密码的工作由另一台windowssamba服务器负责

domain:指定windows域控制服务器来验证用户的账户及密码

  encrypt passwdords=yes (去掉前面的注释“;”,如果为no,改为yes

no的话,将会提示无权访问提示

  在文件末尾添加共享的文件夹 




samba服务器配置


一、修改samba配置文件


[root@linux /]# vi /etc/samba/smb.conf


[global]下修改:


  workgroup = WORKGROUP (改成同一工作组名)


  security=user (安全及别:需要输入用户名密码,访问)


samba四种安全等级:


share:用户不需要账户及密码即可登录samba服务器

user:由提供服务的samba服务器负责检查账户及密码

server:检查账户及密码的工作由另一台windowssamba服务器负责

domain:指定windows域控制服务器来验证用户的账户及密码


  encrypt passwdords=yes (去掉前面的注释“;”,如果为no,改为yes


no的话,将会提示无权访问提示。


  在文件末尾添加共享的文件夹 

   [linux99] (要共享文件夹名)

comment = linux99  (描述)

path = /linux99  (指定要共享文件的位置)

writeable = yes

public = yes

read only = yes

create mode=0664 (这是文件权限)

directory mode=0777 (这是目录权限)

可以在根目录创建linux99目录时,修改linux99文件夹权限,chmod 777 /linux99


保存退出。


二、创建 samba 用户


[root@Linux99 ~]# useradd test 添加test用户

[root@Linux99 ~]# smbpasswd -a test /-a,为了生成密码文件smbpasswd,该密码是windows登陆Linuxsamba用户密码)


New SMB password: /输入密码

Retype new SMB password:

Added user test.   /成功添加samba用户


三、重启samba服务

[root@Linux99 ~]# service smb restart

Shutting down SMB services: [ OK ]

Shutting down NMB services: [ OK ]

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]



完成之后,就可以用windows访问samba共享文件夹,输入刚创建的linux用户及密码,像windows共享夹一样,访问linux操系统了。



2. 如果共享文件夹是放在/root下的,会遇到error:

Is not accessible, you might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The specified server cannot perform the requested operation.



posted @ 2012-06-12 15:08  alxe_yu  阅读(320)  评论(0编辑  收藏  举报