A partner of ours asked me today to help him mount storage for backups on his linux backup server
His storage was located on a Windows 2008 Server, and so the question is how to get the Windows storage visible on our White Label Online Backup Server?
Turns out it’s not hard, but it is tricky!
How to Mount a Windows Share on Ubuntu Linux
Integrating Windows Storage with Ubuntu
This guide explains how to make Windows storage accessible on an Ubuntu server.
Step 1: Set Up a Windows Share
Create a Windows share and give “windowsuser” read/write access. This step ensures the Ubuntu system can identify and access the shared storage.
Step 2: Create Ubuntu Mount Point
Use mkdir /jail/home1
to create a directory in Ubuntu, which will be the point where the Windows share appears in the Linux system.
Step 3: Install Samba on Ubuntu
Install Samba with apt-get install smbfs
, necessary for Ubuntu to communicate with the Windows share.
Step 4: Configure fstab in Ubuntu
Open /etc/fstab
using nano /etc/fstab
and prepare to add the mount details. This file controls the automatic mounting of devices.
Step 5: fstab Configuration Details
Add //192.168.100.1/windowsshare /jail/home1 cifs credentials=/root/.smbcredentials,uid=nobody,gid=nogroup,iocharset=utf8,codepage=unicode,unicode 0 0
. This line specifies the Windows server’s address, the mount point in Ubuntu, and uses the CIFS protocol necessary for Samba mounts, along with the credentials file location and file system options.
Step 6: Credential Management
Create /root/.smbcredentials
and enter username=windowsuser
and password=windowspassword
. This file securely stores the login details for the Windows share.
Step 7: Secure the Credentials File
Execute chown root:root /root/.smbcredentials; chmod 400 /root/.smbcredentials
to restrict access to this file, enhancing security.
Effortless Access to Windows Shares
By following these steps, you can smoothly integrate your Windows and Ubuntu systems, allowing for efficient shared storage and backup management.
If you need to get more background info on how to mount samba shares on Ubuntu, try these resources:
- The Ubuntu Wiki on mounting windows shares.
- a Suse reference for setting up smb shares from Windows in fstab
- Ubuntu Fstab Help
- Ubuntu SMB Reference