How to Access Shared Folder in Ubuntu? [2 Methods]

The ability to access shared folders with Ubuntu enables you to interact with files and folders stored on a remote machine. Ubuntu offers you different methods to retrieve files, transfer data or collaborate with another operating system such as Windows. In this article, I will explore different approaches on how to access shared folder in Ubuntu and have a seamless sharing experience.

Key Takeaways

  • Learning how to use a graphical interface for accessing folders.
  • Knowing how to use commands to access shared folders.
  • Understanding the difference between cifs-utils and smbclient.

Requirements

Process Flow Chart

[Distro Used Throughout the Tutorial: Ubuntu 22.04.02 LTS]General Process to access shared folder in Ubuntu

2 Methods to Access Shared Folder in Ubuntu

With the help of a graphical interface or command line tools, accessing shared files has become incredibly convenient. I have shown here two different approaches to accomplish this task. So, regardless of your expertise in Ubuntu, you can now easily manage files with Ubuntu.

You can read our Comparative Analysis of Methods to distinguish among these three methods and choose the best one according to your need.

Method 01: Using Graphical Interface (Nautilus) to Access Shared Folder in Ubuntu

Nautilus is regarded as the official file manager for GNOME desktop environment or default desktop environment. It provides a graphical user interface (GUI) to navigate and manage files and folders in Ubuntu. In this method, my primary goal is to show you how to enable sharing of a folder created in Ubuntu and access it from both Ubuntu and Windows.

Steps to Follow >

➊ Power on Ubuntu.

➋ Choose a folder you want to share with other operating systems such as Windows. I have chosen the folder called Share in my Desktop for this purpose.

➌ Afterwards, right-click on Share folder and a popup menu will appear and click on Local Network Share.Open Local Network hare option of a folder➍ A dialogue box will appear on the screen as in the image below. Select Share this folder, Allow others to create and delete files in this folder, and then press Create Share.Folder Sharing settings in Ubuntu➎ Now Nautilus will require you to press Add the permissions automatically to finally prepare the folder for sharing.Add permissions to share folder➏ You will see that the folder Share is ready to access. The green share icon at the bottom-right corner of the folder indicates that you can share this folder’s contents.

➐ Now you can create files in this folder. I have saved an image, Photos.jpeg and created a folder, Files to share within the Share directory.Files in shared folder➑ Now go to the Ubuntu terminal and run the following command.

hostname -I

EXPLANATION
  • hostname -I: Obtains IP address of the current Linux system.

IP address of UbuntuIt is visible that 192.168.153.128 is the IP address of my Ubuntu system.

➒ Now go to This PC in Windows and type IP of your Linux system and name of folder, Share in the address box.

\\192.168.153.128\Share

EXPLANATION
  • 168.153.128: IP address of Linux system.
  • Share: Name of folder which needs to be accessed.

Access shared folder in Windows

From the above image, it is clear that I can view the contents of the “Share” folder from Windows and have full control over these files.

Read More: Install, Configure and Connect Samba on Ubuntu Using GUI

Method 02: Using Ubuntu Command-line Tools to Access Shared Folder

If you want to have remote access over a network or customize command scripts according to your sharing requirements, command-line tools will be a perfect choice. The cifs-utils and smbclient packages are prominent command-line tools for this purpose. In this method, I will demonstrate to you how to handle folders that were originally created on Windows but are being accessed from Ubuntu.

Step 1: Enable Sharing Options in Windows

Before a folder can be accessed from a remote environment, it is necessary to enable sharing options in Windows.

Steps to Follow >

➊ Open Control Panel and go to Network and Internet > Network and Sharing Center.

➋ Click on Change advanced sharing settings at the left side of the page.Open control panel to enable share options➌ Then, turn on network discovery, file and print sharing, and click Save changes.Turn on network discovery & file and printer sharing

Read More: How to Share Files between Linux and Windows Dual Boot [3 Methods]

Step 2: Enable Sharing Options for a Folder in Windows

Subsequently, you have to activate the sharing settings of a folder in Windows. For this purpose, I used Windows_Share folder created on Windows. You can either create a fresh folder similar to mine or use a preexisting one.

Steps to Follow >

