Installing CIFS Utilities Packages
To mount a Windows share on a Linux system, first you need to install the CIFS utilities package.
- Installing CIFS utilities on CentOS and Fedora:
sudo dnf install cifs-utils
Auto Mounting
sudo nano /etc/fstab
- Add the following line to the file:
# <file system> <dir> <type> <options> <dump> <pass> //WIN_SHARE_IP/share_name /mnt/win_share cifs credentials=/etc/win-credentials,file_mode=0755,dir_mode=0755 0 0
Run the following command to mount the share:
mount -a
Creating Credential File
For better security it is recommended to use a credentials file, which contains the share username, password and domain.
/etc/win-credentials
The credentials file has the following format:
username = user
password = password
domain = domain
The file must not be readable by users. To set the correct permissions and ownership run:
sudo chown root: /etc/win-credentials
sudo chmod 600 /etc/win-credentials
Create Symlink in Linux
8. Create a shortcut to your new mounted file share:
Terminal way (the link will appear in the folder the terminal points to):
ln -s /folderorfile/link/will/point/to /name/of/the/link
Recommended Comments
There are no comments to display.