# ZFS - zfs recv



## nu (Feb 7, 2012)

Hi.
I've just added user "test" on backup server.
I gave this users more privilages with zfs.


```
# zfs allow test create,destroy,mount,snapshot,receive,mountpoint,allow,clone,promote,rename,rollback,send,share,canmount ZFSrootBS/backup

# zfs allow ZFSrootBS/backup
---- Permissions on ZFSrootBS/backup ---------------------------------
Local+Descendent permissions:
user test allow,canmount,clone,create,destroy,mount,mountpoint,promote,receive,rename,rollback,send,share,snapshot
```

After that I tried to send snapshot from primary to backup server.


```
# zfs send -v ZFSroot/home/mail/mail.pl@2012-02-07 | ssh test@backup zfs recv -vF ZFSrootBS/backup/mail
cut
received 11.7GB stream in 194 seconds (61.5MB/sec)
cannot mount '/backup/mail5': failed to create mountpoint
```

Am I missing something?

Thanks in advance.


----------



## SirDice (Feb 7, 2012)

The user test isn't allowed to mount filesystems, regardless of what you set with ZFS.

Try setting in /etc/sysctl.conf:

```
vfs.usermount=1
```

Mind you, this will mean _every_ user can mount filesystems.

The user also needs to be able to create a directory in /backup/ for the mountpoint.


----------



## jake (Feb 7, 2012)

Another way you could do this, but it's not a 'zfs way' is to use sudo.

Add something like this with visudo

```
Cmnd_Alias ZFS = /sbin/zfs

test ALL = NOPASSWD: ZFS
```

Then change your zfs recv command to

`# zfs send -v ZFSroot/home/mail/mail.pl@2012-02-07 | ssh test@backup sudo zfs recv -vF ZFSrootBS/backup/mail`

That way you don't need to allow all users to mount. But if you don't currently use sudo and/or you like doing things the way zfs intended this method may be undesirable.


----------



## AndyUKG (Feb 8, 2012)

Hi,

  if it is your intention to send subsequent snapshots as incrementals then this menthod will work fine, except from the initial send as you have found out. In that instance simply do the first non-incrememental send as root,

thanks Andy.


----------



## nu (Feb 8, 2012)

I know this "tricks" but thanks anyway 
Just wonder if I could do this in "pure ZFS way". 
I guess not (not yet)


----------