➊ I have created a folder called Windows_Share on Windows and saved a file named Document in it.Create file in shared folder➋ Afterwards, right-click on Windows_Share and go to Properties.Open Properties of shared folder➌ Navigate to Sharing > Advanced Sharing.Open Advanced Sharing of shared folder➍ Select Share this folder and then click on Permissions.Set Permissions for shared folder➎ Here, I clicked on Add since I prefer only the account, User, to be able to share the Windows_Share folder. Otherwise, you can select Everyone to give anyone access to your folder.Add User for shared folder➏ Then put in the name of your desired user account. I enlisted my account, User, and clicked OK.Type User name for shared folder➐ You will be redirected to Permissions for Windows_Share. Enable Full Control, Change, and Read permissions for your desired account. You can enable these options for anyone by selecting Everyone. Click OK to save these changes.Allow Permissions for User of shared folder As you can see, User is my Windows user account which has all three permissions of the shared folder, Windows_Share.

➑ Now go to Security and check the recent changes for your specified account for sharing the folder. Press Close to close Windows_Share Properties.Verify Permissions of shared folder

Read More: How to Share Files between Linux and Windows

Step 3: Access Windows Shared folders in Ubuntu

Two prominent command line tools for accessing shared folders are cifs-utils package and smbclient package. The cifs-utils package has more comprehensive features for managing shared folders. On the other hand, the smbclient tool is a lightweight utility for basic sharing operations with folders.

Case 1: Using cifs-utils to Access Windows Shared Folder in Ubuntu

CIFS or Common Internet File System contains tools and utilities that help to mount and manage SMB/CIFS share files, printers, or serial ports over a network. The cifs-utils package helps to mount SMB shares to local directories. Therefore, this package will build a bridge between Windows and Ubuntu for the shared folder, Windows_Share.

Steps to Follow >

➊ Open your Ubuntu terminal.

➋ Execute the following command to install the cifs-utils package.

sudo apt install cifs-utils
EXPLANATION
  • sudo: Permits a user with administrative privileges to execute commands.
  • apt install: Installs a specific package.
  • cifs-utils: Package that supports mounting CIFS/SMB file system. CIFS is the core file-sharing protocol used by Samba.

Install cifs-utils in Ubuntu➌ Now you need to create a directory that will serve as a mount point or be linked to the shared folder, Windows_Share on a Windows machine.
mkdir /home/ayesha/Desktop/cifs_share
EXPLANATION
  • mkdir: Creates a new directory or folder.
  • /home/ayesha/Desktop/cifs_share: Absolute path of cifs_share folder in Desktop.

My newly created cifs_share directory in Desktop will now be able to mount the shared folder, Windows_Share.

➍ Lastly to mount a shared folder run the following command:

sudo mount -t cifs //192.168.0.105/Windows_Share /home/ayesha/Desktop/cifs_share -o username=User
EXPLANATION
  • sudo: Permits a user with administrative privileges to execute commands.
  • mount: Attaches or mounts a file system to a specific directory.
  • -t cifs: ‘t’ specifies that CIFS (Common Internet File System) needs to be mounted.
  • 192.168.0.105: IP address of Windows system.
  • Windows_Share: Name of the shared folder in Windows which needs to be accessed.
  • /home/ayesha/Desktop/cifs_share: Absolute path of cifs_share folder in Desktop of my Linux system.
  • -o: Specifies the options to be used when mounting a file system, in this case, specifies username option.
  • username =User: Provides the name of the account in Windows which has access to the shared folder.

Mount shared folder in UbuntuAs you can see in the preceding image, I was prompted to enter my password for my Windows user. Moreover, my Windows IP is 192.168.0.105 and the user account that has the control of shared folder is User.

➎ Now navigate to Files >Desktop > cifs_share.

➏ Open cifs_share folder and you can view the word file, Document from Ubuntu.Access shared folder in Ubuntu The image above shows that the word file, Document which was created in Windows can now be accessed from Ubuntu.

Case 2:  Using smbclient to Access Windows Shared Folder in Ubuntu

For interacting with SMB shares, smbclient is a command-line tool that provides a client interface to access and manage resources on SMB (Server Message Block) servers. The smbclient tool offers various tools to browse, download and manage files on SMB shares.

Steps to Follow >

➊ Open your Ubuntu terminal.

➋ To install smbclient package, execute the command below.

sudo apt install smbclient
EXPLANATION
  • sudo: Permits a user with administrative privileges to execute commands.
  • apt install: Installs a specific package.
  • smbclient:Name of the package which needs to be installed.

