Setting up Samba Ubuntu.

Anonim

Setting up Ubuntu Samba.

If it becomes necessary to work with the same files on different computers under the control of different operating systems, the Samba will help this. But independently set up shared folders is not so simple, and for an ordinary user, this task is rather impossible. This article will tell how to configure Samba in Ubuntu.

The name of the group you are interested in is located in the Line of the Workstation Domain. Concrete location you can see in the image above.

Next, if on a computer with Ubuntu static IP, it must be prescribed to the "Hosts" file on Windows. The easiest way to do this using the "Command Line" with administrator rights:

  1. Specify the system with the "Command Line" request.
  2. Search for a command line in the Windows system

  3. In the results, click on the "command line" with the right mouse button (PCM) and select "Run from the administrator".
  4. Opening the command line in Windows with administrator rights

  5. In the window that opens, do the following:

    NotePad C: \ Windows \ System32 \ Drivers \ ETC \ HOSTS

  6. In the file that opened after executing the command, write your IP address in a separate line.

After that, the primary SAMBA setup is over. If you want to understand all the set parameters, you can do it on this site. To find the parameter you are interested in, expand on the left side of the "SMB.conf" list and find it there by selecting the first letter of the name.

Website with definition of all parameters in the SAMBA configuration file

In addition to the file "SMB.conf", the changes must also be made to "limits.conf". For this:

  1. Open the desired file in a text editor:

    Sudo gedit /etc/security/limits.conf.

  2. Before the last string in the file, insert the following text:

    * - Nofile 16384

    root - nofile 16384

  3. Save the file.

According to the result, he must have the following form:

File Limits CONF when setting up Samba in Ubuntu

This is necessary to avoid an error that occurs while connecting multiple users to the local network.

Now, to ensure the correctness of the entered parameters, you need to execute the command:

Sudo TestParm /etc/samba/smb.conf.

If, as a result, you will see the text that is shown in the picture below, it means that all the data you entered are correct.

Checking the configuration file of the SMB CONF in Ubuntu at Samba Nutrition

It remains to restart the Samba server with the following command:

Sudo /etc/init.d/samba Restart.

Ravating all the variables of the file "smb.conf" and making changes to "limits.conf", you can go directly to creating folders

Now the contents of the configuration file should look like this:

SAMBA configuration file with a shared folder added to it in Ubuntu

So that all changes entered into force, you need to restart Samba. This is done by the already known team:

Sudo Service Smbd Restart

After that, the shared folder will appear in Windows. To ensure that you follow the following in the "Command Line":

\\ Gate \ Share

Also, you can also open it through the conductor, by going to the "Network" directory, which is located on the side panel of the window.

Shared Samba folder in Windows

It happens that the folders are still not visible. Most likely, the reason for this is a configuration error. Therefore, once again go through all the above stages.

Step 4: Creating a folder with read-reading access

If you want users to view files on the local network, but do not edit them, you need to create a folder with read-only access. This is done by analogy with the shared folder, only other parameters are set in the configuration file. But in order not to remain unnecessary questions, we will analyze everything in stages:

Following the configuration file there should be three text blocks:

Samba configuration file after adding read-only folder in Ubuntu

Now restart the SAMBA server so that all changes entered into force:

Sudo Service Smbd Restart

After that, the folder with read-only rights will be created, and all users will be able to enter it, but will not be able to somehow change the files contained in it.

Step 5: Creating a folder with closed access

If you want the users to open the network folder to open, passing authentication, the actions for its creation are slightly different from the above. Make the following:

  1. Create a folder, for example, "PASW":

    Sudo Mkdir -p / Home / Sambafolder / Pasw

  2. Change its rights:

    Sudo Chmod 777 -R / Home / Sambafolder / Pasw

  3. Now create a user in the Samba group, which will be endowed with all the rights to access the network folder. For this, first create a group "Smbuser":

    Sudo Groupadd SMBuser.

  4. Add to the newly created user group. You can think of his name independently, in the example will be "Teacher":

    Sudo UseRADD -G SMBUSER TEACHER

  5. Set the password to be entered to open the folder:

    Sudo Smbpasswd -a Teacher

    Note: After executing the command, you will be asked to enter the password, and then repeat it, note that when entering characters are not displayed.

  6. Samba user password in Ubuntu

  7. It remains only to enter all the desired folder parameters to the SAMBA configuration file. To do this, first open it:

    Sudo gedit /etc/samba/smb.conf.

    And then copy this text:

    [PASW]

    Comment = Only Password

    Path = / Home / Sambafolder / Pasw

    Valid Users = Teacher

    read only = no

    Important: If performing the fourth item of this instruction, you have created a user with another name, then it must be entered in the "Valid Users" string after the symbol "=" and a space.

  8. Save the changes and close the text editor.

