Difference between revisions of "Samba"

From Noah.org
Jump to navigationJump to search
Line 25: Line 25:
  
 
== Make SMB mounts persistent with fstab ==
 
== Make SMB mounts persistent with fstab ==
Add a line like the following to your /etc/fstab file:
+
Add the following to /etc/fstab and /media/SharedDocs will be automatically mounted  
  //192.168.2.4/SharedDocs /media/SharedDocs smbfs auto,username=guest,password=,rw,user 0 0
+
when you reboot or run "mount -a". The IP address, 192.168.2.4, may be replaced with the Windows server name.
Then /media/SharedDocs will be automatically mounted when you reboot or run "mount -a".
 
The IP address, 192.168.2.4, may be replaced with the Windows server name.
 
 
You may also need to set username and password.
 
You may also need to set username and password.
 +
 +
=== New style using cifs ===
 +
<pre>
 +
//192.168.2.4/SharedDocs /media/SharedDocs cifs auto,username=guest,password=,rw,user 0 0
 +
</pre>
 +
 +
=== Old style using smbfs ===
 +
<pre>
 +
//192.168.2.4/SharedDocs /media/SharedDocs smbfs auto,username=guest,password=,rw,user 0 0
 +
</pre>
  
 
== Error ==
 
== Error ==

Revision as of 16:41, 14 February 2007

Mount a Windows share on Linux

The mount command supports smbfs. Use it. Assuming you want to mount the folder \\server\SharedDocs. You'll need to resolve your Windows \\server name to an IP address. Assuming that \\server resolves to 192.168.2.4.

New style using cifs

mkdir SharedDocs
sudo mount -t cifs -o username=Guest //192.168.2.4/SharedDocs SharedDocs

Old style using smbfs

mkdir SharedDocs
sudo mount -t smbfs -o username=Guest //192.168.2.4/SharedDocs SharedDocs

Browse with smbclient

Don't put a trailing slash on the share name!

smbclient -UGuest //192.168.2.4/SharedDocs

Make SMB mounts persistent with fstab

Add the following to /etc/fstab and /media/SharedDocs will be automatically mounted when you reboot or run "mount -a". The IP address, 192.168.2.4, may be replaced with the Windows server name. You may also need to set username and password.

New style using cifs

//192.168.2.4/SharedDocs /media/SharedDocs cifs auto,username=guest,password=,rw,user 0 0

Old style using smbfs

//192.168.2.4/SharedDocs /media/SharedDocs smbfs auto,username=guest,password=,rw,user 0 0

Error

If you get an error something like this:

 smbfs: mount_data version 1919251317 is not supported

Then if probably means you don't have the smbfs module loaded. Under Ubuntu this is pretty easy to fix. Just run:

 sudo apt-get install smbfs