• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Provide Credentials From a File While Mounting CIFS Share in Linux

by admin

Question: How to use a FILE instead of directly providing the username/password while mounting CIFS share.

Let us assume the below,

  1. The Windows Machine IP is “10.176.x.x”
  2. Windows Folder to be mounted is called ‘data’
  3. Planning to Mount the Windows share to a Linux folder called ‘/mnt’
  4. 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

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. getopt: command not found
  2. Unable To Extend LVM File System with Associated Snapshot in CentOS/RHEL
  3. How to automate sftp file transfers using expect utility
  4. The /var/log/messages is empty, and so are the rotated log files such as messages.0, messages.1
  5. How to activate and mount 2 Volume groups with same names in CentOS/RHEL
  6. as: command not found
  7. How to configure AD group in sudoers file to provide sudo access to users on Linux system
  8. dmidecode: command not found
  9. pacman –upgrade Command Examples in Linux
  10. whois: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright