# Problem with Samba, i cannot open files :(

## zecora

I have moved a hole bunch of movies over to my new filserver and i cannot play them.  What i would like to do i have seperate dir for people that are using it.  So what do i need in my config file and what don't i need? 

Here is my config file:

```

[global]

workgroup = Z-FIGHTERS

netbios name = VEGETA

hosts allow = 127.0.0.1 192.168.2.1/32

interfaces = eth0

guest ok = yes

read only = yes

log file = /var/log/samba/log.%m

vfs object = vscan-clamav

vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

[public]

comment = Public Files

browseable = yes

public = yes

create mode = 0766

guest ok = yes

path = /home/samba/public

[share1]

path = /tmp

[share2]

path = /my_shared_folder

comment = Some random files

[homes]

guest ok = no

read only = no

[ben]

path = /home/ben

comment = Ben's home directory

writable = yes

valid users = ben
```

----------

## nelchael

```
[movies]

   path = /fserver/movies

   comment = Movies

   public = yes

   writable = no

   guest ok = yes

   only guest = yes

   browsable = yes
```

I've found that without 'writable', 'guest ok' or 'browsable' it doesn't work. Those three are a 'must have' I think.

----------

## zecora

Still nothing. Dang it this is frustrating.

here is my new one, with no luck

```
[global]

workgroup = Z-FIGHTERS

netbios name = VEGETA

hosts allow = 127.0.0.1 192.168.2.1/32

interfaces = eth0

guest ok = yes

read only = yes

log file = /var/log/samba/log.%m

vfs object = vscan-clamav

vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

browsable = yes

writable = no

[ben]

path = /home/ben

comment = Ben's home directory

writable = no

valid users = ben

browsable = yes

writable = yes

guest ok = no
```

----------

## nelchael

This is from my laptop:

```
[global]

   workgroup = LAN

   netbios name = Nelchael

   server string = Nelchael

   printcap name = cups

   load printers = no

   printing = cups

   log file = /var/log/samba/log.%m

   max log size = 50

# Set the log (verbosity) level (0 <= log level <= 10)

   log level = 1

   #hosts allow = 192.168.0.0/16

   hosts allow = 0/0

   map to guest = bad user

   security = user

   encrypt passwords = yes

   smb passwd file = /etc/samba/private/smbpasswd

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

   local master = no

   os level = 33

   remote announce = 192.168.1.255

   name resolve order = bcast wins lmhosts

   dns proxy = no 

   dos charset = cp852

   unix charset = iso8859-2
```

You didn't say what exactly is happening?

 *zecora wrote:*   

> i cannot play them

 

File not found, no such share, access denied?

EDIT: maybe 'security = {share,user}' ?

----------

## zecora

OK what is happening is, i have already moved all my movies over to the fileserver and now i cannot play them. 

Does that make sense?

----------

## zecora

bump

----------

## nelchael

 *zecora wrote:*   

> Does that make sense?

 

No. What mplayer says if you do 

```
mplayer mounted/samba/movie.avi
```

? What does ls, file say when used on some movie from that share?

----------

## zecora

I use WMplaya and windows can not access the file.

----------

## zecora

i cannot even move the file back to my computer.

----------

## zecora

 *nelchael wrote:*   

>  *zecora wrote:*   Does that make sense? 
> 
> No. What mplayer says if you do 
> 
> ```
> ...

 

what do you want me to do?

----------

## zecora

could it be the user i created? how do i create the right user to access everything, or what he has perrmission to access?

----------

## nelchael

 *zecora wrote:*   

> what do you want me to do?

 

Mount the share using smbmount, go to directory, where You mounted it, and try to play any movie with mplayer then if it says that something is wrong post the error message.

----------

## nobspangle

what does it say in the samba logs?

----------

## zecora

where do i look at the samba logs? Do i look in /var/log/samba?

less /var/log/samba/log.ben

```

