Ubuntu 12.04下Samba相关配置

以下是在Ubuntu 12.04中的安装和配置过程:

备注:以下是在非root用户下的配置,如果是在root用户下,把sudo 去掉即可。

1.安装samba:

samba: 

sudo apt-get install samba

smbclient: 

sudo apt-get install smbclient

2.修改配置文件:

sudo vi /etc/samba/smb.conf

在文件末尾加上如下[share]  (相当于在home目录项增加了一个新用户)

[share]
comment = Share Folder require password
browseable = yes
path = /home/share
create mask = 0777
directory mask = 0777
valid users = wry1224
force user = nobody
force group = nogroup
public = yes
writable = yes
available = yes 

3.设置用户wry1224登入samba的密码和保存退出后重启samba:

root@ubuntu:/# smbpasswd -a wry1224
New SMB password:
Retype new SMB password:
root@ubuntu:/# smbd restart

4. 切换到 /home/目录下创建一个用户目录:

sudo mkdir share

5.设置目录的权限:  (777代表最高权限,可读可写可执行)

chmod 777 share

 

6./etc/samba/smb.conf 文件配置

[global]

 

workgroup = WORKGROUP
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of

 

   workgroup = WORKGROUP

# public shares, not just authenticated ones

   usershare allow guests = no

[share]
comment = Share Folder require password
browseable = yes
path = /home/share
create mask = 0777
directory mask = 0777
valid users = wry1224
force user = nobody
force group = nogroup
public = yes
writable = yes
available = yes

7. /etc/samba/smbusers文件添加如下内容

wry1224="network username"

8.最后打开我的电脑,空白位置右键添加一个网络位置

输入 \\IP地址(linux)\share   按提示步骤输入用户名和密码(samba 的用户名和密码)。

设置无密码访问配置如下:

Find the ### Authentication ### section (might be called Administration in older versions of Samba), where it says

security = user

Change it to

security = share

and make sure the line does not start with a semicolon. If it does, remove it.

A few lines down from that you’ll see

; guest account = nobody

Remove the semicolon at the beginning of the line.

Scroll to the very bottom of the file and put in the following, adjusted for your own system

[Share name]
writable = yes
path = /home/share
public = yes
guest ok = yes
guest only = yes

guest account = nobody
browsable = yes

Save the file and quit 
In the terminal restart the samba server to reload the conf file

sudo /etc/init.d/samba restart

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值