Article
article
Reads:
1733
Score:
by Dewey Hylton
Problem:
Easily integrating your Linux host into a Windows environment ...
Solution:
This solution allows one to very easily navigate any number of windows/samba servers and shares with any file management application (and from the shell).
- Add a line to /etc/auto.master to base your network mounts on, and point to its configuration file - such as:
/mydomain /etc/auto.mydomain
- Create the host-level configuration for that mount point (place in /etc/auto.mydomain for this example, all on one line):
* -fstype=autofs,-Dhost=& file:/etc/auto.mydomain.sub
- Create the share-level configuration (on two lines in /etc/auto.mydomain.sub in this example):
* ${host}:/& * -fstype=smbfs,workgroup=mydomain,uid=myuser,credentials=/home/myuser/.smb/mydomain ://${host}/& - Create your credentials file:
touch /home/myuser/.smb/mydomain chmod /home/myuser/.smb/mydomain echo > /home/myuser/.smb/mydomain 'username = myuser' echo >> /home/myuser/.smb/mydomain 'password = mypassword'
- Restart autofs:
/etc/init.d/autofs restart
- Test/use the new configuration:
ls /mydomain/somewindowshost/somesharename ls /mydomain/smbhost2/othershare/directory
A very cool aspect of this configuration is that root access is no longer needed after the configuration has been made. The end-user has ownership of the credentials file, and that file is referenced every time a mount is made. That means the user can simply edit the credentials file after changing the windows/samba password, and new mounts will utilize the new password.
Environment:
prerequisites:
- recent linux distribution
- smbfs/cifs kernel module
- samba client
- autofs





0