Linux command ‚SAMBA‘ – how to mount an SMB/Samba share on Linux you need to use the CIFS kernel file system and Permanent Mount (Survives Reboots)

root@rpi-iot-jsho-rslsync-01:~# apt-get install cifs-utils
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
cifs-utils is already the newest version (2:6.11-3.1+deb11u2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# vi /root/.smbcredentials
username=pi
password=<password>
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# chmod 600 /root/.smbcredentials
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# mkdir /mnt/USB-Stick.extern
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# vi /etc/fstab

//192.168.1.139/share-01 /mnt/USB-Stick.extern cifs credentials=/root/.smbcredentials,uid=0,gid=0,x-systemd.automount,_netdev,nofail 0 0
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# systemctl daemon-reload
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# mount -a
root@rpi-iot-jsho-rslsync-01:~#
root@rpi-iot-jsho-rslsync-01:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 122567116 21085928 96438888 18% /
devtmpfs 88508 0 88508 0% /dev
tmpfs 219796 0 219796 0% /dev/shm
tmpfs 87920 1012 86908 2% /run
tmpfs 5120 4 5116 1% /run/lock
/dev/mmcblk0p1 261106 51636 209470 20% /boot
tmpfs 43956 20 43936 1% /run/user/1000
//192.168.1.139/share-01 119631576 11051152 108580424 10% /mnt/USB-Stick.extern
root@rpi-iot-jsho-rslsync-01:~#

Leave a Reply

You must be logged in to post a comment.