• 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. How to Create a Custom Log File Rotation by logrotate in Linux
  2. How to Restrict su Access to a User Only by PAM in Linux
  3. How to create and mount filesystems in Linux
  4. How to Create and Query a BTRFS File System
  5. How to disable auto completion (tab completion) in bash shell
  6. Why Does “netstat” Output Show Many Connections in CLOSE_WAIT Status?
  7. find Command Examples in Linux
  8. repquota Command Examples in Linux
  9. How to Password Protect GRUB2 in Oracle Enterprise Linux 7
  10. CentOS / RHEL 7 : GRUB2 configuration file /boot/grub2/grub.cfg explained

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright