Skip to main content

Samba

 

Mount a persistent drive on samba

Query system make sure cifs utils and samba client are installed, if not run the install command for samba packages and cifs utils

 

sudo dnf install samba-client samba-common cifs-utils


csr@MainPC:/mnt$ sudo dnf list installed | grep -E 'cif*|samb'
cifs-utils.x86_64                                    7.0-2.fc39                                       @anaconda                          
cifs-utils-info.x86_64                               7.0-2.fc39                                       @anaconda                          
cirrus-audio-firmware.noarch                         20240312-1.fc39                                  @System                            
crypto-policies.noarch                               20231204-1.git1e3a2e4.fc39                       @fedora-updates                    
crypto-policies-scripts.noarch                       20231204-1.git1e3a2e4.fc39                       @fedora-updates                    
geolite2-city.noarch                                 20191217-10.fc39                                 @anaconda                          
libpciaccess.i686                                    0.16-9.fc39                                      @anaconda                          
libpciaccess.x86_64                                  0.16-9.fc39                                      @anaconda                          
mpdecimal.i686                                       2.5.1-7.fc39                                     @System                            
mpdecimal.x86_64                                     2.5.1-7.fc39                                     @anaconda                          
pciutils.x86_64                                      3.11.1-1.fc39                                    @System                            
pciutils-libs.i686                                   3.11.1-1.fc39                                    @updates                           
pciutils-libs.x86_64                                 3.11.1-1.fc39                                    @System                            
pcsc-lite-ccid.x86_64                                1.5.5-1.fc39                                     @System                            
perl-Specio.noarch                                   0.48-4.fc39                                      @System                            
qemu-device-display-virtio-gpu-pci.x86_64            2:8.1.3-4.fc39                                   @updates                           
qemu-device-display-virtio-gpu-pci-gl.x86_64         2:8.1.3-4.fc39                                   @updates                           
samba-client.x86_64                                  2:4.19.5-1.fc39                                  @System                            
samba-client-libs.i686                               2:4.19.5-1.fc39                                  @System                            
samba-client-libs.x86_64                             2:4.19.5-1.fc39                                  @System                            
samba-common.noarch                                  2:4.19.5-1.fc39                                  @System                            
samba-common-libs.x86_64                             2:4.19.5-1.fc39                                  @System                            
samba-common-tools.x86_64                            2:4.19.5-1.fc39                                  @System                            
samba-dcerpc.x86_64                                  2:4.19.5-1.fc39                                  @System                            
samba-ldb-ldap-modules.x86_64                        2:4.19.5-1.fc39                                  @System                            
samba-libs.x86_64                                    2:4.19.5-1.fc39                                  @System                            
samba-winbind.x86_64                                 2:4.19.5-1.fc39                                  @System                            
samba-winbind-clients.x86_64                         2:4.19.5-1.fc39                                  @System                            
samba-winbind-modules.x86_64                         2:4.19.5-1.fc39                                  @System                        

 

Create a credentials file to hide config from fstab config

sudo vim ~/.cred


# Enter credentials for SMB share
username=youruser
password=yourpassword

~                                                                                                                                                                                      
~                                                                                                                                                                                      
~                                                                                                                                                                                      
~                                                                                                                                                                                      
~                                                                                                                                                                                      
~                                                                                                                                                                                      
~                                             

Set permisions to file 

chmod 600 ~/.cred

edit /etc/fstab to add our smb drive

//192.168.3.100/zfs /mnt/zfs cifs credentials=/home/csr/.cred,_netdev,defaults 0 0

csr@MainPC:/mnt$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=AA4E-9603                            /boot/efi      vfat    defaults,noatime 0 2
UUID=c67309b3-bb04-45fa-8cc6-a26d41301ba5 /boot          ext4    defaults,noatime 0 2
UUID=3822a8bd-6ffb-4834-8e9d-f753a4de704e /              btrfs   subvol=/@,compress=zstd:1,x-systemd.device-timeout=0 0 0
UUID=3822a8bd-6ffb-4834-8e9d-f753a4de704e /home          btrfs   subvol=/@home,compress=zstd:1,x-systemd.device-timeout=0 0 0
UUID=7062c1a3-df69-4877-b165-c3c9308afd8a swap           swap    defaults   0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 

//192.168.3.100/zfs /mnt/zfs cifs credentials=/home/csr/.cred,_netdev,defaults 0 0

run  systemctl daemon-reload  then sudo mount -a

csr@MainPC:/mnt$ mount -a
This program is not installed setuid root -  "user" CIFS mounts not supported.
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
csr@MainPC:/mnt$ systemctl daemon-reload 
csr@MainPC:/mnt$ mount -a
This program is not installed setuid root -  "user" CIFS mounts not supported.
csr@MainPC:/mnt$ sudo mount -a
csr@MainPC:/mnt$ ls
zfs
csr@MainPC:/mnt$