LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2005, 02:01 PM   #1
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Samba truncating files to 0 bytes


I'm running into a very odd situation where if I access a Samba share from another Linux box, edit an existing file and attempt to save the changes, that file is truncated to 0 bytes.

However, if I save into that same directory as a NEW file, the file is saved properly. If I make updates to the file I just successfully saved, and then try to save the changes, that new file is truncated to 0 bytes.

I do not seem to encounter this on any shares on any other computers.


This is very odd and I have not encountered this before. I applied the latest updates to Samba and still encounter this issue.

Sharing machine:

Code:
crm:~ # uname -a
Linux crm 2.6.5-7.111.19-default #1 Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386GNU/Linux
crm:~ # smbstatus

Samba version 3.0.9-2.1.5-SUSE
PID     Username      Group         Machine
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------
intranet      3580   172.16.1.2    Fri Jan  7 14:54:24 2005

No locked files

crm:~ # cat /etc/samba/smb.conf

(global)
workgroup = mydomain
server string = CRM Server
local master = no
ldap suffix = dc=example,dc=com
restrict anonymous = no
domain master = no
preferred master = no
max protocol = NT
ldap ssl = No
server signing = Auto
map to guest = Bad User
username map = /etc/samba/smbusers
#socket options = TCP_NODELAY SO_SNDBUF=1460
socket options = TCP_NODELAY SO_SNDBUF=2929


(jerry)
comment = Jerry's Test PHP Server
path = /srv/www/jerry/
msdfs proxy = no
read only = no
guest ok = yes

(intranet)
comment = Intranet
path = /srv/www/htdocs/
msdfs proxy = no
read only = no
wide links = no
admin users = root,kim,nobody
guest ok = yes
create mode = 0664
directory mode = 0775
And the client side:

Code:
kim2p3lin:/home/kim # uname -a
Linux kim2p3lin 2.6.5-7.111.19-smp #1 SMP Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386 GNU/Linux
kim2p3lin:/home/kim # smbstatus

Samba version 3.0.9-2.1.5-SUSE
PID     Username      Group         Machine
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

No locked files

kim2p3lin:/home/kim # mount
(snip)
//CRM/intranet on /home/kim/smb4k/CRM/intranet type smbfs (0)
(snip)
kim2p3lin:/home/kim # cat /etc/samba/smb.conf
# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
# Date: 2004-12-17
(global)
workgroup = mydomain
printcap name = cups
printcap cache time = 750
cups options = raw
printer admin = @ntadmin, root, administrator
username map = /etc/samba/smbusers
map to guest = Bad User
include = /etc/samba/dhcp.conf
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
server string = kim2p3
domain master = false
local master = no
ldap suffix = dc=example,dc=com
#socket options = TCP_NODELAY SO_SNDBUF=1460
socket options = TCP_NODELAY SO_SNDBUF=2929

(homes)
comment = Home Directories
valid users = %S
browseable = no
read only = No
inherit acls = Yes

(profiles)
comment = Network Profiles Service
path = %H
read only = No
store dos attributes = Yes
create mask = 0600
directory mask = 0700

(users)
comment = All users
path = /home
read only = No
inherit acls = Yes
veto files = /aquota.user/groups/shares/

(groups)
comment = All groups
path = /home/groups
read only = No
inherit acls = Yes

(printers)
comment = All Printers
path = /var/tmp
printable = yes
create mask = 0600
browseable = no

(print$)
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @ntadmin root
force group = ntadmin
create mask = 0664
directory mask = 0775

(SHARE)
path = /windows/Share
admin users = kim,root,nobody
case sensitive = no
msdfs proxy = no
read only = no
guest ok = yes
wide links = no

(BACKUPS)
path = /windows/backups
read only = no
guest ok = yes
admin users = root,kim,nobody
case sensitive = no
msdfs proxy = no
wide links = no
kim2p3lin:/home/kim # ps ax | grep -i smb
(snip)
 5951 ?        Ss     0:00 smbmount //CRM/intranet /home/kim/smb4k/CRM/intranet -o workgroup mydomain ip 172.16.1.155 uid 1000 gid 100 fmask 755 dmask 755 rw username mydomainKim  password XXXXXX
(snip)
kim2p3lin:/home/kim #
I am using smb4k as a Samba front end to avoid frustration with Konqueror bugs and it works fine in all cases except when mounting this one particular server's (CRM's) shares. I do not see this when accessing any Windows boxes or any other Linux boxes.

