SAMBA Filesharing Issue

Herb Lewis herb at
Wed Aug 23 19:31:00 GMT 2000

"Ward, Robert J." wrote:
> Can anybody help with this issue:
> My question regarding SAMBA is: we use the file sharing capability from a
> Windows workstation to a UNIX machine. When we copy files from the
> workstation to the UNIX box, UNIX places an end of line character in the
> file that we don't want there. Is there a way to avoid this (a way to tell
> SAMBA to do a straight ASCII copy)? We don't have this problem when we use
> FTP.
> Thanks for your help
> Bob Ward
> (781) 205-7361
> rjward at

You have actually stated your problem in reverse. Samba DOES NOT change
a file that it transfers. When you "see" the extra character in UNIX
it is because the character existed in the original file. UNIX
lines in text files with a linefeed only. Windows boxes terminate lines
with a carriage-return and a linefeed. The carriage-return is the "extra
character" you thought samba added. 

FTP is a file transfer protocol. It allows you to "translate" a file
during transfer. When you transfer a file in ASCII mode with FTP it
actually strips out all the carriage return characters for you.

Take a look at the file sizes on the orignal machine and the copies
that you transfer with samba and FTP and you will see what I mean.

Now to your problem. Samba will not modify the file for you. This 
has been discussed many times. Basically there is no 100% sure way
to determine that a file is text and needs to be modified. Also 
you run into the problem of file size changes when you allow this.
What size do you report to the client for example - the actual size
or the "stripped" size?

Most UNIX's have a program that will convert a DOS format text file
to UNIX text format. You can run this on the files you transfer to 
delete the extra carriage return. Another option is to look at the 
VFS code in samba and implement your own conversion on a per-share
Herb Lewis                               Silicon Graphics 
Networking Engineer                      1600 Amphitheatre Pkwy MS-510
Strategic Software Organization          Mountain View, CA  94043-1351
herb at                             Tel: 650-933-2177                       Fax: 650-932-2177          

More information about the samba mailing list