Difference between revisions of "Samba"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 11: Line 11:
  
 
= Providing a network drive =
 
= Providing a network drive =
In this chapter we discuss how to provide a network drive that is accessible for Windows and Linux computers in the [[network]].
+
To provide a network drive that is accessible for Windows and Linux computers in the [[network]] using SAMBA:
Make sure /etc/samba/smb.conf contains the following:
+
* make sure SAMBA is installed, e.g. on SUSE Linux:
 +
yast -i samba
 +
* make sure /etc/samba/smb.conf contains the following:
 
  [global]
 
  [global]
 
  security = share
 
  security = share
Line 21: Line 23:
 
  read only = no
 
  read only = no
 
  public = yes
 
  public = yes
Then [[open a console]] and issue  
+
* Then [[open a console]] and issue  
 
  /etc/init.d/smb restart
 
  /etc/init.d/smb restart
Then mount the tmp share
+
* Then mount the tmp share
 
  mount //localhost/tmp /mnt/smb
 
  mount //localhost/tmp /mnt/smb
 
If this works, congratulations! Your samba is dancing now (ha, ha, bad joke ;)
 
If this works, congratulations! Your samba is dancing now (ha, ha, bad joke ;)

Revision as of 15:30, 5 September 2013

Samba allows you to access network drives on Windows computers from your Linux computer and to provide network drives for Windows computer on your Linux computer. If your computer accesses a network drive, you are using the Samba client. If you provide a network drive on your computer, you are running the Samba server.

Find out what is mountable

To find out what network shares are provided by a Windows server use the command

smbclient --user "windowsdomain\windowsuser" -L server

Mounting a network drive

You are on a Linux computer and want to mount a Windows computer's shared drive. To do this, open a console and type

mount -o username="windowsdomain\windowsuser",password=password //computer/share /mountpoint

Here you replace user by your user name, password by your password, computer by your computer's name, share by your share's name and /mountpoint by your mountpoint, e.g. /mnt/samba. Note that your mountpoint has to be an existing directory. This example has been tested with SUSE Linux Enterprise Server 10 and Windows Enterprise Server 2008 but should work same or similar with any distribution.

Providing a network drive

To provide a network drive that is accessible for Windows and Linux computers in the network using SAMBA:

  • make sure SAMBA is installed, e.g. on SUSE Linux:
yast -i samba
  • make sure /etc/samba/smb.conf contains the following:
[global]
	security = share

[tmp]
	comment = Temporary file space
	path = /tmp
	read only = no
	public = yes
/etc/init.d/smb restart
  • Then mount the tmp share
mount //localhost/tmp /mnt/smb

If this works, congratulations! Your samba is dancing now (ha, ha, bad joke ;) To make samba startup after a reboot, say

chkconfig smb on

TroubleShooting

Permission denied

If you get

mount error 13 = Permission denied

You may have to add the samba user for the mount. Like this:

smbpasswd -a root

No such device or address

# mount -o username="server\Administrator",password=password //server/mydata /mnt/samba
retrying with upper case share name                                                                   
mount error(6): No such device or address                                                             
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) 

In this case it helped to go to the Windows server, click on "Advanced Sharing" -> "share this folder".

See also