Any idea what is going on here?


^^bump^^

Last edited by KimVette; 01-08-2005 at 07:37 PM.
 
Old 01-08-2005, 07:38 PM   #2
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Original Poster
Rep: Reputation: 46
^^bump
 
Old 01-12-2005, 01:43 PM   #3
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Original Poster
Rep: Reputation: 46
No ideas?
 
Old 01-13-2005, 02:41 AM   #4
andrewdodsworth
Member
 
Registered: Oct 2003
Location: United Kingdom
Distribution: SuSE 10.0 - 11.4
Posts: 347

Rep: Reputation: 30
Normally I would guess that the issue would be to do with permissions.

Check what the default directory/file permissions are for Samba and if necessary define them explicitly in the relevant [share].

Also check what the linux permissions are on the relevant directories.

If both of these look ok, then your problem probably is a linux client issue (if all the other Windows clients' behaviour is ok).

Have you checked the Samba logs? Have you tried increasing the logging detail?

Could be smb4k - I've never used it. Have you tried mounting the remote Samba share manually:

Code:
/bin/mount -t smbfs -o username=<Samba user>,password=<password> //server/Share /local_dir
If you do that and then try editing a file in /local_dir does it have the same behaviour?

It could also be to do with mapping UNIX stuff to Windows - if you run
Code:
testparm -v
on the server it should list all your settings including the defaults so you can
have a trawl through the Samba docs to see what's necessary.

It looks as though you are running Samba servers on both machines - have you tried turning the server off on the client
temporarily to see if that affects anything?

Quote:
I am using smb4k as a Samba front end to avoid frustration with Konqueror bugs
I've had issues with Konqueror and the Network Browsing icon in SuSE since 9.1. However, it only affects browsing
and although that can be a pain you can still get to where you want to with an explicit Location entry like:

Code:
smb://server/share
which on my system prompts for a Samba username and password.

The other thing I would auggest is looking on the samba.org site - there are very good How-to's and example
documents that cover pretty much all the issues.

Good luck
 
Old 01-13-2005, 05:01 AM   #5
jburford
Member
 
Registered: Sep 2002
Distribution: Mandrake 10, IPCOP 1.4, SME Server 6, EvilEntity
Posts: 106

Rep: Reputation: 15
I am not sure if my experience is useful or a red herring, but here we go...

using a Linksys nslu2, which is an ARM based samba NAS, I can't move/transfer files greater than about 30k without getting a "path too deep" error (umm, er, ???!?!!? what?)
Some checking around on the net, it looks like the most likely cause is the hub (again, ?!!!!?!?! hub!??!!! ), and checking low level network may be worth a try. Admittedly, your problem with overwrite versus new file sounds different, but don't discount basic hardware problems....Anyway, it sounds like SMB has some issues with hardware, and admittedly mine was cheap stuff five years ago.

might be worth a try

Jim
 
Old 01-13-2005, 10:00 AM   #6
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Original Poster
Rep: Reputation: 46
It's not a hardware issue - I don't run hasbro hubs or switches (I use buffered switches) and a file I experienced the problem with is /srv/www/htdocs/index.html and the local samba mount was /home/kim/smb4k/crm so the path was hardly long enough to encounter that problem even if the network layer were an issue.


andrewdodsworth,

Thanks, I'll look into that this afternoon and report back either way.
 
Old 01-30-2005, 06:42 PM   #7
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Original Poster
Rep: Reputation: 46
I finally got a chance to revisit this. Both Windows and Linux users connect as nobody by default. To ensure permissions is not the issue, I removed the umask which should open it all up.

Upon looking at the samba logfile, I verify that both Windows and Linux users connect as nobody, but Windows users can modify and save files. Linux users can open the files but upon saving the files are truncated to 0 bytes.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TX bytes vs. httpd bytes ovrload Linux - Networking 3 10-12-2005 04:19 PM
Can't create files bigger than 0 bytes GameboyHippo Linux - General 1 03-01-2005 08:04 PM
Truncating trailing characters liguorir Programming 0 05-23-2004 04:00 AM
Truncating a string nkendrick Linux - General 5 11-29-2003 09:12 AM
bits and bytes and files basics question Bert Linux - Software 2 01-16-2003 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration