Skip to main content

Mount SMB Shares on Debian

Mount an SMB share from Windows, macOS, or a storage appliance on Debian when a FileWave workflow needs network-backed storage, such as an additional backup destination. Confirm the share is reachable and has enough capacity before relying on it for backups.

Step-by-Step Guide for Debian

Before running either mount command, create the local mount-point directory as described under Creating the Local Mount Point, then create and protect /etc/cifs-credentials using Protect the credentials below. The share must already exist on the remote server and the account must have access to it. Creating a local directory does not create or publish a remote SMB share. Choose the Windows or macOS example for the server hosting your share; do not run both examples against the same mount point.

Mounting Windows Shares

  1. Install CIFS Utilities: Open a terminal and install the CIFS utilities package if it's not already installed.

    sudo apt-get update
    sudo apt-get install cifs-utils
    
  2. Mount the Windows Share: Use the mount command to mount the Windows share. Replace the placeholders with your actual values.

    sudo mount -t cifs //yourIPAddress/yoursharedfolder /yourfoldertomount -o credentials=/etc/cifs-credentials
    

Mounting macOS Shares

  1. Install CIFS Utilities: Ensure the CIFS utilities package is installed (this step is the same as above).

    sudo apt-get update
    sudo apt-get install cifs-utils
    
  2. Mount the macOS Share: Use the mount command to mount the macOS share. Replace the placeholders with your actual values.

    sudo mount -t cifs //yourIPAddress/yoursharedfolder /yourfoldertomount -o credentials=/etc/cifs-credentials,nounix,sec=ntlmssp
    

Creating the Local Mount Point

  1. Create a Folder: Create the folder where you want to mount the share.

    sudo mkdir /yourfoldertomount
    
  2. Replace the Placeholder: Replace yourfoldertomount with the actual path of the folder you created in the mount commands above.

Example

If you want to mount a Windows share with IP 192.168.1.100 and shared folder name backup to a local directory /mnt/backup:

  1. Create Local Directory:

    sudo mkdir /mnt/backup
    
  2. Mount the Share:

    sudo mount -t cifs //192.168.1.100/backup /mnt/backup -o credentials=/etc/cifs-credentials
    

Similarly, for a macOS share:

  1. Create Local Directory:

    sudo mkdir /mnt/backup
    
  2. Mount the Share:

    sudo mount -t cifs //192.168.1.100/backup /mnt/backup -o credentials=/etc/cifs-credentials,nounix,sec=ntlmssp
    

Additional Tips

  • FSTAB Entry for Persistent Mounts: Use the credentials-file entry in the next item to configure a persistent mount. The following inline-password syntax is shown only to recognize older configurations; do not put a real password in /etc/fstab:

    //yourIPAddress/yoursharedfolder /yourfoldertomount cifs username=yourusername,password=yourpassword,nounix,sec=ntlmssp 0 0
    
  • Protect the credentials: Use a root-readable credentials file rather than putting a password in the command line or /etc/fstab:

    //yourIPAddress/yoursharedfolder /yourfoldertomount cifs credentials=/etc/cifs-credentials,nounix,sec=ntlmssp 0 0
    

    And create /etc/cifs-credentials with the following content:

    username=yourusername
    password=yourpassword
    

    Ensure the credentials file has appropriate permissions:

    sudo chown root:root /etc/cifs-credentials
    sudo chmod 600 /etc/cifs-credentials
    

    Test the mount, create and remove a small test file, and confirm that the expected backup process can write to the mounted path. A successful mount alone does not prove the backup account has the required permissions.

CentOS Details

The commands below are retained for identifying older CentOS configurations during migration. They show inline username/password arguments; do not copy a real password into those commands. Use the protected credentials-file approach above when preparing the Debian replacement.

  1. For Linux to Windows:
    1. mount -t cifs -o username=yourusername,password=yourpassword //yourIPAdress/yoursharedfolder /yourfoldertomount
  2. For  Linux to macOS
    1. sudo yum install cifs-utils 
    2. mount -t cifs //yourIPAddress/yoursharedfolder /yourfoldertomount -o username=yourusername,password=yourpassword,nounix,sec=ntlmssp

In these examples, "yoursharedfolder" is the remote SMB share name and "yourfoldertomount" is the existing local directory where that share will be mounted. They are different paths.