Windows.  Viruses.  Notebooks.  Internet.  office.  Utilities.  Drivers

Samba- a program that allows you to access network drives on various operating systems via SMB/CIFS protocol. It has client and server parts. Is free software, released under the GPL license.

Samba runs on most Unix-like systems such as GNU/Linux, POSIX-compliant Solaris and Mac OS X Server, various BSD variants, OS /2, Windows. Samba included in almost all GNU/Linux distributions, including, of course, Ubuntu.

Installation

To make a shared folder in Ubuntu Desktop just click right click click on the folder and select the "Publish folder" menu item. None configuration files there is no need to edit. Everything described below applies only to manual setting, for example, in the case of creating a file server.

To install, just open a terminal and type:

sudo apt-get install samba

The app will automatically download and install.

Setting

Let's do it using the terminal backup initial configuration file:

sudo cp /etc/samba/smb.conf(,.bak)

Now you can edit the settings file /etc/samba/smb.conf, to do this, open it in any text editor with superuser rights. For example, like this:

sudo nano /etc/samba/smb.conf

What is written below is generally just one specific Samba use case, and in a huge number of cases everything is configured absolutely wrong. The article needs to be corrected, focusing on the capabilities of Samba, and not just on using this program as a file storage with local authorization. An example with file storage is better to take out in a separate detailed article.

An example of setting up Samba as a standalone file server with authorization:

; Global server settings ; General server settings ; The name of the computer that will be displayed in the network environment netbios name = main-server server string = ; Working group clients workgroup = WORKGROUP announce version = 5.0 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192 passdb backend = tdbsam security = user null passwords = true ; Username alias file username map = /etc/samba/smbusers name resolve order = hosts wins bcast ; wins support is set to yes if your Samba nmbd(8) is a WINS server. Do not set this option to yes unless you have multiple subnets and do not want your nmbd to act as a WINS server. Never set this option to yes on more than one machine within the same subnet. wins support = no ; Printer support printing = CUPS printcap name = CUPS ; Logs log file = /var/log/samba/log.%m syslog = 0 syslog only = no ; Setting binding to interfaces on which to listen, if not specified, listens on all interfaces; interfaces = lo, eth0 ; bind interfaces only = true ; ; ; path = /var/lib/samba/printers ; browseable = yes ; guest ok = yes ; read only = yes ; write list = root ; create mask = 0664 ; directory mask = 0775 ; ; ; path = /tmp ; printable = yes ; guest ok = yes ; browseable = no ; ; ;path = /media/cdrom ;browseable = yes ;read only = yes ;guest ok = yes ; Shara hard drive; The name of the balls, visible to customers ; Path to shared disk path = /media/sda1 ; Is it possible to browse browseable = yes read only = no guest ok = no create mask = 0644 directory mask = 0755 ; Binding to a specific username or group, names separated by spaces; force user = user1 user2 ; force group = group1 group2 ; Another HDD, similar to above path = /media/sde1 browseable = yes read only = no guest ok = no create mask = 0644 directory mask = 0755

Now we need to deal with users.

Samba uses users that are already in the system, let's take the name user for example, let's say that it is already in the system, you need to add it to the SMB database and assign a password to access shares, let's do this with the command:

Smbpasswd -a user

You will be prompted to enter a password, the user will be added to the database, now you need to enable this user.

Smbpasswd -e user

Next, let's create an alias for the username user to make it easier for us to access with Windows machines on which, for example, we have a user named Admin, for this we will create and edit the /etc/samba/smbusers file:

sudo touch /etc/samba/smbusers sudo gedit /etc/samba/smbusers

Write a couple of lines to the file

# Unix_name = SMB_name1 SMB_name2 user = Admin

This completes the setup, restart Samba.

You can install the simplest GUI for Samba with the command:

sudo apt-get install system-config-samba

It is launched with the command:

sudo system-config-samba

It writes all changes to the samba configuration file.

For remote administration of Samba as a web interface for Samba is perfect

