Difference between revisions of "Samba"
Line 91: | Line 91: | ||
locking = no | locking = no | ||
guest ok = yes | guest ok = yes | ||
+ | </pre> | ||
+ | |||
+ | == Samba Spaces in directory filename == | ||
+ | |||
+ | If you have directory path that has a space in it then here is how you set this in /etc/fstab. For example, say the Windows shared directory had a space in the name such as "Shared Docs" instead of "shareddocs". Use '\040' instead of a space. | ||
+ | |||
+ | <pre> | ||
+ | //192.168.2.14/Shared\040Docs /media/shareddocs cifs auto,user=YOUR_WINDOWS_LOGIN,password=YOUR_WINDOWS_PASSWORD,rw,gid=admin,file_mode=00666,dir_mode=00777 0 0 | ||
</pre> | </pre> |
Revision as of 17:46, 12 May 2008
Contents
It's pretty easy to mount a Windows network share on Linux. The mount command supports filesystem type cifs (and smbfs). Assuming you want to mount the folder \\server\SharedDocs. You may need to resolve your Windows \\server name to an IP address. Assuming that \\server resolves to 192.168.2.4. I find it easier than trying to use the Windows group names.
Using cifs
mkdir shareddocs sudo mount -t cifs -o user=Guest //192.168.2.14/shareddocs shareddocs
Old style using smbfs
mkdir shareddocs sudo mount -t smbfs -o username=Guest //192.168.2.14/shareddocs 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.
Using cifs
//192.168.2.14/shareddocs /media/shareddocs cifs auto,username=guest,password=,rw,user 0 0
Mount with a given group of admin
and forced file and dir permissions.
//192.168.2.14/shareddocs /media/shareddocs cifs auto,user=YOUR_WINDOWS_LOGIN,password=YOUR_WINDOWS_PASSWORD,rw,gid=admin,file_mode=00666,dir_mode=00777 0 0
Old style using smbfs
//192.168.2.14/shareddocs /media/shareddocs smbfs auto,username=guest,password=,rw,user 0 0
Browse with smbclient
Don't put a trailing slash on the share name!
smbclient -UGuest //192.168.1.1/SharedDocs
Errors
mount_data version 1919251317 is not supported
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
mount error 6
If you get an error like this:
mount error 6 = No such device or address Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
then you probably used the wrong share name. The remote share does not exist.
This provides read/write for everyone on the given disk named sde1 and mounted under /media/sde1. This is put in /etc/samba/smb.conf and samba must be restarted.
[global] security = share [sde1] comment = sde1 on Linux server path = /media/sde1 public = yes writable = yes locking = no guest ok = yes
Samba Spaces in directory filename
If you have directory path that has a space in it then here is how you set this in /etc/fstab. For example, say the Windows shared directory had a space in the name such as "Shared Docs" instead of "shareddocs". Use '\040' instead of a space.
//192.168.2.14/Shared\040Docs /media/shareddocs cifs auto,user=YOUR_WINDOWS_LOGIN,password=YOUR_WINDOWS_PASSWORD,rw,gid=admin,file_mode=00666,dir_mode=00777 0 0