码迷,mamicode.com
首页 > 系统相关 > 详细

How to install Samba server on Ubuntu 12.04

时间:2014-12-27 12:38:46      阅读:572      评论:0      收藏:0      [点我收藏+]

标签:

Part 1: Configuring anonymous share with samba server

To install the samba package,enter the following command:

sudo apt-get install samba samba-common

技术分享

Check the version of installed samba software by using this command:

smbd --version

技术分享

Also install these suggested packages for samba:

sudo apt-get install python-glade2 system-config-samba

技术分享

Go to your Windows machine and use this command in order to check the WORKGROUP name:

net config workstation

技术分享

It will show the output, something like this:

技术分享

Backup the smb.conf file, then delete it and create the new one:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 
sudo rm /etc/samba/smb.conf 
sudo touch /etc/samba/smb.conf 
sudo nano /etc/samba/smb.conf

技术分享

Add this, in your smb.conf file (or change it according to your requirement):

#======================= Global Settings ===================================== 
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
[MyShare]
path = /samba/share 
browsable =yes
writable = yes
guest ok = yes
read only = no

技术分享

Save the smb.conf file and restart the service:

sudo service smbd restart

技术分享

Access the samba share from windows (where ubuntu is the name of my samba server):

技术分享

wao, we are able to access the samba share successfully :-)

技术分享

Let’s try to create something, inside the share folder:

技术分享

Error, we cannot create anything inside the share folder :-(

技术分享

Check the current permission on the samba share:

cd /samba/
ls -l

技术分享

Change it, in such a way that everyone can read and write it(Check it, that it is allowed in your environment or not):

sudo chmod -R 0777 share
ls -l

技术分享

Try to create something again, inside the share folder:

技术分享

Verify the newly created file on samba server:

cd share/
ls -l 

技术分享

 

Part 2: Add and manage users and groups

Add a group in your ubuntu server (in my case smbgrp):

sudo addgroup smbgrp

技术分享

Create a new share, set the permission on the share ,add the user to the samba group and create samba password:

cd /samba/
sudo chown -R arbab:smbgrp secure/ 
ls -l 
sudo chmod -R 0770 secure/
ls -l
sudo adduser arbab smbgrp
sudo smbpasswd -a arbab

技术分享

Add the newly created samba share in smb.conf file:

[secure]
 path = /samba/secure
 valid users = @smbgrp
 guest ok = no
 writable = yes
 browsable = yes
 create mask = 0777

技术分享

Restart the samba service and check the syntax error with testparm:

sudo service smbd restart 
sudo testparm

技术分享

Testing from Windows Machine:

技术分享

技术分享

技术分享

Verification from Ubuntu server:

cd /samba/secure/
ls -l

技术分享

Hope this will help you!

Please Remember me in your prayers!

 

Source page from :  http://rbgeek.wordpress.com/2012/04/25/how-to-install-samba-server-on-ubuntu-12-04/

How to install Samba server on Ubuntu 12.04

标签:

原文地址:http://www.cnblogs.com/Jim-william/p/4188169.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!