Linux is a great operating system, but we can't get away from Windows and it's from us too. Windows will always surround us - whether at home, corporate network or internet cafe. We constantly have to exchange documents with Windows computers - after all, not all users prefer to work in Linux. Having a server at your disposal linux , in any case, there will be a need to interact with Windows computers, so we will talk about Linux connection to the Microsoft network.

Installing Samba

To install Samba, we need to install the samba and samba-client packages. It is also advisable to install the smbfs package. In addition, the system will update the samba-common package, which may already be installed on the system. All my manipulations will be carried out on ubuntu 10.04, the main difference from other distributions is the installation method. For ubuntu through the console like so:

$ sudo apt - get install samba

Or using the Synaptic package manager, which I did, this option turned out to be more convenient for me, since I could select from the list the packages that I needed, these were:

    samba

    smbclient

    samba-common

If you have ever used another Linux distribution, then you are probably familiar with the LinNeighborhood program. This graphics program, which allows you to view Windows network resources. It is not needed in Ubuntu. First, GNOME's stock tools allow you to browse Windows networks. And secondly, for the sake of interest, the LinNeighborhood program was installed from one of the Ubuntu repositories. It turned out that this program, found by Synaptic, is not usable at all (problems with localization). Well, okay, it makes sense to understand if there are excellent standard means that are already working.

Basic Samba Setup

At this stage, we will assume that the utility is installed. The main Samba configuration file is /etc/samba/smb.conf. You need to open it and change several parameters. The first one is work group - it specifies the name (of your choice) of the NT workgroup or domain:

WORKGROUP = MyHomeGroup

You can also set the comment parameter - this is a description of your computer:

comment = My Linux computer

Set the security option. If the network is a client/server, then you need to select server parameter, and ifpeer-to-peer network (that is, a network without a dedicated server), then you need to select user or share:

security = share

Guest Name account install like this:

guest account = guest

You also need to set up encodings:

client code page = 866

character set = utf8

To make Samba run faster, set the following options:

socket options = TCP_NO DELAY SO_RCVBUF=8192 SO_SNDBUF=8192

dns proxy=no

The interfaces parameter specifies the interfaces on which the Samba service should run. It is necessary to specify those interfaces that connect our machine with Windows networks:

interfaces = 192.168.0.22/24

Configuring Shared Resources

Now it remains to configure the resources that we want to share, this is the [ public].

# shared directory

comment = public directory

# path

path = /var/samba

# not only read

read only = no

# allow write

writable=yes

# allow guest access

guest ok = yes

# allow viewing the contents of the directory

browseable=yes

In this case, the /var/samba directory will be the shared resource of our computer (it needs to be created, since there is no such directory in the system by default). Other users will be able to write their files into it (read only=no, writeable=yes), naturally, they will be able to read them (browseable=yes). Checking the username and password to access the resource is not needed (guest ok=yes) - the so-called guest access is used. The comment "Public Directory" will be seen by other Windows network users when viewing the resources of our computer.

If there is a need to provide general access("share") to users' home directories, then go to the section ;. Uncomment all lines commented out with a semicolon before the line;. T . e . should get the following:

comment = Home Directories

browseable = no

valid users = %S

writable = no

create mask = 0600

directory mask = 0700

Now user directories will not be visible in the list of shares, you can access them at \\server\username . For example, \\server\petya. If you want user resources to be browseable, then set the browseable parameter to yes:

browseable=yes

After all the changes, save the configuration file and start (or restart - restart) Samba:

$ sudo /etc/init.d/samba start

Viewing Windows Network Resources

You can view Windows network resources using the smbclient program, but it works in text mode, so it's not very convenient to use. It is much more convenient to use the file browser to view network resources. You can do this using the menu. Transition | Connect to server...

Samba Optimization Secrets

Now let's talk about how to make Samba run a little faster. If you open the smb.conf configuration file, you will find the wide links option in it. Never install it in no ! So we will significantly reduce the performance of Samba. On the contrary, you need to set it to yes (if the wide links parameter was disabled before), which will significantly increase performance.

