Question: How to use a FILE instead of directly providing the username/password while mounting CIFS share.
Let us assume the below,
- The Windows Machine IP is “10.176.x.x”
- Windows Folder to be mounted is called ‘data’
- Planning to Mount the Windows share to a Linux folder called ‘/mnt’
- The credential file created on Linux machine is called ‘/root/cifs_creds’
Below are the entry inside the file:
username=geek password=xxyyzz
Now run the ‘mount’ command on Linux box as below:
# mount -t cifs //10.176.x.x/data /mnt -o credentials=/root/cifs_creds