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).

  1. 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
  2. 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
  3. 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}/&
    
  4. 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'
  5. Restart autofs:
    /etc/init.d/autofs restart
  6. 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
(Visited 1 times, 1 visits today)

Category: Uncategorized
This entry was posted Friday, 11 May, 2007 at 11:56 am
You can follow any responses to this entry via RSS.

Leave a Reply

Your email address will not be published. Required fields are marked *

No comments yet