[TriLUG] Mounting Samba shares on a Linux server

Jon Carnes jonc at nc.rr.com
Thu Jun 5 10:27:49 EDT 2003


Here's a nice site that covers using smbmount and making smb mounts
persistent across reboots:
 
http://www.justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html

Some examples:

  smbmount //servername/sharename /mountdirectory -o
     username=mywindowsusername,password=mywindowspassword

  mount -t smbfs //servername/sharename2 /mountdirectory2 -o 
     username=mywindowsusername,password=mywindowspassword


/etc/fstab entry examples:

  //servername/sharename /mountdirectory smbfs
      username=windowsusername,password=windowspassword 0 0

  //servername/sharename2 /mountdirectory2 smbfs
      username=windowsuser,password=winpassword,uid=mylinuxusername,
      gid=mylinuxgroupname 0 0


Note: all the examples above are split across two or more lines to
accommodate the realities of email, but in the real world they should
each be on one line.

Creating and using a credentials file:
  cd /etc
  echo username=mywindowsusername > .smbpasswd
  echo password=mywindowspassword >> .smbpasswd
  chmod 600 .smbpasswd

  //servername/sharename /mountdirectory smbfs
      credentials=/etc/.smbpasswd 0 0

  //servername/sharename2 /mountdirectory2 smbfs
      credentials=/ect/.smbpasswd,gid=sambausersgroup 0 0


Note: the credentials file does not have to be in /etc, it can be in any
secure directory.






More information about the TriLUG mailing list