The text in the configuration file should now look like this:

SAMBA configuration file with all the created folders in Ubuntu

To be restred, check the file using the command:

Sudo TestParm /etc/samba/smb.conf.

According to the result, you should see about this:

Checking the samba configuration file for errors in ubuntu

If everything is in order, then restart the server:

Sudo /etc/init.d/samba Restart.

System Config Samba.

The graphical interface (GUI) is able to largely facilitate the SAMBA setting process in Ubuntu. At a minimum, the user who only switched to Linux, this method will seem more understandable.

Step 1: Installation

Initially, you need to install a special program in the system that has an interface and which is necessary for configuring. You can do this with the "Terminal" by executing the command:

Sudo Apt Install System-Config-Samba

If before that you did not install all Samba components to your computer, you will need to download with it and install some more packages:

Sudo Apt-Get Install -Y Samba Samba-Common Python-Glade2 System-Config-Samba

After everything you need has been set, you can go directly to the setting.

Step 2: Run

You can run System Config Samba in two ways: using the "Terminal" and through the Bash menu.

Method 1: Terminal

If you decide to use the Terminal, then you need to do the following:

  1. Press the CTRL + ALT + T key combination.
  2. Enter the following command:

    Sudo System-Config-Samba

  3. Press ENTER.

Next, you will need to enter a system password, after which the program window opens.

Note: During the implementation of the SAMBA configuration using the System Config Samba, do not close the terminal window, since in this case the program closes, and all changes will not be saved.

Method 2: Bash menu

The second method will seem easier to many, since all operations are performed in the graphical interface.

  1. Press the BASH menu button, which is located in the upper left corner of the desktop.
  2. Button MNU BASH in Ubuntu

  3. Enter the search query request "Samba" in the window that opens.
  4. Search string in the Bash menu in Ubuntu

  5. Click on the program of the same name in the "Applications" section.
  6. Samba in the Bash menu

After that, the system will ask you for a user password. Enter it and the program will open.

Password input window when you start Samba in Ubuntu

Step 3: Adding users

Before you begin directly to configure the Samba folders, you need to add users. It is done through the program settings menu.

  1. Click on the "Setup" item on the top panel.
  2. Settings button on the System Config Samba panel

  3. In the menu, select "Users Samba".
  4. Item Samba users in the System Config Samba settings menu in Ubuntu

  5. In the window that appears, click "Add user".
  6. Add user button in the Samba program window in Ubuntu

  7. In the "User Name of the Unix" drop-down list, select the user to which it be allowed to enter the folder.
  8. List of Samba users in Ubuntu

  9. Manually enter the Windows username.
  10. Field for entering the Windows username in Samba on Ubuntu

  11. Enter the password, and then repeat it input in the appropriate field.
  12. Enter the samba user password in Ubuntu

  13. Click the "OK" button.

In this way, you can add one or more Samba users, and in the future determine their rights.

After that, the server configuration will be over, you can go directly to the creation of the SAMBA folders.

Step 5: Create folders

If you did not create public folders earlier, the program window will be empty. To create a new folder, you need to do the following:

  1. Click on button with sign plus sign.
  2. Button to create a new public folder in Samba in Ubuntu

  3. In the window that opens, in the "Main" tab, click "Overview".
  4. Browse button to select a catalog for shaking in Samba in Ubuntu

  5. In the file manager, specify the desired folder to share it.
  6. Specifying folders for increasing in the file manager using the System Config Sam program in Ubuntu

  7. Depending on preferences, check the checkboxes next to the "Record is allowed" (the user will be allowed to edit files in a public folder) and "visible" (on another PC, the folder will be visible).
  8. Ticks to resolve the edit of publicly accessible samba folders and display them on other PCs.

  9. Go to the "Access" tab.
  10. Tab Access to System Config Samba in Ubuntu

  11. It has the ability to identify users who will be allowed to open a shared folder. To do this, put the mark next to "provide access to only specific users". After that you need to choose them from the list.

    Providing access to SAMBA shared folder only to specific users.

    If you are going to make a public folder, then put the switch to the "Provide Access All" position.

  12. Click the "OK" button.