The wide links option determines how Samba follows symbolic links. If wide links=no then Samba will not follow symbolic links outside the exported area. Samba first follows the symbolic link and then performs a so-called directory path lookup (a system call that determines where the link ended). This operation implies 6 more system calls than if wide links=yes. Considering that there are a lot of such operations, disabling wide links reduces the performance of Samba by about 30%.

Samba is a file sharing and file sharing software between computers running Linux/Unix and an operating system. Windows system. Samba consists of client and server parts. The client side allows access to network folders and Windows resources, and the server room, in turn, shares the Ubuntu folder with other machines, including Windows.

This short tutorial will cover the simplest setup of Samba Ubuntu 18.04, as well as how to share an Ubuntu folder with several levels of privileges.

We will create three public folders with different permission levels. A folder with anonymous access, with access for users belonging to a specific group and access only for a specific user.

Both Linux and Widnows machines will be able to access shared folders in Ubuntu using any program that works via the SMB protocol.

For everything to work correctly, all machines must be in the same workgroup specified on the Samba server. By default on Windows, Linux, and MacOS, the workgroup is called Workgroup. To find out which workgroup is used in your Windows, open command line(Win + R, then cmd) and run the following command:

net config workstation

We see the parameter we need in the line Domain workstation . This is the working group.

Now, if a computer with a Samba server on your network has a permanent IP address, it is advisable to enter it in hosts file. To do this, run the command prompt as an administrator:

And run the command:

notepad C:\Windows\System32\drivers\etc\hosts

In the file that opens, add a line with the IP address of the computer on which Samba will be installed:

192.168.0.1 srvr1.domain.com srvr1

Now we can move on to the question of how to share the Ubuntu folder.

Setting up Samba on Ubuntu 16.04

Let's start, as usual, with the installation. Installing Samba Ubuntu along with all the necessary components is done with the command:

sudo apt-get install -y samba samba-common python-glade2 system-config-samba

When everything is installed, you can proceed to the configuration. First, back up the original Samba configuration file:

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

After creating a backup, create your configuration file with this command:

sudo vi /etc/samba/smb.conf

First, let's specify the global file server settings. To do this, insert the following lines into the file:


workgroup = WORKGROUP

netbios name = Ubuntu Share
dns proxy=no

max log size = 1000
passdb backend = tdbsam
unix password sync=yes

pam password change = yes
map to guest = bad user
usershare allow guests = yes

Let's take a closer look at what these lines mean.

  • work group- the working group, as already mentioned, should be the same on all machines
  • netbios-name- computer name that will be displayed in Windows;
  • log file- the address of the file where error messages and other information will be stored;
  • security- perform authentication at the user level by default;
  • name resolve order- order of resolution of IP addresses by NetBIOS name. bcast means send to local network broadcast request. If all computers between which interaction is planned are in the same network, this option is optimal;
  • passdb backend- method of storing user passwords;
  • unix password sync- synchronization of samba user passwords with local Unix passwords;
  • map to guest- Specifies when the user will be granted guest access. There are three values ​​available - never- never, bad user- when no such user exists, bad password- when the password is entered incorrectly,

When you have finished creating the configuration file, we move on to the question of how to share the Ubuntu folder for Windows.

Ubuntu Folder Sharing

First, let's create a public folder accessible to everyone. That is, with anonymous access, without samba authorization.

Create a folder to which we will open access, for example:

sudo mkdir -p /samba/allaccess

After the folder is created, you need to make the correct permissions for it. The following commands allow access to the folder for everyone and make the owner nobody:

cd /samba
sudo chmod -R 0755 allaccess
sudo chown -R nobody:nogroup allaccess/

The next step is to describe the allaccess folder in the samba configuration file:


path=/samba/allaccess
browsable = yes
writable=yes
guest ok = yes
read only = no

Your config file should now look like this:


workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
netbios name = Ubuntu Share
dns proxy=no
log file = /var/log/samba/log.%m
max log size = 1000
passdb backend = tdbsam
unix password sync=yes
passwd program = /usr/bin/passwd %u
pam password change = yes
map to guest = bad user
usershare allow guests = yes
#==============
path=/samba/allaccess
browsable = yes
writable=yes
guest ok = yes
read only = no

Let's take a closer look at the options that were used here:

  • path- path to the folder to be shared;
  • browsable- whether the folder will be displayed in the list of available shares;
  • writable- whether the folder will be writable;
  • read-only- the folder is read-only;
  • guest ok, public- whether guest access will be allowed;
  • only guest- if set to yes, then the folder will be available only to guests;
  • hosts allow- ip addresses from which you can access this server;
  • valid users- by default, all users can log in, if you pass a list of users in this parameter, then only they can log in;
  • create mask- rights mask for created files.

To apply the changes, restart the Samba server:

sudo systemctl restart samba

Configuring Samba Ubuntu 16.04 for anonymous access is now complete. Now you can check the availability shared folder allaccess from Windows, to do this, press Win + R and run:

\\srvr1\allaccess

You will see our folder. If you don't see it, check the configuration again. The folder can be accessed without samba authorization. The configuration of Samba shares with access without authorization is completed.

You can also connect to this server from Linux using Nautilus, just type the address smb://server ip, under other places:

Secure Ubuntu Folder Sharing

To share a folder for windows ubuntu, to which only users from a certain group will have access, we will create a separate folder and describe it in the Samba configuration file in Ubuntu.

First we create a folder:

sudo mkdir -p /samba/allaccess/secured

Create a group:

sudo addgroup securedgroup

Setting up rights:

cd /samba/allaccess
$ sudo chown -R richard:securedgroup secured
$ sudo chmod -R 0770 secured/

The last step is to add settings to the samba configuration file:

sudo vi /etc/samba/smb.conf


path=/samba/allaccess/secured
valid users = @securedgroup
guest ok = no
writable=yes
browsable = yes

Restart the Samba server. Now only users of the securegroup group can access the shared folder in Ubuntu.

To test how it works, let's add the user richard to our group:

sudo usermod -a -G securedgroup richard

The main configuration file for Samba is /etc/samba/smb.conf. The initial configuration file has a significant amount of comments to document the various configuration directives.

Not all possible options are enabled in the default settings file. See the guide man smb.conf or the Samba FAQ Collection for more details.

1. First change the following key/value pairs in the section /etc/samba/smb.conf file:

Workgroup=EXAMPLE ... security=user

Parameter security is significantly lower in the section and is commented out by default. Also replace EXAMPLE to something more appropriate for your environment.

2. Create a new section at the end of the file, or uncomment one of the examples for the directory you want to share:

Comment = Ubuntu File Server Share path = /srv/samba/share browsable = yes guest ok = yes read only = no create mask = 0755

    comment: A short description of the shared resource. Used for your convenience.

    path: path to the shared directory.

    This example uses /srv/samba/sharename because, according to the File System Hierarchy Standard (FHS), the /srv directory is where all data related to this site should reside. Technically, a Samba share can be placed anywhere on the file system where file limits access, but following the standards is recommended.

    browsable: Allows Windows clients to view the contents of a shared directory using Windows Explorer.

    guest ok: Allows clients to connect to the shared resource without specifying a password.

    read-only: Specifies whether the resource is read-only or write-only. Write privileges are available only when specified no, as shown in this example. If the value yes, then access to the resource will be read-only.

    create mask: determines what permissions will be set for new files that are created.

3. Now that Samba is configured, you need to create a directory and set permissions on it. Type in terminal:

sudo mkdir -p /srv/samba/share sudo chown nobody.nogroup /srv/samba/share/

parameter -p tells mkdir to create the full directory tree if it doesn't exist.

4. Finally, restart the samba services to apply the new settings:

sudo restart smbd sudo restart nmbd

