Installing Samba
The first thing to do if you havn’t done so already, is install samba and the associate tools. To install samba on Ubuntu Hardy Heron (I’m assuming of course that your linux box is connected to the internet). Type the following in a terminal.
To mount Windows filesystems using SMB, you will also need to install smbfs, to do this enter the command:
Creating Samba User
There are two steps to creating a user. First we’ll run the smbpasswd utility to create a samba password for the user.
Next, we’ll add that username to the smbusers file.
Add in the following line, substituting the username with the one you want to give access to. The format is < ubuntuusename >= “< samba username >“. You can use a different samba user name to map to an ubuntu account, but that’s not really necessary right now.
Now you can create samba shares and give access to the users that you listed here.
Creating Samba Shares
I want to create a shares that can be accessed by everyone on my network called “Shared”, of course you will have to login with “guest” (no password required) to get access. Also everyone who has a samba account can get access to there own files (See above “Creating Samba Users”). Remember that everytime you change your smb.conf you will need to restart samba on your server, to do this you will need to type the following at the terminal.
First of all, create a copy of the original samba config file and call it smb.conf.old. It’s always handy to have a copy of the original file just in case it all goes a bit wrong.
You need to edit my smb.conf file, to do this, type the following in a terminal.
Remember that everytime you change your smb.conf file, you will need to restart samba. You do this by typing the following in a terminal window.
My smb.conf is below:
server string = %h server (Samba, Ubuntu)
interfaces = 127.0.0.0/8, eth0
bind interfaces only = Yes
map to guest = Bad User
obey pam restrictions = Yes
passdb backend = tdbsam
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
name resolve order = wins bcast
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = No
wins support = Yes
panic action = /usr/share/samba/panic-action %d
idmap uid = 10000-20000
idmap gid = 10000-20000
template shell = /bin/bash
winbind enum users = Yes
winbind enum groups = Yes
invalid users = root
[homes]
comment = Home Directory
valid users = %S
read only = No
create mask = 0644
case sensitive = Yes
veto files = /*.{*}/.*/mail/bin/
browseable = No
[Shared]
comment = Music Photos and Video
path = /home/backup/billy/Public
guest only = Yes
guest ok = Yes
case sensitive = Yes
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
References:
The Official Samba 3.2 Howto and reference guide
Creating a samba user on Ubuntu
Samba/Configure a Workgroup from the Shell
Setting up Vista Home Premium to access Samba
What I want to do is be able to logon to my home samba server in one of 2 ways, either by mapping the drive or by going through Network Neighbourhood (Network in Vista). After reading a bit about Vista Home Premium, I found that the only way to map the drive was to either.
- Ensure that your Vista login, username and password are the same as your Samba server.
- Don’t have a windows login password but map the drives using a small Visual Basic Script.
- Upgrade to Vista Business or Vista Ultimate (no way I’m paying any more money).
You can check this yourself if you wish by following the steps below (or you can take my word for it)
:
- Clicking on the start button (bottom Left)
- In the Start Search field type “User Account” then click “User Accounts” at the top of the box under programs.
- Under Tasks, select “Manage your Network Passwords”
- Click on the “Add” button. As you can see below, it’s greyed out which is just an absolute nonsence. Why they couldn’t have just added it is just beyond me.

I found this vbscript that connects a network share and placed it in my startup folder.
You can do the same thing. Just create a text file in notepad, paste the code below into it. Then change the server, share, username, and password information. Don’t delete any of the commas or quotation marks. They are all needed. Save it to your startup folder. In Vista your startup folder is buried deep.
Mine is located here: C:\Users\Billy\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Yours should be the same except for the name “Billy” of course.
Here’s the code:
objNetwork.MapNetworkDrive "Z:", "\\server\share", , "username", "password"
You can add more mapped drives by copying that last line as many times as you need.
Reference: