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. 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. For that type \\ip-address-ubuntu\shared … The smb.conf file is divided into sections. The first step in configuring Samba is to edit the /etc/samba/smb.conf file. 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. 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. Windows systems share resources such as file systems and printers using a protocol known as Server Message Block (SMB). 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. 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). In the bottom input box, type smb://IP-Address/ and hit enter. 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. 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. It is a common requirement, therefore, that files on an Ubuntu system be accessible to Linux, UNIX and Windows-based systems over network connections. Although Linux has made some inroads into the desktop market, its origins and future are very much server-based. Ubuntu resources, on the other hand, are shared with Windows systems by installing and configuring the Samba service. 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. It is not surprising therefore that Ubuntu has the ability to act as a file server. 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. Ubuntu accesses Windows resources using the Samba client. Network location wizard will open, click on the “NEXT” button. 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. Right-click anywhere on the blank space and select “Add a Network Location“. 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. 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. 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. If the $windows_user is … 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. This is a configuration known as a standalone Samba server. 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. The first section is the [global] section where settings can be specified that apply to the entire Samba configuration. In order to achieve this, the section is given a name by which it will be referred to when shared. This is achieved … Windows systems share resources such as file systems and printers using a protocol known as Server Message Block (SMB). At this point, explorer should search the network and list any systems using the SMB protocol that it finds. 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. 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. From the Map Network Drive dialog, select a drive letter before entering the path to the shared 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. 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. Add the address of the folder shared on the Ubuntu. 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. On the Windows 10 or 7, open MyComputer. When you click on Local Network Share, you will see the option of sharing the folder. This task is achieved using the smbpasswd command-line tool. 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. It is also extremely common for Ubuntu and Windows systems to be used side by side in networked environments. Unless you specifically requested that Samba be installed it is unlikely that you have Samba installed on your system. sudo service smbd restart. To get access the shared folder: In Ubuntu, go to Files -> Other Locations. Restart Samba and open Windows File Explorer to view the shared location on Ubuntu. Topics covered included the installation of Samba client and server packages and configuration of Samba as a standalone server. If these resources do not need to be shared, the corresponding sections can be commented out so that they are ignored by Samba. 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. 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). 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. 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. Similarly, shared folders and printers residing on Windows systems may also need to be accessible from Ubuntu based systems. Step 6: Configure Samba Private Share 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. 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.