Now you can find ubuntu file server using Windows client and browse its shared directories. If your client doesn't show your shares automatically, try accessing your server by its IP address, eg \\192.168.1.1, from a Windows Explorer window. To test that everything works, try creating a directory inside your share from Windows.

To create additional shares, create a new section in /etc/samba/smb.conf and restart Samba. Just make sure the shared directory is created and has the correct permissions.

Shared resource "" and way /srv/samba/share are just examples. Set the resource name and directory name to match your environment. It's a good idea to use the name of the resource's directory in the file system as the name of the resource. In other words, the resource can be specified as for the /srv/samba/qa directory.

Samba is a program that allows you to access network drives on various operating systems using the SMB/CIFS protocol. It has client and server parts. It is free software, released under the GPL license.
Samba runs on most Unix-like systems such as GNU/Linux, POSIX-compliant Solaris and Mac OS X Server, on various BSD variants, on OS/2, Windows. Samba is included in almost all GNU/Linux distributions, including, of course, Ubuntu.
Installation

To make a shared folder in Ubuntu Desktop, just right-click on the folder and select the "Share Folder" menu item. There is no need to edit any configuration files. Everything described below applies only to manual configuration, for example, in the case of creating a file server.
To install, just open a terminal and type:

sudo apt-get install samba

The app will automatically download and install.

Setting

Using the terminal, make a backup copy of the initial configuration file:

sudo cp /etc/samba/smb.conf(,.bak)

Now you can edit the settings file /etc/samba/smb.conf, to do this, open it in any text editor with superuser rights. For example, like this:

Sudo nano /etc/samba/smb.conf An example of configuring Samba as a standalone file server with authorization: ; Global server settings ; General server settings ; The name of the computer that will be displayed in the network environment netbios name = main-server server string = ; Workgroup clients workgroup = WORKGROUP announce version = 5.0 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192 passdb backend = tdbsam security = user null passwords = true ; Username alias file username map = /etc/samba/smbusers name resolve order = hosts wins bcast ; wins support is set to yes if your Samba nmbd(8) is a WINS server. Do not set this option to yes unless you have multiple subnets and do not want your nmbd to act as a WINS server. Never set this option to yes on more than one machine within the same subnet. wins support = no ; Printer support printing = CUPS printcap name = CUPS ; Logs log file = /var/log/samba/log.%m syslog = 0 syslog only = no ; Setting binding to interfaces on which to listen, if not specified, listens on all interfaces; interfaces = lo, eth0 ; bind interfaces only = true ; ; ; path = /var/lib/samba/printers ; browseable = yes ; guest ok = yes ; read only = yes ; write list = root ; create mask = 0664 ; directory mask = 0775 ; ; ; path = /tmp ; printable = yes ; guest ok = yes ; browseable = no ; ; ;path = /media/cdrom ;browseable = yes ;read only = yes ;guest ok = yes ; Hard drive ball; The name of the balls, visible to customers ; Path to shared disk path = /media/sda1 ; Is it possible to browse browseable = yes read only = no guest ok = no create mask = 0644 directory mask = 0755 ; Binding to a specific username or group, names separated by a space; force user = user1 user2 ; force group = group1 group2 ; Another hard drive, similar to the one above path = /media/sde1 browseable = yes read only = no guest ok = no create mask = 0644 directory mask = 0755

Now we need to deal with users.

Samba uses users that are already in the system, let's take the name user for example, let's say that it is already in the system, you need to add it to the SMB database and assign a password to access shares, let's do this with the command:

Smbpasswd -a user

You will be prompted to enter a password, the user will be added to the database, now you need to enable this user.

Smbpasswd -e user

Next, we will create an alias for the username user to facilitate access from the Windows machine on which we have, for example, a user named Admin, for this we will create and edit the /etc/samba/smbusers file:

sudo touch /etc/samba/smbusers sudo gedit /etc/samba/smbusers

Write a couple of lines to the file

# Unix_name = SMB_name1 SMB_name2 user = Admin

This completes the setup, restart Samba.

