# Weird behaviour from Bareos [SOLVED]



## tonyalbers (Jan 23, 2022)

Hi guys,
Bareos 20.0.2 on FBSD 13.0-Release.

It's been running fine for a couple of months, and today I added a client and when doing

```
service bareos-dir restart
```

It comes back with:

```
Performing sanity check on /usr/local/etc/bareos/ configuration:
Starting bareos_dir.
bareos-dir: ERROR TERMINATION at lib/parse_conf.cc:242
Config error: Cannot open config file "/usr/local/etc/bareos/bareos-dir.d/*/*.conf": Permission denied
```

Which I find odd since I made sure that owner and perms on the new files are correct.

What's even more strange is that even though bareos own the files, and uid and gid matches, it still won't start.
bareos-sd and bareos-fd runs fine.

File perms when not working:

```
-rw-r-----  0 bareos bareos    558 Dec 15 12:35 usr/local/etc/bareos/bareos-dir.d/jobdefs/PmWikiServerJob.conf
-rw-r-----  0 bareos bareos    565 Dec 15 12:35 usr/local/etc/bareos/bareos-dir.d/jobdefs/BackupServerJob.conf
-rw-r-----  0 bareos bareos    566 Dec 15 12:35 usr/local/etc/bareos/bareos-dir.d/jobdefs/NextcloudServerJob.conf
-rw-r-----  0 bareos bareos    628 Dec 15 12:35 usr/local/etc/bareos/bareos-dir.d/jobdefs/DefaultJob.conf
-rw-r-----  0 bareos bareos    566 Jan  5 16:42 usr/local/etc/bareos/bareos-dir.d/jobdefs/WordpressServerJob.conf
```

But if I do a chmod -R 644 /usr/local/etc/bareos/bareos-dir.d   it works.

What am I missing? Shouldn't bareos-dir run as bareos or?

Any advice is appreciated, thanks.

/tony


----------



## SirDice (Jan 24, 2022)

tonyalbers said:


> Which I find odd since I made sure that owner and perms on the new files are correct.


How about the permissions on the directories above it? It might not have read and execute access there.



tonyalbers said:


> But if I do a chmod -R 644 /usr/local/etc/bareos/bareos-dir.d it works.


Directories will need the execute bit or else you won't be able to search them. Typically directory permissions are 755, not 644. The _files_ within that directory have 644, the directories are 755.


```
0100    For files, allow execution by owner.  For directories,
                   allow the owner to search in the directory.
...
           0010    For files, allow execution by group members.  For
                   directories, allow group members to search in the
                   directory.
...
           0001    For files, allow execution by others.  For directories
                   allow others to search in the directory.
```
chmod(1)


```
dice@molly:/tmp % ls -ld /tmp/test/
drwxr-xr-x  2 dice  dice  0 Jan 24 15:27 /tmp/test/
dice@molly:/tmp % touch /tmp/test/somefile
dice@molly:/tmp % ls -al /tmp/test/
total 0
drwxr-xr-x  2 dice  dice    64 Jan 24 15:27 .
drwxrwxrwt  9 root  wheel  448 Jan 24 15:27 ..
-rw-r--r--  1 dice  dice     0 Jan 24 15:27 somefile
dice@molly:/tmp % chmod 644 /tmp/test/
dice@molly:/tmp % ls -al /tmp/test/
ls: .: Permission denied
ls: ..: Permission denied
ls: somefile: Permission denied
total 0
```


----------



## tonyalbers (Jan 28, 2022)

Hi SirDice,

Sorry for not getting back to you earlier, I didn't have access to the system from where I was.

You were right, the rx perms were missing on the directories. I don't know how I managed to miss that 

Thanks for your help, everything is working now.

And thanks for being so helpful, you really make a difference for us all.

/tony


----------

