How to mount Windows shares or Samba on Linux Centos and Ubuntu

The default behaviour for mount.cifs is leaving the mounted share unsecured

For Centos:

# yum install samba-client samba-common cifs-utils

For Ubuntu:

# sudo apt-get install cifs-utils samba-common system-config-samba samba winbind

Create a local mount point directory, for example:

# mkdir /mnt/windows

Example Windows share detail is:

Remote Windows machine ip address is 192.168.1.9
share name : storage-photo
username: pion
password: my_password

# mount.cifs //192.168.1.9/storage-photo /mnt/windows-storage -o rw,user=pion,pass=my_password,dom=domain.local,vers=3.0

If you want to auto mount on boot, edit /etc/fstab and add the following mount command:

//192.168.1.9/storage-photo /mnt/windows-storage cifs rw,user=pion,pass=my_password,dom=domain.local,vers=3.0

show map

df -h

We have free backup storage box backup on Hetzner.

This is great feature from Hetzner if you rent Dedicated server with middle or high specs.

This is how we mount storage box using cifs and keep the cradentials on /root directory.

RELATED POST

How to Install SFTPGo on Ubuntu 22.04

Setup UFW Firewall For security reasons, it is recommended to install and configure the UFW firewall in your system. First,…

Executing Bash Scripts at Startup in Ubuntu Linux

Creating a Bash script in Ubuntu To create a Bash script in Ubuntu, you can use any text editor of…

How To Clear PHP’s Opcache

PHP can be configured to store precompiled bytecode in shared memory, called Opcache. It prevents the loading and parsing of PHP…

iLO port configuration on HP servers + license

HP Integrated Lights-Out (iLO) Advanced License 34RQQ-6D5R4-G8NW3-LBMG6-MLJXR325WC-J9QJ7-495NG-CP7WZ-7GJMM iLO 2 Advanced features have been activated License Key: License Key: 35DPH-SVSXJ-HGBJN-C7N5R-2SS4W32Q8Y-XZVGQ-4SGJB-4KY3R-M9ZBN –…