It is also extremely common for Ubuntu and Windows systems to be used side by side in networked environments. In addition to the workgroup setting, the other settings indicate that this is a standalone server on which the shared resources will be protected by user passwords. In order to fulfill this requirement we must add demo as a Samba user as follows: Now that we have completed the configuration of a very basic Samba server, it is time to test our configuration file and then start the Samba services. The following figure illustrates an Ubuntu system named LINUXSERVER located using Windows Explorer on a Windows 10 system: Double clicking on the LINUXSERVER host will prompt for the name and password of a user with access privileges. Restart Samba and open Windows File Explorer to view the shared location on Ubuntu. It is a common requirement, therefore, that files on an Ubuntu system be accessible to Linux, UNIX and Windows-based systems over network connections. If these resources do not need to be shared, the corresponding sections can be commented out so that they are ignored by Samba. In addition to providing integration between Linux and Windows systems, Samba may also be used to provide folder sharing between Linux systems (as an alternative to NFS which was covered in the previous chapter). If you are using the Uncomplicated Firewall (ufw) run the following command: Alternatively, if you are using firewalld, run the firewall-cmd command as follows: Before starting the Samba service a number of configuration steps are necessary to define how the Ubuntu system will appear to Windows systems, and the resources which are to be shared with remote clients. This is achieved using the smbclient package which was installed at the start of this chapter. To get access the shared folder: In Ubuntu, go to Files -> Other Locations. The majority of these configuration tasks take place within the /etc/samba/smb. In this case it is the demo account that we configured using the smbpasswd tool: Entering the username and password will result in the shared resources configured for that user appearing in the explorer window, including the previously configured /sampleshare resource: Double clicking on the /sampleshare shared resource will display a listing of the files and directories contained therein. Alternatively, the Connect to Server option may be used to connect to a specific system. Access the Ubuntu shared folder on Windows 10 remotely. Ubuntu resources, on the other hand, are shared with Windows systems by installing and configuring the Samba service. Right-click anywhere on the blank space and select “Add a Network Location“. The Files application is located in the dash as highlighted in Figure 23-1: Once launched, select the Other Locations option in the left-hand navigation panel followed by the Windows Network icon in the main panel to browse available windows resources: Samba allows both Ubuntu resources to be shared with Windows systems and Windows resources to be shared with Ubuntu systems. This is controlled via the workgroup = directive of the [global] section which by default is configured as follows: Begin by changing this to the actual name of the workgroup if necessary. In reality, however, many of the configuration options are not needed by the typical installation, and the learning curve to set up a basic configuration is actually quite short. For the purposes of this example, however, we will simply define the directory that is to be shared, indicate that the directory is both browsable and writable and declare the resource public so that guest users are able to gain access: To restrict access to specific users, the “valid users” property may be used, for example: The smb.conf file is pre-configured with sections for sharing printers and the home folders of the users on the system. Topics covered included the installation of Samba client and server packages and configuration of Samba as a standalone server. In order for an Ubuntu system to serve such resources over a network to a Windows system and vice versa it must, therefore, support SMB. For example, if we plan to share the /sampleshare directory of our Ubuntu system, we might entitle the section [sampleshare]. Consider, for example, that a user named demo is required to be able to access the /sampleshare directory of our Ubuntu system from a Windows system. If you do not want the drive to be mapped each time you log into the Windows system, turn off the corresponding check box: With the settings entered, click on the Finish button to map the drive, entering the username and password for the Samba user configured earlier in the chapter when prompted. As previously mentioned, Samba is a two way street, allowing not only Windows systems to access files and printers hosted on an Ubuntu system, but also allowing the Ubuntu system to access shared resources on Windows systems. Samba is a highly flexible and configurable system that provides many different options for controlling how resources are shared on Windows networks. More advanced configurations such as integrating Samba within an Active Directory environment are also available, though these are outside the scope of this book. If it is not currently installed, install it from a terminal window as follows: Shared resources on a Windows system can be accessed either from the Ubuntu desktop using the Files application, or from the command-line prompt using the smbclient and mount tools. Where: WIN_SHARE_IP is the IP address of windows machine. For that type \\ip-address-ubuntu\shared … Although Linux has made some inroads into the desktop market, its origins and future are very much server-based. The smb.conf file is divided into sections. If the $windows_user is … sudo service smbd restart. At this point, explorer should search the network and list any systems using the SMB protocol that it finds. Network location wizard will open, click on the “NEXT” button. When you click on Local Network Share, you will see the option of sharing the folder. Before moving on to configuring the resources to be shared, other parameters also need to be added to the [global] section as follows: The “netbios name” property specifies the name by which the server will be visible to other systems on the network. Windows systems share resources such as file systems and printers using a protocol known as Server Message Block (SMB). It is not surprising therefore that Ubuntu has the ability to act as a file server. Similarly, shared folders and printers residing on Windows systems may also need to be accessible from Ubuntu based systems. Enable sharing on Ubuntu To share a folder on the local network in Ubuntu, right click on the desired folder and select Local Network Share: Don’t see Local Network Share option? In the following example, the [homes] section has been commented out: Any user that requires access to a Samba shared resource must be configured as a Samba User and assigned a password. Similarly, shared folders and printers residing on Windows systems may also need to be accessible from Ubuntu based systems. For example. Before getting into more details of Samba sharing, it is worth noting that if all you want to do is access Windows shared folders from within the Ubuntu GNOME desktop then support is already provided within the GNOME Files application. On a suitable Windows system on the same workgroup as the Ubuntu system, open Windows Explorer and navigate to the Network panel. Ubuntu accesses Windows resources using the Samba client. While these settings are global, each option may be overridden within other sections of the configuration file. The first step in configuring Samba is to edit the /etc/samba/smb.conf file. The first section is the [global] section where settings can be specified that apply to the entire Samba configuration. To check whether Samba is installed, open a terminal window and run the following command: Any missing packages can be installed using the apt command-line tool: Next, the firewall currently protecting the Ubuntu system needs to be configured to allow Samba traffic. conf file. In this section a variety of configuration options are possible. Step 6: Configure Samba Private Share This task is achieved using the smbpasswd command-line tool. The next step is to configure the shared resources (in other words the resources that will be accessible from other systems on the Windows network). This will display the screen shown in Figure 23-7 below including an icon for the Windows Network (if one is detected): Selecting the Windows Network option will display the Windows systems detected on the network and allow access to any shared resources. This is a configuration known as a standalone Samba server. Copyright 2020 Neil Smyth / Payload Media, Inc. Open Windows File Explorer, right-click on the Network entry in the left-hand panel and select. The settings in the smb.conf file may be checked for errors using the testparm command-line tool as follows: In order for an Ubuntu server to operate within a Windows network both the Samba (SMB) and NetBIOS nameservice (NMB) services must be started. The steps in this section assume that appropriate network sharing settings have been enabled on the Windows system. If you are unable to see the Linux system or have problems accessing the shared folder, try mapping the Samba share to a local Windows drive as follows: Enable the checkbox next to Connect using different credentials. Unless you specifically requested that Samba be installed it is unlikely that you have Samba installed on your system. Thanks for reading Ubuntu 20.04 Essentials, Using NFS to Share Ubuntu 20.04 Files with Remote Systems, Installing KVM Virtualization on Ubuntu 20.04, An Android MotionLayout KeyCycle Tutorial, Ubuntu 20.04 System and Process Monitoring, Adding and Managing Ubuntu 20.04 Swap Space, Adding a New Disk to an Ubuntu 20.04 Volume Group and Logical Volume, Adding a New Disk Drive to an Ubuntu 20.04 System, Configuring an Ubuntu 20.04 Postfix Email Server, An Introduction to Ubuntu 20.04 Containers, Managing KVM on Ubuntu 20.04 using the virsh Command-Line Tool, Creating an Ubuntu 20.04 KVM Networked Bridge Interface, Creating Ubuntu 20.04 KVM Virtual Machines with virt-install and virsh, An Overview of Ubuntu 20.04 Virtualization Techniques, Creating Ubuntu 20.04 KVM Virtual Machines using Cockpit and virt-manager, Sharing Files between Ubuntu 20.04 and Windows Systems with Samba, Displaying Ubuntu 20.04 Applications Remotely (X11 Forwarding), Configuring SSH Key-based Authentication on Ubuntu 20.04, Ubuntu 20.04 Remote Desktop Access with VNC, Ubuntu 20.04 Remote Desktop Access with Vino, Basic Ubuntu 20.04 Firewall Configuration with firewalld, Using gufw and ufw to Configure an Ubuntu 20.04 Firewall, Ubuntu 20.04 Software Package Management and Updates. Now go to your Windows machine and you should see the shared Public folder on Ubuntu from when you browse File Manager as shown below… Everyone should have access there. In this chapter we will look at the steps necessary to share file system resources and printers on an Ubuntu system with remote Windows and Linux systems, and to access Windows resources from Ubuntu. The default settings used during the Ubuntu installation process do not typically install the necessary Samba packages. Note that the name or IP address of the remote system must be prefixed by smb:// and may be followed by the path to a specific shared resource, for example: In this chapter we have looked at how to configure an Ubuntu system to act as both a Samba client and server allowing the sharing of resources with Windows systems. Select “Choose a custom Network location” option. The first task is to define the name of the Windows workgroup on which the Ubuntu resources are to be shared. Windows share can be mounted on your Ubuntu Linux system mount point using cifs option of mount command $ sudo mount -t cifs -o username=$windows_user,password=$windows_user_password //WIN_SHARE_IP/$shared_name /mnt/winshare. Add the address of the folder shared on the Ubuntu. To access any shared resources on a Windows system using the GNOME desktop, begin by launching the Files application and selecting the Other Locations option. In the bottom input box, type smb://IP-Address/ and hit enter. This is achieved using technology called Samba. From the Map Network Drive dialog, select a drive letter before entering the path to the shared folder. This flexibility can lead to the sense that Samba is overly complex to work with. After a short delay the content of the Samba share will appear in a new File Explorer window. This is achieved … Windows systems share resources such as file systems and printers using a protocol known as Server Message Block (SMB). In order for an Ubuntu system to serve such resources over a network to a Windows system and vice versa it must, therefore, support SMB. For the purposes of this chapter we will look at joining an Ubuntu system to a Windows workgroup and setting up a directory as a shared resource that can be accessed by a specific user. On the Windows 10 or 7, open MyComputer. Optionally, also enable the services so that they start each time the system boots: Before attempting to connect from a Windows system, use the smbclient utility to verify that the share is configured: Now that the Samba resources are configured and the services are running, it is time to access the shared resource from a Windows system. In order to achieve this, the section is given a name by which it will be referred to when shared.