How do I get file sharing to work?

Asked by tadiv on 2008-09-28

SO -- I have samba AND gshare installed and I can't seen to see files on other machines even though I have marked the files / folders for sharing... gshare seems to be intended to be easy, but I'm not able to make it work... (and of course, setting up samba just seems to always be a headache) Any ideas?

Thanks,
Tom

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu samba Edit question
Assignee:
No assignee Edit question
Solved by:
Thomas Kluyver
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

Might be this video can help you: http://screencasts.ubuntu.com/SAMBA_Filesharing

Hope this helps

Revision history for this message
tadiv (tadiv-comcast) said :
#2

Okay -- so this video seems promising -- but I'm 1:15 into it and already there is a problem. Namely, when I select Places -> Network I don't see the workgroup of my Windows machine -- I don't see any workgroup or computers...Okay -- 3:18 into the video -- "Shared Folders" is not available to me under System -> Administration....

SO - I'm not sure, but I need something to get this stuff working before I can use it...

Any other ideas?

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#3

Gshare is for ftp, it seems, so it won't show up on Windows machines as a network share (although you can access FTP in Internet explorer).

gsambad may help you to configure SAMBA ("sudo aptitude install gsambad"), although you still need to know what to set. In particular, make sure you put your computer in the same workgroup as your Windows computers.

Revision history for this message
tadiv (tadiv-comcast) said :
#4

Okay -- I installed gsambad and it looks like a nice configuration utility, but Places -> Network shows "Windows Network (as it has been) but nothing under that...

Here is my smb.conf (maybe that will help)...
---------------------------------------------------------------------------------

[global]
netbios name = tadiv-main
server string = CAD architects, Stockholm. East 32nd st, 34th floor
workgroup = HOMENET
security = user
hosts allow = 127. 192.168.0.
interfaces = 127.0.0.1/8 192.168.0.0/24
remote announce = 192.168.0.255
remote browse sync = 192.168.0.255
printcap name = /etc/printcap
load printers = yes
cups options = raw
printing = cups
guest account = smbguest
log file = /var/log/samba/samba.log
max log size = 1000
null passwords = no
username level = 8
password level = 8
encrypt passwords = yes
unix password sync = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
local master = no
domain master = no
preferred master = no
domain logons = no
os level = 33
logon drive = m:
logon home = \\%L\homes\%u
logon path = \\%L\profiles\%u
logon script = %G.bat
time server = no
name resolve order = wins lmhosts bcast
wins support = no
wins server =
wins proxy = no
dns proxy = no
preserve case = yes
short preserve case = yes
client use spnego = no
client signing = no
client schannel = no
server signing = no
server schannel = no
nt pipe support = yes
nt status support = yes
allow trusted domains = no
obey pam restrictions = yes
enable spoolss = yes
client plaintext auth = no
disable netbios = no
follow symlinks = no
update encrypted = yes
pam password change = no
passwd chat timeout = 120
hostname lookups = no
username map = /etc/samba/smbusers
smb passwd file = /etc/samba/smbpasswd
passwd program = /usr/bin/passwd '%u'
passwd chat = *New*password* %n\n *ReType*new*password* %n\n *passwd*changed*\n
add user script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null '%u'
add user to group script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null -g '%g' '%u'
add group script = /usr/sbin/groupadd '%g'
delete user script = /usr/sbin/userdel '%u'
delete user from group script = /usr/sbin/userdel '%u' '%g'
delete group script = /usr/sbin/groupdel '%g'
add machine script = /usr/sbin/useradd -d /dev/null -g sambamachines -c 'Samba Machine Account' -s /dev/null -M '%u'
machine password timeout = 120
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431
template shell = /dev/null
winbind use default domain = yes
winbind separator = @
winbind cache time = 360
winbind trusted domains only = yes
winbind nested groups = no
winbind nss info = no
winbind refresh tickets = no
winbind offline logon = no

[homes]
comment = Home Directories
path = /home
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = no
printable = no
share modes = no
locking = no

[netlogon]
comment = Network Logon Service
path = /home/netlogon
read only = no
available = yes
browseable = yes
writable = no
guest ok = no
public = no
printable = no
share modes = no
locking = no

[profiles]
comment = User Profiles
path = /var/samba/profiles
read only = no
available = yes
browseable = no
writable = yes
guest ok = no
public = no
printable = no
locking = no
create mode = 0600
directory mask = 0700

