Integrating Your Linux Host into a Windows Environment

By: dhylton

May 11, 2007 11:56 am





by Dewey Hylton


Easily integrating your Linux host into a Windows environment …


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.



  • recent linux distribution
  • smbfs/cifs kernel module
  • samba client
  • autofs
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.