Sam Hooke

The Important Files: Part 6

Trying to fix operation not permitted when trying to write to NFS share.

Using SMB and NFS together is perhaps not safe:

https://forums.freenas.org/index.php?threads/cifs-and-nfs-together.10918/

Let’s get rid of the NFS share and just use SMB.

Install the Samba client package:

pacman -S smbclient

Remove entry for NFS share.

vi /etc/fstab

Create empty Samba configuration file. It is necessary in order to use smbclient.

sudo touch /etc/samba/smb.conf

Try and manually list which SMB shares are available.

[marbs@cpe1704tks ~ ]$ smbclient -L 192.168.0.2
Enter WORKGROUP\marbs's password:

        Sharename       Type      Comment
        ---------       ----      -------
        media           Disk
        IPC$            IPC       IPC Service (FreeNAS Server)
Reconnecting with SMB1 for workgroup listing.

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
        WORKGROUP            FREENAS

In the FreeNAS UI, select the SMB share, selected advanced, and enable “Allow Guest Access”.

modprobe -c | grep cifs
sudo mount -t cifs //192.168.0.2/media /mnt/media -o guest,vers=3.0

Gave:

mount error : cifs filesystem not supported by the system mount

Then after reboot:

[marbs@cpe1704tks ~ ]$ modprobe -c | grep cifs
softdep cifs pre: ccm
softdep cifs pre: aead2
softdep cifs pre: sha512
softdep cifs pre: sha256
softdep cifs pre: cmac
softdep cifs pre: aes
softdep cifs pre: nls
softdep cifs pre: md5
softdep cifs pre: md4
softdep cifs pre: hmac
softdep cifs pre: ecb
softdep cifs pre: des
softdep cifs pre: arc4
alias fs_cifs cifs

Try mounting again:

sudo mount -t cifs //192.168.0.2/media /mnt/media -o guest,vers=3.0

It works!

But I can only read, not write…

sudo umount /mnt/media

Remount as a user rather than as guest:

sudo mount -t cifs //192.168.0.2/media /mnt/media -o username=marbs,vers=3.0

Now update /etc/fstab to automatically mount the disk:

# /mnt/media
# 192.168.0.2:/mnt/storage/media   /mnt/media  nfs  noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
//192.168.0.2/media  /mnt/media  cifs  noauto,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1mind,username=marbs,password=mypassword,vers=3.0 0 0

For more information on the x-systemd options see here.

Now reboot for the changes to take effect.

Can re-mount manually now with:

systemctl restart mnt-media.automount

All articles in this series:

These are rough notes from whatever I was working on, interested in or thinking about at the time. They vary greatly in quality and length, but prove useful to me, and hopefully to you too!

← Previous: The Important Files: Part 5
Next: Installing rpms offline using a local yum repository →