Please support VectorLinux!

Author Topic: Accessing/mounting Samba shares automatically  (Read 2095 times)

Freeman

  • Tester
  • Vectorite
  • ****
  • Posts: 323
  • Choice to the user!
Accessing/mounting Samba shares automatically
« on: March 02, 2008, 02:34:26 am »
I used this line from our wonderful Howto section to mount a samba share on my Vectorlinuxbox:
Code: [Select]
/usr/bin/smbmount //winmachine-1/shared /path/dir -o username=user_name
Now I wanted to automate this process and looked at the link provided in the Howto. This was a script especially created to mount sambadrives. But still, isn't it possible to paste this line in /etc/fstab? The only thing I'm missing in this command is the possibility to enter automatically my password...

Any thoughts on this?

Thanks!
Freeman :)
It's better to die 10 times, than never to have loved at all.

nightflier

  • Administrator
  • Vectorian
  • *****
  • Posts: 4072
Re: Accessing/mounting Samba shares automatically
« Reply #1 on: March 02, 2008, 05:15:20 am »
Here is how I do it:
I have a file ~/.smb/creds:
Code: [Select]
username=user
password=pass
The mount command is:
Code: [Select]
smbmount //computer/share /path/dir -o credentials=/home/user/.smb/creds
Problem with using fstab is that the network is not up by the time it is processed.
I call my mount command from KDE's Autostart folder.
You can also use /etc/rc.d/rc.local, but that one is run as root, which may cause some read-write issues.

Here is a guide on using ~/.bashrc: http://blog.unixlore.net/2006/05/accessing-windows-shares-from-gnulinux.html
« Last Edit: March 02, 2008, 05:22:41 am by nightflier »

Freeman

  • Tester
  • Vectorite
  • ****
  • Posts: 323
  • Choice to the user!
Re: Accessing/mounting Samba shares automatically
« Reply #2 on: March 04, 2008, 10:36:21 am »
Thanks Nightflier, that did the trick!
It's better to die 10 times, than never to have loved at all.