[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
writable = no
guest ok = no
public = no
printable = yes
share modes = no
locking = no

[pdf-documents]
path = /home/pdf-documents
comment = Converted PDF Documents
available = yes
browseable = yes
writeable = yes
guest ok = yes

[pdf-printer]
path = /tmp
comment = PDF Printer Service
printable = yes
guest ok = yes
use client driver = yes
printing = bsd
print command = /usr/bin/gsambadpdf %s %u
lpq command =
lprm command =

[tadiv Music]
path = /home/tadiv/Music
comment = Music Directories
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = no
printable = no
share modes = no
locking = no
---------------------------------------------------------------------------------
Thanks,
Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#5

Samba can be a bit temperamental, in my experience.

Obvious things to check:
Is HOMENET the same workgroup name as on your Windows computers?
Is nmbd (the NetBIOS name server) running?
If you enter the command "smbtree", does anything show up (I don't know what password you'll need to use--blank works for me, but my setup is different).

Revision history for this message
tadiv (tadiv-comcast) said :
#6

Yes, "HOMENET" is the same workgroup for all my machines (even though MS tries to force "MSHOME" on everyone)...

How do I tell if nmbd is running?

smbtree results (assuming I know the password):
tadiv@tadiv-main:~$ smbtree
Password:
tadiv@tadiv-main:~$

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#7

To tell if nmbd is running:
ps -eaf | grep nmbd

Revision history for this message
tadiv (tadiv-comcast) said :
#8

The grep is the only result as follows:

tadiv@tadiv-main:~$ ps -eaf | grep nmbd
tadiv 7459 7441 0 16:22 pts/0 00:00:00 grep nmbd
tadiv@tadiv-main:~$

So -- how do I get it running (because I think that the above result means that it is not)?

Tom

P.S. results for smbd are:

tadiv@tadiv-main:~$ ps -eaf | grep smbd
root 6491 1 0 16:12 ? 00:00:00 /usr/sbin/smbd -D
root 6591 6491 0 16:12 ? 00:00:00 /usr/sbin/smbd -D
tadiv 7464 7441 0 16:24 pts/0 00:00:00 grep smbd
tadiv@tadiv-main:~$

Revision history for this message
tadiv (tadiv-comcast) said :
#9

Oh, and if I were paying attention, I would have noted that gsambad showed nmbd as "inactive" - but I can't figure out how to activate it there...

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#10

Yup. To get it running in the short term, just run "sudo nmbd". If this solves the problem, then we can worry about how to get it running when you start your computer.

Revision history for this message
tadiv (tadiv-comcast) said :
#11

"sudo nmbd" returns no errors, but gsambad still shows nmbd as inactive and nothing shows up under Places -> Network -> Windows Network - I'm off to work - I'll look for more this afternoon.

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#12

Hmm. You may have to close and re-open gsambad before it shows up. Also, try "ps -eaf | grep nmbd" again to see if it's still running.

Revision history for this message
tadiv (tadiv-comcast) said :
#13

Here are the results -- it does not seem to be running after I try to start it...

tadiv@tadiv-main:~$ ps -eaf | grep nmbd
tadiv 7492 7474 0 16:39 pts/0 00:00:00 grep nmbd
tadiv@tadiv-main:~$ sudo nmbd
[sudo] password for tadiv:
tadiv@tadiv-main:~$ ps -eaf | grep nmbd
tadiv 7496 7474 0 16:39 pts/0 00:00:00 grep nmbd
tadiv@tadiv-main:~$

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#14

Hmmm. If you do "sudo nmbd -i", to run it in interactive mode, what happens?

Revision history for this message
tadiv (tadiv-comcast) said :
#15

Here are the results...

tadiv@tadiv-main:~$ sudo nmbd -i
Netbios nameserver version 3.0.28a started.
Copyright Andrew Tridgell and the Samba Team 1992-2008
standard input is not a socket, assuming -D option
create_subnets: unable to create any subnet from given interfaces. nmbd is terminating
ERROR: Failed when creating subnet lists. Exiting.
tadiv@tadiv-main:~$

here is it w/ -d=3...

tadiv@tadiv-main:~$ sudo nmbd -i -d=1
Netbios nameserver version 3.0.28a started.
Copyright Andrew Tridgell and the Samba Team 1992-2008
standard input is not a socket, assuming -D option
create_subnets: unable to create any subnet from given interfaces. nmbd is terminating
ERROR: Failed when creating subnet lists. Exiting.
tadiv@tadiv-main:~$ sudo nmbd -i -d=3
Netbios nameserver version 3.0.28a started.
Copyright Andrew Tridgell and the Samba Team 1992-2008
lp_load: refreshing parameters
Initialising global parameters
params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf"
Processing section "[global]"
services not loaded
standard input is not a socket, assuming -D option
Registered MSG_REQ_POOL_USAGE
Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
Opening sockets 137
open_sockets: Broadcast sockets opened.
added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0
Can't determine ip for broadcast address 192.168.0.0/24
create_subnets: Ignoring loopback interface.
create_subnets: unable to create any subnet from given interfaces. nmbd is terminating
ERROR: Failed when creating subnet lists. Exiting.
tadiv@tadiv-main:~$

Tom

Revision history for this message
Best Thomas Kluyver (takluyver) said :
#16

Hmmm. I've remembered that gsambad has a habit of replacing your entire smb.conf when first run, which can be annoying. When it did it to me, I had a look and decided to bring back my old configuration (which it backs up).

Looking at what it's doing, and the man page for smb.conf, I don't think the "interfaces =" line in smb.conf is necessary. I don't have it in mine. According to the man page, without that line, it will automatically query the kernel about active interfaces, and work on those. So I would try backing up and removing that line, then trying nmbd again to see if it will work.

Revision history for this message
tadiv (tadiv-comcast) said :
#17

 Thomas K said 8 hours ago: "...I don't think the "interfaces =" line in smb.conf is necessary."

BINGO!!! I have to work permissions, but this machine now shows up on the network for other machines (it still does not "see itself" or other machines - but other machines see it (a big step forward))... If you have suggestions on this machine seeing others, please add comments...

Thanks!

Tom

Revision history for this message
tadiv (tadiv-comcast) said :
#18

Thanks Thomas K, that solved my question.

Revision history for this message
tadiv (tadiv-comcast) said :
#19

and here is a file from a different machine that seems to work very well...

#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentary and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
#

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = HOMENET

# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
; wins support = no

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
   dns proxy = no

# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = true

#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
; syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
   syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d

####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
; security = user

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
   encrypt passwords = true

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
   passdb backend = tdbsam

   obey pam restrictions = yes

; guest account = nobody
   invalid users = root

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<email address hidden> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how nsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user

########## Domains ###########

# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
; logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
; logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
; load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m

# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
   socket options = TCP_NODELAY

# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
; domain master = auto

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash

# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
; share modes = no

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700

wins support = no
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# Replace 'ntadmin' with the name of the group your admin users are
# members of.
; write list = root, @ntadmin

# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes

# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom

[media]
path = /media
available = yes
browsable = yes
public = yes
writable = no

Revision history for this message
tadiv (tadiv-comcast) said :
#20

Okay -- I'm a little confused -- please tell me if I should 1) re-open this question or 2) open a new question or 3) something else...

I have the above configuration file on this machine (my problem machine) and another machine that can see and access files from my Windows machine. Also, the Windows machine can see and access that other machine. Both machines can see this machine, but neither can access it and this machine does not see any machines (it does not even see the workgroup)...

Any suggestions?

Tom

Revision history for this message
Thomas Kluyver (takluyver) said :
#21

Samba security...I don't know much about it, to be honest--Windows home edition doesn't let you use passwords and so on, and since I'm inside a trusted home network behind a firewall, I just set the security to minimum to make it work. You're welcome to try to replicate it, if you want, but be aware that it will leave your files with no protection at all, so make sure it's only accessible from computers you trust...

Settings I've got set relating to security seem to be:
under [global]:
security = share
guest account = nobody

in each share section:
guest ok = yes
guest only = yes
public = yes

(I haven't copied out my entire smb.conf, so you'll have to find where to put these lines in. For more detail, "man smb.conf")

If this doesn't solve it, I suggest you post a new question, and hope someone else can help you.

Revision history for this message
tadiv (tadiv-comcast) said :
#22

I'll give this a try this evening after I get home from work - I'm also behind a home router... Thnaks again for all your help!

Tom

Revision history for this message
tadiv (tadiv-comcast) said :
#23

I'll give this a try this evening after I get home from work - I'm also behind a home router... I don't understand why this file works on one machine but not this one...

Thanks again for all your help!

Tom