Install smbclient in Ubuntu➌ Now to gain access to the Windows folder, Windows_Share in Ubuntu terminal, execute the following command.
smbclient //192.168.0.105/Windows_Share -U User
EXPLANATION
  • smbclient: Command that interacts with SMB shares.
  • 192.168.0.105: IP address of my Windows system.
  • Windows_Share: Name of the shared folder.
  • -U: Specifies username.
  • User: Name of Windows user account which has access to shared folder.

Access shared folder in Ubuntu using smbclientIt is clear from the above image, that the Windows account, User is acting as the SMB server and I had to enter my password to authenticate this account.

➍ In order to get a better understanding of this accessing method, let’s list its contents with the following command.

ls
EXPLANATION
  • ls: Lists contents of a directory.

View contents of shared folderYou can see in the preceding image that the previously created word file, Document of Windows_Share folder is now displayed.

Read More: How to Access Samba Share from Windows [2 Methods]

Comparative Analysis of Methods

Going through the aforementioned methods, it is understandable you might feel confused about the right procedure. Take a look at the pros and cons below and decide which method works best for you.

Methods Pros Cons
Method 1
  • User-friendly interface
  • Consistent and visually appealing interface
  • Not feasible if working in a remote environment without GUI access
  • Slows down performance
Method 2

(Case 1)

  • Secure file transfer within  the network
  • Updates user when file contents are modified
  • No external transport protocol is required
  • Difficult to diagnose and find faults in CIFS
  • Complicated configuration process
  • Moderate communication speed
Method 2 (Case 2)
  • Versatile authentication options
  • Provides advanced configuration settings
  • Lightweight since only for command-line usage
  • Compatibility with various versions of SMB protocol
  • Reliance on a stable network connection can impact its operations
  • Lacks real-time file browsing and automatic updates
  • Performs basic operations on SMB shares

To summarize, method 1 is suitable if you prefer a graphical interface over commands. It may not be a feasible choice when working in an environment without GUI. On the other hand, method 2 is reliable for working efficiently in a remote environment.

Although case 1 is a more comprehensive tool, it’s difficult to operate due to its complicated configuration process. On the other hand, lightweight and compatible case 2 is a favorite choice when it comes to basic share operations. However, consider your required level of functionality for shared files, expertise in Linux commands, or network speed to choose the most suitable method for you.

Conclusion

An effective sharing process between Ubuntu or any other operating system like Windows should include easy access to shared folders in Ubuntu. This article demonstrated three simple ways to accomplish this task. However, the best method for accessing folders ultimately depends on your preference for a graphical interface such as Nautilus or a command-line interface like cifs-utils and smbclient command.

People Also Ask

What network protocols can I use to access a shared folder in Ubuntu?

SMB/CIFS is the most widely used file-sharing protocol for Windows, Linux and macOS systems. Besides this, some other network protocols are NFS, SSHFS and FTP or SFTP.

How do I mount a CIFS share from Windows Command Line?

Type the command net use Z: \\computer_name\share_name /PERSISTENT:YES in command line window of Windows. Z: represents the drive where you want to assign your share folder.

How does CIFS authentication work?

CIFS is based on a client-server model. The client sends an authentication request to server and the server asks for user credentials based on authentication protocol. Afterwards, the client sends the response back to the server which it verifies . Hence if the credentials matches, a secure connection is established between client and server.

How does SMB protect data when sharing files?

SMB Encryption is used to protect data which provides end-to-end encryption. Encryption protocols like Transport Layer Security (TLS) or Secure Sockets Layer (SSL) make it difficult to intercept or decipher data.

How to unmount a shared folder?

To unmount a folder, especially from the default folder for mounting, mnt, you can use the command sudo unmount /mnt/<folder-name>.

Related Articles 

Rate this post
Ayesha Tun Nashrah

Hello! I am Ayesha Tun Nashrah, currently working as a Linux Content Developer Executive for LinuxSimply, SOFTEKO. Completing my graduation in engineering, I aim to collaborate my technical knowledge and creative writing skills to create engaging content for Linux. My goal is to contribute to the Linux community by writing tutorials, articles, and guides for novice and Linux experts. Besides, writing about Linux articles, you will find me immersed in books and enjoying music. Read Full Bio

Leave a Comment