After that, the newly created folder will be displayed in the main program window.

Created shared folder in the System Config Samba program in Ubuntu

If you wish, you can create some more folders using the above instruction, or change the already created by clicking on the "Change Properties of the Selected Catalog" button.

Button to change the properties of the selected directory in the System Config Samba program in Ubuntu

As soon as you create all the desired folders, you can close the program. On this instruction on setting up Samba in Ubuntu using the System Config Samba program is over.

Nautilus.

There is another way to configure Samba in Ubuntu. It is perfect for those users who do not want to install extra on their own to the computer and who do not like to resort to the use of the "Terminal". All settings will be performed in the standard Nautilus file manager.

Step 1: Installation

Using Nautilus to configure Samba, the method of installing the program is slightly different. This task can be performed using the "Terminal", as described above, but the following method will be considered below.

  1. Open Nautilus by pressing the icon in the taskbar or searching on the system.
  2. File Manager icon in Ubuntu

  3. Go to the directory where the desired directory is located.
  4. Click on the PCM and select the "Properties" line from the menu.
  5. Opening the properties of the folder in Ubuntu

  6. In the window that opens, go to the "Open Local Network" folder.
  7. Tab Public Local Network Folder in Ubuntu

  8. Check the box next to "Publish this folder".
  9. Tick ​​in the properties of the folder Publish this folder in Ubuntu

  10. A window will appear in which you want to click on the "Install Services" button to start the SAMBA to the system.
  11. Set button to download and install Samba in Ubuntu

  12. A window appears in which you can familiarize yourself with the list of installed packages. After reading, click the Install button.
  13. Install Samba button in Ubuntu

  14. Enter the user password to allow the system to download and install.
  15. Authentication window when installing Samba in Ubuntu

After that, you can wait for the end of the installation of the program. As soon as it is completed, you can go directly to the SAMBA setting.

Step 2: Setup

Customize Samba in Nautilus is much easier than using the "Terminal" or System Config Samba. All parameters are specified in the catalog properties. If you forgot how to open them, then follow the three items of the previous instruction.

To make the folder publicly available, follow the instructions:

  1. In the window, go to the "Rights" tab.
  2. Loping tab in the properties of the folder

  3. Determine the rights for the owner, group and other users.

    Definition of rights for users in Ubuntu

    Note: If you need to restrict access to the public folder, then from the list, select the "No" string.

  4. Click "Change Rights to Nested Files".
  5. Button Change Rights to Nested Files in Folder Properties in Ubuntu

  6. In the window that opens, by analogy with the second item of this list, determine the rights of users to interact with all the files invested in the folder.
  7. Defining user rights to files in a folder in Ubuntu

  8. Click "Change", and then go to the "Shared Local Network Folder" tab.
  9. Local Network Public Network Tab in Ubuntu Properties

  10. Mark the "Publish this folder" item.
  11. Tick ​​in the properties of the folder Publish this folder

  12. Enter the name of this folder.

    Enter the names of a publicly available folder in Nautilus

    Note: The "Comment" field, if you wish, you can leave not filled.

  13. Put or, on the contrary, remove the checkboxes with "Allow other users to change the contents of the folder" and "guest access". The first paragraph will allow users who are not endowed with rights, edit nested files. The second - will open access to all users who do not have a local account.
  14. Advanced settings of the publicly accessible folder in Ubuntu

  15. Click "Apply".

After that, you can close the window - the folder has become publicly available. But it is worth noting that if you did not set up the Samba server, that is, the likelihood that the folder will not be displayed on the local network.

Note: How to configure the Samba server told at the beginning of the article.

Conclusion

Summing up, we can say that all of the above methods are largely different from each other, but they all equally allow the SAMBA setting to Ubuntu. So, using the "Terminal", you can make a flexible setting by setting all the necessary parameters as the Samba server and the publicly available folders created. The System Config Samba program also allows you to configure the server and folders, but the number of specified parameters is much smaller. The main advantage of this method is the presence of a graphical interface, which will largely facilitate the setting for an ordinary user. Using the Nautilus file manager, you do not have to download and install additional software, but in some cases it will be necessary to manually configure the SAMBA server using the same "Terminal".

Read more