Samba file server for Windows network

Very often Samba is used to create a file server in Windows network.

File server in an Active Directory domain

To create a domain-integrated file server Active Directory, you first need to join your Ubuntu machine to the domain. This is the subject of a separate article:

To create a file server, you do not need to configure PAM, just add domain users and groups via Winbind to the system.

After successfully logging into the domain, all you have to do is configure the shared resources on your computer.

Here you should immediately pay attention to one very important thing: Samba tries to map the rights to Windows files to Unix rights, however, due to cardinal differences in the mechanisms for assigning rights, this is not always possible. Keep in mind that file permissions are always and in any case controlled by your file system on the Ubuntu machine, samba can only adapt to them, but not change their behavior.

Therefore, by default, shared resources will have very poor access control capabilities - the assignment of different rights for the user, group, and everyone else. However, this can be easily fixed by adding POSIX ACL support to your file system. In this case, it will be possible to assign various rights to different users and groups, almost like in Windows.

POSIX ACL support is at least in ext3/4, to activate it you just need to add to the mount options desired section acl parameter.

It is important that the directory you wish to share via Samba is on a drive mounted with the acl option. Otherwise, you will not be able to properly use the mechanism for delimiting access rights to files on the balls.

There is another very important point: POSIX ACLs do not support inheritance of access rights from parent directories, and this feature is present in Windows. Therefore, Samba implements an additional mechanism for storing information about the inheritance of access rights, which uses the extended attributes of the file system. Therefore, in order for Samba to correctly handle inheritance of rights, in addition to acl, it is necessary to add the user_xattr parameter to the file system mount options, which is responsible for enabling support for extended attributes.

For example, I always use separate LVM disks to organize shared resources, and my fstab lines for them look something like this:

/dev/mapper/data-profiles /var/data/profiles ext3 defaults,noexec,acl,user_xattr 0 2

The noexec option is needed because 100% shares for Windows should not be executable Linux files, and once again it won't hurt to play it safe.

To work with acl on Ubuntu, you need to install a package of appropriate utilities:

sudo aptitude install acl

After that, you can see the extended rights (i.e. ACL) on a file or directory with the command

Getfacl file

And install with the command

Setfacl file

Just in case, I want to draw attention to the fact that the POSIX ACL mechanism has nothing to do with Samba - it's just an add-on to the standard Linux permissions mechanism. Accordingly, Samba can use it, but cannot change or bypass it in any way.

To work with FS extended attributes, you will need a utility package very similar to acl - attr , which can be installed with the command

sudo aptitude install attr

To view extended attributes, you can use the command

Getfattr file

And for installation

Setfattr file

However, there is one small snag here. The point is that Samba stores all information about inheritance in binary form in a single extended attribute user.SAMBA_PAI . So you won't be able to change anything with setfattr, unless you completely remove extended attributes (sometimes you may need to do this).

Well, you will have to manage the inheritance of rights from a Windows machine using the standard tools of this system. Or with the smbcacls utility if you can figure out how to use it.

There is also an experimental VFS module acl_xattr that allows you to store NT ACLs entirely in extended attributes. Unfortunately, there is no documentation on it, so it is difficult to say something intelligible about it. Samba 4 is expected to have full integrated support for NT ACLs, but for now, you can use what you have.

If you have something to add about extended attributes in Samba and how to work with them, be sure to write in this forum thread. I would be grateful for any links, articles and comments on the topic.

In addition, extended file system attributes allow Samba to include full support for DOS file attributes such as hidden, archive, etc.

So, we will assume that you have a directory in the system that you want to share via Samba (and it is located on a disk mounted with support for acl and user_xattr). Now you need to actually configure its sharing. To do this, you need to enter the appropriate information in the /etc/samba/smb.conf file.

Let's start with general settings, which can be added to the section of this file (these are not all possible options, just a few quite useful ones):

