
Here’s my setup. I’ve got a large network that’s accessible by hordes of people. On this network I have an Ubuntu box acting as a file server. I want a limited number of folks to be able to put files on it, take files off of it and access it from a number of different operating systems (OSX, Windows and Linux). How to do that? Well, the unix folks can use ssh and scp to connect and move files around (as can the more advanced windows folks
)but for graphical sharing or mapping a network drive via Windows, we need Samba to get involved.
Put on your red cape, your spandex pants and your big “S” shirt. Then take a pic of yourself and send it to me. When you’re done doing that, we can install Samba.
sudo apt-get install samba smbfs
Now that we’ve got samba installed, let’s create a local user with which people can log in with.
Go to System-> Administration-> Users and Groups.
I created a new group (for this demonstration, I’ll call it newgroup) and a new user (let’s call it newuser). Add the new user to the new group. I’m not going to go through every step of the gui as it’s very straightforward.
Now that you’ve got a group and user, let’s give them access to your samba share.
sudo smbpasswd -a username
gedit /etc/samba/smbusers
Now, in the smbusers file that you’r editing, add the following:
username = “username”
Here, the first username represents the local user, and the second username, in quotes, represents the samba user. Save the file and exit Gedit.
Now you’ve got Samba installed and running, and are ready to create a folder to share. We’ll call this folder ShareMe for this example.
sudo mkdir /home/ShareMe
sudo chmod 777 /home/ShareMe
sudo cp /etc/smb/samba.conf /etc/smb/samba.conf.bak
sudo gedit /etc/samba.conf
Now, we’ve created the directory and we’re going to add a bit to samba.conf to let the samba know what folder it should be sharing, and to who. First find the line “security = usr” and replace it with:
security = user
username map = /etc/samba/smbusers
Then add the following to the bottom of the file:
[ShareMe]
comment = Public Folder
path = /home/ShareMe
public = yes
writable = no
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup
Now let’s restart Samba and give it a whirl.
sudo /etc/init.d/sambe restart
Once the daemon restarts, head on over to a windows machine and attempt to connect by going to Start-> Run and entering in:
\\pathtoyourcomputer\ShareMe
And that’s how to set up samba sharing.
geek out.
Technorati Tags: samba, linux and windows sharing, file sharing, arsgeek















September 18th, 2007 at 12:52 am
Followed the steps exactly and it just allowed read-only access from the Windows computer.
I’m running Ubuntu Feisty 7.04
November 28th, 2007 at 8:13 pm
it should be /etc/init.d/sambA (not sombe) restart
October 8th, 2008 at 3:30 pm
writable must be set to yes to work.
August 12th, 2009 at 8:49 pm
I followed this tutorial and it worked fine, but at work I had trouble because our server was using SElinux, if you want to you can get around SElinux, and your firewall with the GUI tool system-config-securitylevel
It works great on one hand, but if you don’t know about it, it is killer on the other.
mbs
November 20th, 2009 at 7:24 pm
I was going great, until I got to the gedit part. It said I did not have privileges, even though I am an administrator.
December 31st, 2009 at 11:09 am
it’s not work with windows client ,make a solution for write something in a shared folder from a windows smb client