Samba problems

mintydroid

Expert Member
Joined
Aug 8, 2013
Messages
1,872
Reaction score
2
Hi guys

Busy sorting my server. I have setup Samba as per the documentation provided in the samba app from the Ubuntu app store but I can't seem to connect to those shares from another Ubuntu computer on the network.

I've used authentication by user. User as per the Unix dropdown list and then provided a windows username and password. I've also added what to share and gave permissions to users on those shares.

How do I go about connecting to those shares from the other Ubuntu computer?
 
Have you set up samba correctly?

foa check your iptables since it may be set up to block your other users

then check your /etc/fstab because Samba only has permission to mount shares that the samba user is allowed (have a gander at /etc/passwd)

lastly make sure you haven't installed more than one version of samba, because this will confuse things.
 
Hi guys

Busy sorting my server. I have setup Samba as per the documentation provided in the samba app from the Ubuntu app store but I can't seem to connect to those shares from another Ubuntu computer on the network.

I've used authentication by user. User as per the Unix dropdown list and then provided a windows username and password. I've also added what to share and gave permissions to users on those shares.

How do I go about connecting to those shares from the other Ubuntu computer?

Have you set up samba correctly?

foa check your iptables since it may be set up to block your other users

then check your /etc/fstab because Samba only has permission to mount shares that the samba user is allowed (have a gander at /etc/passwd)

lastly make sure you haven't installed more than one version of samba, because this will confuse things.

Yep, check firewall first as it may be the most obvious. Ubuntu used ufw last time I had it installed, just run:

Code:
sudo ufw status

to see if it's enabled. Check here for documentation on how to open up services: https://wiki.ubuntu.com/UncomplicatedFirewall
 
As the others have already pointed out this is often a firewall problem. An easy way to check the firewall is to install gufw using the software center. This is GUI that allows you to easily check the status. Try turning the firewall off (on both machines). If samba suddenly starts working then the problem lies in this area.
 
Cool guys thanks for the advice. Will try this weekend and let you'll know.
 
Fiddled the past couple hours on the server and still no luck. Firewall is not active.

I've googled the problem and it just seems that samba is broken in 14.04 in the smb.conf file. Can't seem to get it to work.

Gonna try Mint 17 and see if I fair better.
 
why use samba between linux machines when you have nfs?
 
