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.
 
 
 

3.7 KiB

layout status published title author wordpress_id wordpress_url date date_gmt categories tags
post publish true how to config Samba server and user [{display_name } {login } {email } {url }] 6 http://blog.10ninox.com/?p=6 2007-08-23 03:35:52 +0700 2007-08-23 03:35:52 +0700 [Uncategorized linux] [how to linux]

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 security=share. 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.

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.

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

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.

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.

for editing Samba configuration file (smb.conf) you have to get in there

sudo gedit /etc/samba/smb.conf

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.

[share-name]
path = /media/hdax/xxx/
comment = whatever you want
available = yes
browsable = yes
public = yes
writable = yes/no

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

valid user = user-name
guest ok = yes/no

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.

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.

For creating user, you will run the smbpasswd utility to create user and password

sudo smbpasswd -a user-name

Then you have to add that user to smbusers file

sudo gedit /etc/samba/smbusers

What you have to put in there is this form

system-user-name = "smb-user-name"

As you see, you may use Samba username (is what you add in smbpasswd) that differs from your username in the system depending on choice of preference.

All these methods above, you will be able to make many share folders with many conditions as you wish :-P

Note: If you just want to share all share folders without any restricts, you may change the line security = user in smb.conf to security = share and that's all set.