You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
4.0 KiB

10 years ago
---
layout: post
status: publish
published: true
title: how to config Samba server and user
author:
display_name: ''
login: ''
email: ''
url: ''
wordpress_id: 6
wordpress_url: http://blog.10ninox.com/?p=6
date: '2007-08-23 03:35:52 +0700'
date_gmt: '2007-08-23 03:35:52 +0700'
categories:
- Uncategorized
- linux
tags:
- how to
- linux
---
<p>First, I was switching from all time Windows user to Linux user, more specifically Ubuntu--first Linux that I can use regularly. I was wondering if I can share files over the network with Windows as well. I know that there is Samba service out there but I don't know how to configure it properly. I messed things up as usual; all I knew to make it work is editing /etc/samba/smb.conf as <em>security=share</em>. Then I could get in there easily but no protection at all. Now I know, so I think it might be a good idea to explain in my ways instead of reading any-distro-docs which sometimes is too complex for novice users.</p>
<p>First of all, you have to install Samba server. I won't go through this process because if you don't know about this, you have to find out and get used to Linux first. My recommendation is trying with Debian, such as Ubuntu. It's really easy to understand.</p>
<p>Second, we have to configure the smb.conf file. This time you have to be as "root" to make a share folder. You have 2 choices here, GUI or editing the file. I found that GUI is easy to understand but I can't get it work for some reasons, thus I choose the traditional way :-P</p>
<p>After we already created share folders, we have to create a user for Samba too. This the point I misunderstood for a while; I thought that Samba will use the user from the system; however, it's not and system and Samba user are not the same as well.</p>
<p>These 3 steps are all you have to do to make it work perfectly. I brief all the processes first so you can imagine what we are doing in each step.</p>
<p>for editing Samba configuration file (smb.conf) you have to get in there</p>
<p class="codebox"> sudo gedit /etc/samba/smb.conf</p>
<p>once you get in there you will find a lot of comments and samples; you may go through the file for more understanding of each. However, we will pay attention to how to set share folder.</p>
<p class="codebox">[share-name]<br />
path = /media/hdax/xxx/<br />
comment = whatever you want<br />
available = yes<br />
browsable = yes<br />
public = yes<br />
writable = yes/no</p>
<p>This is what you have to insert at the end of the file. After you put the proper value, you will be able to see this share from another Windows PCs. However, you can't browse the file right now because of login window. Whatever user and password you fill are not working :-P Don't be surprise, that's normal. You still have to know 2 more values which are</p>
<p class="codebox">valid user = user-name<br />
guest ok = yes/no</p>
<p>the first one, valid user, is which user you give permission to read and/or write. Another one, guest ok, is to enable guest user which is read-only user.</p>
<p>After this step, if you enable guest user, you will be able to see the share folder without any problem. If not, you still have to go on setting user.</p>
<p>For creating user, you will run the smbpasswd utility to create user and password</p>
<p class="codebox">sudo smbpasswd -a user-name</p>
<p>Then you have to add that user to smbusers file</p>
<p class="codebox">sudo gedit /etc/samba/smbusers</p>
<p>What you have to put in there is this form</p>
<p class="codebox">system-user-name = "smb-user-name"</p>
<p>As you see, you may use Samba username (is what you add in <em>smbpasswd</em>) that differs from your username in the system depending on choice of preference.</p>
<p>All these methods above, you will be able to make many share folders with many conditions as you wish :-P</p>
<p><u><strong>Note:</strong></u> If you just want to share all share folders without any restricts, you may change the line <em>security = user</em> in <em>smb.conf</em> to <em>security = share</em> and that's all set.</p>