# Disable printer sharing. Unless, of course, you really want to share them. # To completely disable all 4 lines below load printers = no show add printer wizard = no printcap name = /dev/null disable spoolss = yes # Make it hidden when viewed from Windows files with the following names hide files = /$RECYCLE.BIN/desktop.ini/lost+found/Thumbs.db/ # Use the following UNIX user as Guest guest account for the public share share = nobody # Treat unregistered users as guest map to guest = Bad User ## Settings using filesystem extended attributes # Handle permission inheritance with filesystem extended attributes map acl inherit = yes # Use filesystem extended attributes to store DOS attributes store dos attributes = yes # Disable DOS attribute mapping on UNIX permissions, enabled default # According to man smb.conf these options must be disabled when using extended attributes map archive = no map system = no map hidden = no map readonly = no

Now the settings of the directly shared resource. I have it called profiles, and physically on the Ubuntu machine is located at /var/data/profiles:

# Comment comment = User Profiles # Path to the folder that we share path = /var/data/profiles/ # Users with unlimited access rights to the share # I have a group of domain administrators. # These users are treated as local root when working with files admin users = "@DOMAIN\Domain Admins" # Hide folders that the user does not have access to hide unreadable = yes # Read only access read only = no # Masks for created files - can be set as desired #create mask = 0600 #directory mask = 0700 # Disable locking - it's better to disable locking = no

There are many other options - see the Samba documentation for details.

Do not forget to set the correct owner and access rights to the folder that you share, otherwise, despite any samba settings, writing to it at the level linux rights. I usually do this:

sudo chmod ug+rwx /var/data/profiles sudo chown root:"domain users" /var/data/profiles

Note that since your Ubuntu machine is domain entered, you can use domain users and groups as file owners directly in Ubuntu.

Verify that the Samba configuration is correct with the command

Testparm

Then restart Samba:

sudo /etc/init.d/samba restart

Now you can access the shared resource from any machine in the domain.

By the way, don't forget about SGID and Sticky bits for directories. They will allow you to inherit the owner group and prevent users from deleting files that are not their own - this can be very convenient for multi-user storages. However, unlike editing rights from Windows, changing these bits on folders on a shared resource will not work - only manually directly on the Ubuntu computer.

Among other things, Samba allows you to organize storage previous versions files, which is sometimes useful when creating shares with user data.

Standalone file server

Not everyone has an Active Directory domain. Therefore, it often becomes necessary to organize an offline file storage on a Linux machine with its own own system authorization. This is very easy to do.

The main feature of such an organization of file storage will be that all information about users will be stored in the Samba database, respectively, you will need to add and remove users to samba manually.

The most important thing is to decide on the method used to access the resource. To change it, you need to correctly set the value of the security parameter in the section of the /etc/samba/smb.conf file. You can read more about this parameter or in the official documentation.

Usually the value is share or user .

Standalone file server without authorization

It is convenient for the house so that everyone can see everyone. This can be done by adding 4 lines to the /etc/samba/smb.conf file section. Some may already exist.

[global] workgroup=WORKGROUP map to guest=Bad User netbios name=NOTEBOOK security=user

NOTEBOOK - the name of the computer that will be on the network. In addition, you need to install additional programs:

sudo apt-get install samba

For kubuntu, you also need to install smb4k . After editing the configs, you need to restart the services. In systemd (as of 15.04) a restart looks like this:

sudo systemctl restart smbd.service nmbd.service

You can view the "balls" through the file browser nautilus, konkueror or like this:

Smbclient -L 127.0.0.1

. Official documentation in English.

Sharing a folder on ubuntu

Create a folder for sharing files.

mkdir ~/share

Add the following lines to the end of the /etc/samba/smb.conf file, replace yuraku1504 with the username of the samba computer:

[MyShareWork] comment = Anonymous Samba Share path = / home/ yuraku1504/ share guest ok = yes browsable =yes writable = yes read only = no force user = yuraku1504 force group = yuraku1504

The folder will be opened for reading and writing.

If you notice an error, select a piece of text and press Ctrl + Enter
SHARE: