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

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

If we need to work together with team or access windows storage, we need to mount remote windows share or Samba on CentOS 7.

Mounting Windows or other samba) shares is done through the cifs virtual file system client (cifs vfs) implemented in kernel and a mount helper mount.cifs.

If we are managing a multi user system, consider setting the dir_mode and file_mode options to your mount point.

The default behaviour for mount.cifs is leaving the mounted share unsecured (http://bugs.centos.org/view.php?id=4537).

For Centos:

For Ubuntu:

Example output:

Create a local mount point directory, for example:

Example Windows share detail is:

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

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

The problem from above samba mount configuration is username and password visible to all user.

So we need make it more secure. Put username and password on /root/secret.txt and put your username and password with format:

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.

Hetzner-mount-backup-storage-box-using-cifs.jpg
Mount Hetzner backup storage box using cifs

Leave a Reply

Your email address will not be published. Required fields are marked *