Automatically mount a windows share at boot time with Linux
This document (7000932) is provided subject to the disclaimer at the end of this document.
Environment
Windows or Samba Share available on the network.
Situation
Resolution
//<Winserver>/<Share> <Mountpoint> <FileSystemType> <Options> 0 0
Here's an example, setting the group ID and the permissions to allow those in the group users read and write access to the share:
//winserver/share /mnt/winshare cifs gid=users,file_mode=0664,dir_mode=0775,auto,username=john,password=johnpass 0 0
This example assumes the following values (includes explanation where needed):
//winserver/share (Windows Share)
The Windows system (winserver) could be identified as a DNS hostname or IP address.
/mnt/winshare (Mount Point)
This is the already existing directory on the SLED local file system which will become the access point to the remote Windows share. It can be created anywhere on the system; modify the command appropriately.
cifs (File System Type)
This used to be smbfs but the smbfs module is no longer being developed and is no longer supported.
gid=users
All files and directories on the remote system (including the mount point) will be assigned the group users.
file_mode=0664
All existing files on the remote system will be assigned permissions of rw-rw-r--.
dir_mode=0775
All existing directories (including the mount point) on the remote system will be assigned rwxrwxr-x.
auto
Automatically mount on system boot.
username=john
Windows user to connect with: john
password=johnpass
John's Password: johnpass
0
Indicates that this file system should not be dumped.
0
Indicates that this file system should not be checked by fsck.
Troubleshooting
If the share is not getting mounted, try to mount the share manually, as the root user, to see if there are any errors. Here's the command:
mount -t cifs -o username=<WindowsUserID>,password=<UserPassword> //<WinServer>/<Share> /<Mountpoint>
Following our example:
mount -t cifs -o username=john,password=johnpass //winserver/share /mnt/winshare
If the password is omitted from the mount command it will be asked for after issuing the command.
Additional Information
The following 2 lines should be in the credential text
file (replacing <bracketed> items with your
specific information):
username=<WindowsUserID>
password=<UserPassword>
On SLES10, the package samba-client needs to be installed manually and started on bootup to mount Samba-shares automatically on boot.
This can be achieved by running the following commands:
# zypper in samba-client
# insserv smbfs
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7000932
- Creation Date: 15-Jul-2008
- Modified Date:03-Mar-2020
-
- SUSE Linux Enterprise Desktop
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com