ssh also works well btw but it has some overhead. All you have to do on the server is run the ssh daemon and on the client simply point your file manager to the ip address (ssh://username@ip_address) and then create a shortcut to the base folder you want for instant access.
 
Last edited:
Trying to connect my pc to the server so I can watch the movies on the server via XBMC
 
if all you want to do is stream movies to devices, try minidlna. Simply
sudo apt-get install minidlna

...and edit the file /etc/minidlna.conf with the locations of the videos, music, etc. XBMC can then pick up the shares with its built in uPnP client.
 
Here's how i got mine setup.

The guide assumed you have a seperate partition or drive that contains the files you want to share. If this is not the case you can skip the fstab section and some of the guide dealing with permission is a bit overboard but it will still work. Also remember to change the suggested share path from /media/strorage/[share folder] to /home/[your user]/[share folder] throughout the guide.

Your user and your group throughout the guide will be replaced by your unix user and group unless you want to create a different user for samba authentication.

Get your drives UUID and note it don
sudo blkid

Create the mount point
sudo mkdir /media/storage
sudo chown [your user:your group] /media/storage

Open fstab
sudo nano /etc/fstab

Add the mount entry, i usualy use the basic command but there are much more robust options you could use.
UUID=[xxxx-xxxx-xxxx] /media/storage [file system eg. ext4 ntfs] defaults 0 1

Press "Ctrl-X" then "Y" then "Enter" to save and exit.

Reboot the computer to test fstab by seeing if your drives got mounted.
sudo reboot
sudo mount

Create the actual share folder and set permission, i'm assuming it's only you that will be using the shares or to make it easy for multi user you can make it public.
sudo mkdir /media/storage/movies

For public share do the following
sudo chown nobody:nogroup /media/storage/movies

For password protected shares do the following.
sudo chown [your user:your group] /media/storage/documents
sudo smbpasswd -a [your user]

Next edit the samba config
sudo nano /etc/smb.conf

The following is samples from my samba config, add it to the bottom of the config file.

Public Share
[movies]
path = /media/storage/movies
browsable = yes
writeable = yes
guest ok = yes
guest account = nobody
guest only = yes

Authenticated Share
[documents]
path = /media/storage/documents
browsable = yes
guest ok = no
printable = no
available = yes
force create mode = 0755
force directory mode = 0755
create mask = 0755
valid users = [your user]
read only = no

Press "Ctrl-X" then "Y" then "Enter" to save and exit.

Restart Samba
sudo service smbd restart

Test. Access a share and see if you can create a folder or file.

If you use the server to move files into the shared folders use sudo to override any possible permissions issues and afterwards remember to change the owner user and group to that which you specified in the samba config.

sudo chown -R [user:group] [path to share]
 
Last edited:
Here's how i got mine setup.

The guide assumed you have a seperate partition or drive that contains the files you want to share. If this is not the case you can skip the fstab section and some of the guide dealing with permission is a bit overboard but it will still work. Also remember to change the suggested share path from /media/strorage/[share folder] to /home/[your user]/[share folder] throughout the guide.

Your user and your group throughout the guide will be replaced by your unix user and group unless you want to create a different user for samba authentication.

Get your drives UUID and note it don


Create the mount point



Open fstab


Add the mount entry, i usualy use the basic command but there are much more robust options you could use.


Press "Ctrl-X" then "Y" then "Enter" to save and exit.

Reboot the computer to test fstab by seeing if your drives got mounted.



Create the actual share folder and set permission, i'm assuming it's only you that will be using the shares or to make it easy for multi user you can make it public.


For public share do the following


For password protected shares do the following.



Next edit the samba config


The following is samples from my samba config, add it to the bottom of the config file.

Public Share


Authenticated Share


Press "Ctrl-X" then "Y" then "Enter" to save and exit.

Restart Samba


Test. Access a share and see if you can create a folder or file.

If you use the server to move files into the shared folders use sudo to override any possible permissions issues and afterwards remember to change the owner user and group to that which you specified in the samba config.
Which version linux have you used this on? Mint 17?

I've used another simpler tutorial. I converted the existing user and gave it a password then I edited the .conf file and tried connecting and my windows pc couldn't see it at all.
 
I used it on Ubuntu headless server 12.04 LTS and more recently Ubuntu Desktop 14.04 LTS.

Could you access the server by running from windows?
I've tried mapping the drive by typing in "\\[ipaddress]\media\WD1" and it said it can't find the share.
 
I've tried mapping the drive by typing in "\\[ipaddress]\media\WD1" and it said it can't find the share.

What i'm wondering is if the server is accessible at all. If samba is working properly then you should at least be able to access the server from a windows host even though you won't see any shares. If this is the case you likely only have a syntax error in the conf file with the share definitions.
\\[ipaddress]


If you can't access the server at all you'll have to start troubleshooting or start over.

Starting over is the easiest, the following command will remove samba and purge all config files.
sudo apt-get remove --purge samba

Then try reinstalling and using sample samba config i posted, modifying it for your share paths and users ofc. Don't change any other samba settings to start with until you have it working then you can make a backup of the working config and start fiddling with other settings.
sudo apt-get install samba

If you want to figure out what's wrong start by checking the following log file and post the content here.
sudo nano /var/log/samba/log.smbd

Have you check if your network card on the server is working? I'm assuming you installed a desktop manager so the easiest would be to try open a web page.

From terminal do the following and check if eth[x] or wlan[x] has a ip address associated with it.
sudo ifconfig

If you don't see eth or wlan then your network card is not up either because it is not communicating with the dhcp server or it is lacking drivers.
 
What i'm wondering is if the server is accessible at all. If samba is working properly then you should at least be able to access the server from a windows host even though you won't see any shares. If this is the case you likely only have a syntax error in the conf file with the share definitions.



If you can't access the server at all you'll have to start troubleshooting or start over.

Starting over is the easiest, the following command will remove samba and purge all config files.


Then try reinstalling and using sample samba config i posted, modifying it for your share paths and users ofc. Don't change any other samba settings to start with until you have it working then you can make a backup of the working config and start fiddling with other settings.


If you want to figure out what's wrong start by checking the following log file and post the content here.


Have you check if your network card on the server is working? I'm assuming you installed a desktop manager so the easiest would be to try open a web page.

From terminal do the following and check if eth[x] or wlan[x] has a ip address associated with it.


If you don't see eth or wlan then your network card is not up either because it is not communicating with the dhcp server or it is lacking drivers.
I can see the server has been assigned an ipaddress on the routers config page.

Is a workgroup the same as a domain?

If all else fails I'll start again.
 
I've tried mapping the drive by typing in "\\[ipaddress]\media\WD1" and it said it can't find the share.

I didn't realise it at first but i think i spotted the problem.

It looks like your trying to access the unix path as the share but you must use the share name.

When you look at the samba config file the first line of each share defintion is the sharename.

For example to access the following share id map \\ipaddress\movies

[movies]
path = /media/storage/movies
browsable = yes
writeable = yes
guest ok = yes
guest account = nobody
guest only = yes
 
I didn't realise it at first but i think i spotted the problem.

It looks like your trying to access the unix path as the share but you must use the share name.

When you look at the samba config file the first line of each share defintion is the sharename.

For example to access the following share id map \\ipaddress\movies
I'll try again as you have listed it here.
 
Moving very slowly on this. I can see the ethernet ip being picked up via terminal.

Got stuck on fstab as I've messed up the mount point and defaults such that I couldn't access the drive. I had to delete the entry and restart. Going to read up this weekend on fstab before I give it a go again.
 
Top
Sign up to the MyBroadband newsletter
X