Debian not writing files from network share (samba)

Associate
Joined
18 Oct 2002
Posts
175
Location
Herts, UK
I've got a strange problem with Debian. I installed this distribution last weekend and everything went smoothly. However tonight I rebooted my Debian box to attach a second hard disk and transfer some data off it (the previous hard disk was unreliable).

The new drive is a Seagate 7200.10 320GB. I've set up a samba share so I can use this drive as an archive / backup disk. I've shared the directory /www as "www" and mapped this as H:\ in Windows. When I create files and directories from my Windows machine on the Debian box everything APPEARS to work fine but when I log in over SSH on the Debian machine and do df -h I can see no disk space has been used. For example:

win-samba.gif


I've created these two directories, and there's about 20 PDF books on Java in this directory (or so Windows would have me believe!).

However this data isn't really on the disk:

debian:/www# du /www
1 /www
debian:/www# ls -la /www
total 2
drwxrwxr-x 2 root serberus 48 2006-10-15 13:08 .
drwxr-xr-x 22 root root 584 2006-10-15 13:08 ..
debian:/www# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 297G 297M 297G 1% /
tmpfs 253M 0 253M 0% /dev/shm


Any clues as to why this is happening? Should I turn off write cache? :confused:

I just lost 90 GB of data when I reset my Debian box (now surely a 8/16MB buffer on the HDD cannot possibly hold this much info - does Windows really cache all network files written to a remote machine for the entire session? I only reset around once a week). I'm lost as to what is going on here... any help appreciated.
 
What are the permissions on the www folder? What user are you authenticating to the share as under Windows? Also, can you post your smb.conf file (or at least the part describing that particular share)?
 
[global]

## Browsing/Identification ###

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

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

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

#### Debugging/Accounting ####

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

# Put a capping on the size of the log files (in Kb).
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/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 guest

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 = no

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Augustin Luton <[email protected]> for
# sending the correct chat script for the passwd program in Debian Potato).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .

# 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 = no

########## 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

# When using [print$], root is implicitly a 'printer admin', but you can
# also give this right to other users to add drivers and set printer
# properties
; printer admin = @ntadmin


######## File sharing ########

# Name mangling options
preserve case = yes
; short preserve case = yes

############ 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/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

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

[www]
browseable = yes

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable = 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 = 0775

# 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 = 0775



# 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
 
Does your user have write support to the share? Samba/Debian does not let average users write to shares as default. I managed to get mine to write using:

Code:
[global]
        log file = /var/log/samba/%m.log
        netbios name = Caroline
        socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
        smb passwd file = /etc/smbpasswd
        server string = Samba %v on (%h)
        workgroup = Workgroup
        os level = 20
        interfaces = 192.168.1.4/255.255.255.0
        encrypt passwords = yes
        hosts allow = 192.168.1.0/255.255.255.0
        security = user
        max log size = 1000
        wins support = true
        unix password sync = yes
        passdb backend = smbpasswd

[homes]
    read only = no
    browseable = no
    valid users = %S
    writeable = yes
    create mode = 0600
    directory mode = 0755

[Shared]
        create mask = 0755
        valid users = andrewf, root
        writeable = yes
        read only = no
        guest ok = no
        directory mask = 0755

        path = /dos
        write list = andrewf, root
        admin users = andrewf, root

I'm new to Samba/Linux so there's probably a few things conflicting somewhere there.
 
You don't seem to have a share defined properly - where is the shared directory??


Delete:

[www]
browseable = yes

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable = 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 = 0775

# 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 = 0775


and add: (at the end of the file, after the [global] definitions

[www]
path = /var/www
writable = yes
browsable = yes
directory mask = 0775
create mask = 0775
public = yes

now try it


and it helps if you delete all the comments inthe file - you don't need it and it makes it hard to read. Make a backup if you feel you need to data in it.
 
I see what you've done you've changed the [homes] share to www. That won't work as [homes] is a special share that maps each users home dir to a samba share of their login name. Basically you need to define an explicit path.

Also don't forget to add a user: smbpasswd <username> then use that user to connect to the samba server.
 
whitecrook said:
Also don't forget to add a user: smbpasswd <username> then use that user to connect to the samba server.

for a new user on samba that would be :-

smbpasswd -a <username>

without the -a it just updates the password for the user named.

cheers
Deano
 
whitecrook said:
You don't seem to have a share defined properly - where is the shared directory??


Delete:

[www]
browseable = yes

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable = 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 = 0775

# 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 = 0775


and add: (at the end of the file, after the [global] definitions

[www]
path = /var/www
writable = yes
browsable = yes
directory mask = 0775
create mask = 0775
public = yes

now try it


and it helps if you delete all the comments inthe file - you don't need it and it makes it hard to read. Make a backup if you feel you need to data in it.
Cheers, I've done this and restarted Samba with:

killall -HUP nmbd && killall -HUP smbd

The logs show:

[2006/10/23 20:22:37, 1] smbd/process.c:async_processing(298)
Reloading services after SIGHUP
[2006/10/23 20:22:37, 0] printing/pcap.c: pcap_cache_reload(149)
Unable to open printcap file /etc/printcap for read!
[2006/10/23 20:22:37, 0] printing/pcap.c: pcap_cache_reload(149)
Unable to open printcap file /etc/printcap for read!


I've copied files to my Debian box from Windows again and it's still not writing them to disk! Bizarre.

whitecrook said:
Also don't forget to add a user: smbpasswd <username> then use that user to connect to the samba server.

I've already done this but thanks for the suggestion.

Gonna reset my Window box and see it helps. Thanks to all those who've replied!
 
Back
Top Bottom