# [FreeBSD 12.2] NEWALIASES: cannot open alias database /etc/mail/aliases



## qw4rk (Jan 18, 2021)

Hey guys

this is my first thread, yay! 

I've just set up a server with FreeBSD 12.2 and changed the mail address in /etc/mail/aliases (root: my@mail.foo)

To rebuild the aliases.db (which doesn't exist) I've used the following command:


```
root@***:/etc/mail # newaliases
WARNING: cannot open alias database /etc/mail/aliases
Cannot create database for alias file /etc/mail/aliases
```

I've checked the permission and also changed them but it didn't helped (currently set to default: 644). Does anyone have an idea what the problem could be?

Cheers,
Daniel


----------



## SirDice (Jan 18, 2021)

Did you increase the security level perhaps? And what are the permissions and ownership of /etc/ and /etc/mail?

```
dice@lady3jane:~ % ls -ld /etc /etc/mail
drwxr-xr-x  25 root  wheel  109 Jan 16 20:49 /etc
drwxr-xr-x   3 root  wheel   18 Jan 16 16:16 /etc/mail
```


```
-rw-r--r--   1 root  wheel    1691 Oct 23 07:39 aliases
-rw-r-----   1 root  wheel  131072 Jan 16 16:15 aliases.db
```
This is on a freshly built 12.2 server, built it this weekend. Judging by the timestamps last Saturday afternoon.


----------



## qw4rk (Jan 18, 2021)

Hi SirDice,

thank you! Now I've changed the ownership of /etc/ and /etc/mail and it worked:


```
root@***:/ # newaliases
/etc/mail/aliases: 30 aliases, longest 27 bytes, 328 bytes total
```

I am not sure why there were not enough rights on /etc/. I'll investigate. Again, thank you!


----------



## SirDice (Jan 18, 2021)

qw4rk said:


> Now I've changed the ownership of /etc/ and /etc/mail


What was the ownership?


----------



## qw4rk (Jan 19, 2021)

It was set to 644 but I've already found the reason... It was a bug in my ansible playbook.


----------



## SirDice (Jan 19, 2021)

Alright. I have to mention this as you don't seem to understand the difference between _ownership_ and _permissions_. Ownership is which account and group _owns_ the file/directory, in this case the ownership is root:wheel. Permissions are what the owner, group and other's can do, that's 644 in this case.


----------



## qw4rk (Jan 19, 2021)

Ah gosh, sorry.. that was a typo, of course I meant permissions ^^


----------



## SirDice (Jan 19, 2021)

I can relate to that. I had the impression you were misunderstanding it, hence the extra explanation. No worries, perhaps it'll do someone else some good when they find this thread through a google search in about 5 years


----------



## qw4rk (Jan 19, 2021)

Yes, thank you for your help


----------