[2004/12/04 14:44:14, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

[2004/12/04 14:44:14, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

[2004/12/04 14:44:14, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

[2004/12/04 14:44:14, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

[2004/12/04 14:44:14, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

```

is says a lot of that, just keeps repeating.

Here is /var/log/samba/log.ben.old

```

[2004/12/04 14:39:40, 0] passdb/pdb_smbpasswd.c:startsmbfilepwent(199)

  startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. C

ouldn't create new one. Error was: No such file or directoryUnable to open passd

b database.

[2004/12/04 14:39:40, 0] passdb/pdb_smbpasswd.c:startsmbfilepwent(199)

  startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. C

ouldn't create new one. Error was: No such file or directoryUnable to open passd

b database.

[2004/12/04 14:39:40, 1] auth/auth_util.c:make_server_info_sam(822)

  User samba in passdb, but getpwnam() fails!

[2004/12/04 14:39:40, 0] passdb/pdb_smbpasswd.c:startsmbfilepwent(199)

  startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. C

ouldn't create new one. Error was: No such file or directoryUnable to open passd

b database.

[2004/12/04 14:39:40, 0] passdb/pdb_smbpasswd.c:startsmbfilepwent(199)

  startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. C

ouldn't create new one. Error was: No such file or directoryUnable to open passd

b database.

[2004/12/04 14:39:49, 0] passdb/pdb_smbpasswd.c:startsmbfilepwent(199)

  startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. C

ouldn't create new one. Error was: No such file or directoryUnable to open passd

b database.
```

----------

## zecora

bump

----------

## zecora

I created my users like this.

smbpasswd -a <USERNAME>

----------

## adaptr

First, the only host you allow is 192.168.2.1 - that is ONE host, no network.

So this better be the Windows machine, or you'll never get any access.

Next, you should not use the samba user itself to connect to samba - that is the user the processes run under, not a regular user account.

Then: any user you do wish to use with samba has to exist as a real unix user on the system.

You have to add the user as a normal user before you add them to samba.

Also, it seems like your samba config may have the wrong setting for its passdb file - make sure it points to the location the log file complains about.

There is no need to specify both guest ok and writable - as long as your windows username matches a unix username then you don't need guest.

Browsable is merely a convenience - it isn't necessary if you map drives.

A small tip: add

```
admin users=<yourusername>
```

to either the global config or specific shares; this allows that user to connect with root rights on the filesystem, i.e. full access, regardless of actual filesystem permissions.

----------

## pivertd

I think I have the same problem with :

smb.conf

```

....

[homes]

   vfs objects = vscan-clamav

   vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

   comment = Home Directories

   read only = No

   browseable = no

   guest ok = no

   printable = no

....

```

vscan-clamav.conf

```

MyServer:/etc/samba # grep '^[[:alpha:]]' vscan-clamav.conf

max file size = 0

verbose file logging = no

scan on open = yes

scan on close = yes

deny access on error = yes

deny access on minor error = yes

send warning message = yes

infected file action = quarantine

quarantine directory  = /tmp

quarantine prefix = vir-

max lru files entries = 100

lru file entry lifetime = 5

clamd socket name = /var/lib/clamav/clamd

```

And in my messages log :

```

MyServer:/etc/samba # tail  /var/log/messages | grep clam

Dec  6 17:17:53 MyServer smbd_vscan-clamav[18578]: samba-vscan (vscan-clamav 0.3.4) connected (Samba 3.0), (c) by Rainer Link, OpenAntiVirus.org

Dec  6 17:17:53 MyServer smbd_vscan-clamav[18578]: INFO: connect to service francoisd by user francoisd

Dec  6 17:17:53 MyServer smbd_vscan-clamav[18578]: ERROR: daemon failed with a minor error - access to file pdfwriter/Page_de_test.pdf denied

Dec  6 17:25:36 MyServer smbd_vscan-clamav[18578]: ERROR: daemon failed with a minor error - access to file pdfwriter/Page_de_test.pdf denied

```

I don't have the solution yet or a good "howto user clamav with samba vscan-clamav vfs module"...  :Smile: 

If so has an idea ?!

----------

## zecora

Do you think if i remove the Antivirus that could slove the problem?

----------

## nelchael

 *zecora wrote:*   

> Do you think if i remove the Antivirus that could slove the problem?

 

TRY IT, don't ask if it works.

----------

## zecora

I will give it a shot.

----------

## pivertd

Finally, I got it to work.

My problem was that clamd was running as vscan, (SuSE) and that the user under which was running clamd hadn't access to the scanned files.

Now my clamd run as root, and I have no more problems.

This is not a nice solution, but it's the only way to use clamd and to be certain that it 'll access all the files.

Bye

----------

## zecora

can you explain what you changed?

----------

## pivertd

Hello !

In fact, I configured this on 2 different Linux Stations (SuSE and Gentoo) for the home directories, and both had the same problem. The clamd was running as a users that hadn't permitions in my users home directories. On my SuSE server I had to comment the line telling clamd to run as vscan in /etc/clamav.conf. On Gentoo, this is in the /etc/clamd.conf, but I didn't removed the line because I don't really like this solution... And I see somewhere that an other workaround is to use libclamav instead of clamd. But I don't know yet how to make vscan-clamav run this way.

I highly recommend you to activate the logging/debug options in vscan-clamav.conf and clamd.conf. You can use the audit vfs module in samba to get more informations too. 

Bye

----------

## zecora

OK i will try it when i get home, thanx i will post what happens.  

This should allow me to access and play all my files correct?

----------

## Arkal

I had a similar problem and it is because of clamav...

comment these two lines and try again

 *Quote:*   

> vfs object = vscan-clamav
> 
> vscan-clamav: config-file = /etc/samba/vscan-clamav.conf 

 

I don't know why, if someone could post an simple exemple of /etc/samba/vscan-clamav.conf, I will try it...

----------

