Samba and Windows or Linux network
In this tutorial we will learn to share network resources between Linux and Windows and vice versa.
WE BEGIN TO SEE THE LINUX SHARED RESOURCES FOR WINDOWS.
To begin with, and say you must have understood that a machine with any Linux distribution installed, you will usually installed Samba and smbfs client and Samba server, if there is no go to the official website of Samba – http://www.samba.org – and download it.
To show the shared resources on Windows and Linux ‘almost’ trivial.
open a shell and type:
smbclient-L ipserversamba
(the machine where the files are shared)
if you ask the password write it down.
Appear ‘a screen like this:
hsnemesi@hsndebian:~$ smbclient -L 192.168.1.199 Password: (in questo caso nn c'e' nessuna password) Domain=[BIU] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] Sharename Type Comment --------- ---- ------- IPC$ IPC IPC remoto D Disk Documenti Disk ADMIN$ Disk Amministrazione remota C Disk Domain=[BIU] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] Server Comment --------- ------- Workgroup Master --------- -------
ve learning as you can see the machine name (BIU), the operating system
and then a list of items, we are interested Sharename and that ‘the share name.
in this particular case we are interested: D, C, Documents.
At this point we create a folder to see what ‘you see shares with the command mkdir.
eg:
mkdir /home/pluto/condivisioneD
now we just have to fit within our desired network resource directory with the command.
follow our example:
mount -t smbfs //192.168.1.199/D /home/pluto/condivisioneD
as if by magic and you will see in the folder /home/pluto/condivisioneD everything that is in the resource
D. Network
If there are user and passwd just add the option-o as the example below:
mount -t smbfs -o username=tuouser,password=tuapasswd //192.168.1.199/D /home/pluto/condivisioneD
NB: Always check the permissions.
That’s it. Easy is not it? Only a couple of commands.
TIME TO SEE THE RESOURCES ENSURE Linux shared in Windwos.
First you need to configure Samba by editing the smb.conf file
usually found in /etc/samba/.
Before you start making changes of which you might regret it I highly recommend making a copy.
Open this file and delete all content (we do so first): D
So you begin to write:
[Global]
name of the workgroup (the pound sign indicates a comment)
workgroup = mygroup
hosts allow = 100,100,100. 255.
machines (PCs) with access to Samba, in ‘as that goes across the network 100.100.100.1 to 100,100,100,255
interfaces = 100.100.100.1/24 100.100.100.2/24
identifies the type or network cards enabled for samba.
In ‘as it is assumed that the server has two network adapters: 100.100.100.1 100.100.100.2 and the / 24 is
indicating the netmask
wins support = no
our need not to register and resolve names windows, so we do not need this support
security=user
This setting allows us to securely authenticate users to our Samba server
log file = /var/log/samba/log.% m
With this option you write a file that will access Samba ‘updated for each machine that connects.
log level = 2
best not to increase this level if you do not want to find the log full of garbage.
TCP_NODELAY SO_RCVBUF socket options = SO_SNDBUF = 8192 = 8192
This serves to accelerate your communications with Samba
load printers = yes
printing = bsd
printcap name = /etc/printcap
allows Samba to provide network printers configured on the server.
Note that nn always printcap is located in / etc, find him.
preferred master = yes
this option will cause the Samba server for the election for browsing may be more favorably
dns proxy = no
we do not want the DNS, at least not in this context
netbios name = SambaServer
this and ‘the name by which it your own PC will be’ seen on the network, you can change it as you like.
browseable = yes
requires the appearance of the netbios name in browsers
encrypt passwords = yes
use this option if you want your client to be recognized by the authentication system for GNU / Linux
smb passwd file = /etc/samba/smbpasswd
inside this file there are passwords for users
config file = /etc/samba/smb.conf.% u
This option allows us to use a different configuration file instead of smb.conf, for example:
smb.conf.franco, use or% G for example: if smb.conf.amministratori directors is the primary group of
Membership Fees for that user. Please note: all users and groups to which they belong must be
posted on GNU / Linux system even if their passwords may be different from those of Samba.
And with this we finish the section [global]. Now for the various services.
Assume that your users are: Ciccio, Pine, Toto, Maria Franca, Tanino, Jachino, Fina and Carmela, and they
are distributed in three groups: Kitchen (users: Ciccio, Carmela and Jachino), House (users: Maria Franca
Tanino) and Garden (users: Pine, Toto and Fina). In this case we could create a service, like a
share of global exchange to which all users have access to both reading and writing, but not
we want everyone to modify / delete files of another, of course we could use the umask of Linux, but
we are down to earth and use the smb.conf like this:
[Public]
comment = Public Area interchange
user =% S
path = /home/samba/pub
browseable = yes
writeable = yes
public = yes
%d = user option allows access to this service by any user recognized by Samba.
I think the rest is intuitive, otherwise I’ll go look!
Do not forget to set the right permissions so the directory /home/samba/ pub to be viewed by users.
Then we want to make a share for each group to which only users of that group can access both read and write, like this:
[Group]
comment = Private group
user =%S
path = /home/samba/% G
browseable = yes
writeable = yes
public = no
The variable% G identify, from time to time, which of the subfolders that are named as groups: Kitchen, Home & Garden, direct the service.
Do not forget to set the right permissions so the directory /home/samba/kitchen/home/samba/home and/home/samba/Garden are seen by users.
Now we want to create a utility service as the “Official Communications”, which is accessible to all, but read-only and where only a user, properly authorized, can write. Here’s how:
[Doc_ufficiali]
comment = Official communications to all
user =% S
path = /home/samba/doc_uff
browseable = yes
ready only = yes
public = yes
admin users = Ciccio
admin users = option allows you to identify a user as amministartore of that service. Bell’opzione, but use with caution!
Do not forget to set the right permissions so the directory /home/samba/doc_uff to be viewed by users.
If I wanted to extend the rights of an entire group amministartore to do so:
admin users = @Kitchen
I could go on endlessly with pretty much give examples, but since I am bored, I stop here, just by adding a section for example printers:
[Stpampante]
user =% S
comment = Printer on the server
path = / var / spool / lpd / printer
printer name = printer
public = no
writeable = no
printable = yes
browseable = yes
Do not forget to set the right permissions so the directory /var/spool/lpd/ printer to be viewed by users.
And that’s all.
Part of the tutorial and ‘was written by me, on the other hand, and’ was taken from the internet and modified.








