LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Why does Samba Server only work with default "homes" directory? (https://www.linuxquestions.org/questions/linux-server-73/why-does-samba-server-only-work-with-default-homes-directory-924831/)

chrisgreg 01-20-2012 11:57 AM

Why does Samba Server only work with default "homes" directory?
 
Hi All

I have been trying to set up a samba server. I have got the server to work fine with the default homes directory, but I'd like to be able to select just one folder to share, videos for example. However, whenever I remove the [homes] directory from the configuration file I get the message

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.4.7]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

I am using the command

smbclient //<hostname>/<sharename> -U <username>

My .conf file is as follows

[global]

workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)l
wins support = no
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
panic action = /usr/share/samba/panic-action %d

security = user
username map = /etc/samba/smbusers

encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = no
unix password sync = no
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

pam password change = no

map to guest = bad user


[Videos]
comment = Videos
path = /home/chris/Videos
read only = No
guest ok = Yes
public = Yes
browseable = Yes
create mask = 0666
directory mask = 0777

[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0777
directory mask = 0777

valid users = chris

I have filled this in as best I can from searching through the forums, but it seems that other people seem to be able to remove the [homes] directory without a problem.

Am I being a complete idiot or is there something else wrong?

Any help would be really appreciated.

T3RM1NVT0R 01-20-2012 01:07 PM

@ Reply
 
Hi chrisgreg,

Welcome to LQ!!!

Few questions for you:

1. Does this work when you have [homes] enabled. Are you able to get into videos directory?
2. Permissions set on /home/chris/Videos
3.
Code:

map to guest = bad user
don't know but does not appears right to me. This one should be commented out I guess.
4. With which user account you are trying to access [Videos] share when [homes] is removed?

chrisgreg 01-20-2012 03:28 PM

Thanks for your response
 
Hi, thank you for your response

When I have homes enabled I can view everything from local machine through terminal, and I can access everything from a windows 7 laptop and an Ubuntu laptop. I have mounted an external usb HDD into the homes directory which I can also access. The problem is as soon as I disable [homes] I then cant connect to smb, not even from local machine. On local terminal I get this

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.4.7]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

I can remove the map to guest = bad user bit, that was just there when I installed the package.

I am using the same user for everything to keep it simple.

It's not just the videos share, it is anything that isn't [homes], I have tried various different shares. I even tried just creating one with the path /home/chris and that didn't work either. As soon as I comment out [homes] it wont connect

chrisgreg 01-20-2012 03:36 PM

The permissions are
owner (me) - create and delete folder
group - access folders
others - access folders

T3RM1NVT0R 01-20-2012 03:43 PM

@ Reply
 
Just now noticed that your share path for [Videos] is: path = /home/chris/Videos

It appears to me that as soon as you disable [homes] it prevent any thing to be seen under /home.

Is it possible for you to copy: /home/chris/Videos to / and set the same permissions as you have set up now.

Edit [Videos] section to reflect the new path.

Restart smb and nmb services and then give it a try.

chrisgreg 01-21-2012 02:55 PM

Why does Samba Server only work with default "homes" directory?
 
Hi

I followed your advice, created /Videos and used this as the path for [Videos], as soon as I disable [homes] it won't connect regardless of the new path. Have I missed something obvious? Also when I have [Videos] and [homes] enabled it won't show anything other than the contents of [home]. I tested this by creating another diretory /sambatestshare and created [sambatestshare] in smb. I couldn't see this dir either

T3RM1NVT0R 01-21-2012 03:27 PM

@ Reply
 
Ok. Make a copy of your existing smb.conf file and then edit it as mentioned in this tutorial and see if that works:

http://ubuntuforums.org/showthread.php?t=202605

chrisgreg 01-24-2012 12:43 PM

Hi

I have followed this guide and have used the configuration file, but still the same thing happens. If I specify a file path other than [homes] I get the message NT_STATUS_BAD_NETWORK_NAME. This is very frustrating, is it possible to view the log files for Samba?

T3RM1NVT0R 01-24-2012 01:38 PM

@ Reply
 
Alright. I have tested the following config on my Ubuntu 11.04 and it is working fine. I am able to browse to the folder and am able to create files and folders:

Code:

[global]
    ; General server settings
    netbios name = SAMBA-SERVER
    server string = This is my samba server
    workgroup = SAMBA
    announce version = 5.0
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

    passdb backend = tdbsam
    security = user
    null passwords = false
    username map = /etc/samba/smbusers
    name resolve order = hosts wins bcast

    ;wins support = yes

    syslog = 1
    syslog only = yes

[test]
    path = /test
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    force user = testing
;    force group = YOUR_USERGROUP

Things that I checked are:

1. My firewall setting that is whether it is allowing connection for samba or not.
2. User account is added to smbusers. Did it via smbpasswd -a
3. Services are running both smbd and nmbd.

As you can see I do not have [homes] configured but still it works for me on my Ubuntu system.

chrisgreg 01-24-2012 04:40 PM

brilliant that seems to work fine, I've set up my own directories etc and it all seems to work. Thanks very much for you help, I still don't understand what I was doing wrong but never mind.

Thanks Again

T3RM1NVT0R 01-24-2012 04:52 PM

@ Reply
 
You're welcome.

Please mark the thread as solved. It might be possible that there is something which we overlooked in your config file.

Enjoy linux!!!


All times are GMT -5. The time now is 09:31 AM.