Software & AppsOperating SystemLinux

How To Access Samba Protected Directory on Ubuntu 18.04 from Windows 10: Login Information Guide

Ubuntu 10

In this guide, we will walk you through the process of accessing a Samba protected directory on Ubuntu 18.04 from a Windows 10 machine. This process involves creating a user on the Ubuntu machine, setting a Samba password for the user, and configuring the Samba share correctly.

Quick Answer

To access a Samba protected directory on Ubuntu 18.04 from Windows 10, you need to create a user on Ubuntu, set a Samba password for the user, and configure the Samba share correctly. Once done, you can access the share from Windows 10 by entering the network path in the File Explorer and providing the Ubuntu username and password when prompted.

Creating a User on Ubuntu

Firstly, you will need to create a user on your Ubuntu machine. This can be done using the adduser command in the terminal. The syntax of the command is as follows:

sudo adduser username

Replace ‘username’ with your desired username. For instance, if you want to create a user named ‘zombie’, you would enter:

sudo adduser zombie

You will be prompted to enter a password and other optional user information.

Setting a Samba Password

Next, you need to set a Samba password for the newly created user. This is done using the smbpasswd command. The syntax is:

sudo smbpasswd -a username

Replace ‘username’ with the username you created in the previous step. For example:

sudo smbpasswd -a zombie

You will be prompted to enter and confirm the Samba password for the user.

Configuring the Samba Share

Once the user and password are set, you need to ensure the Samba share is correctly configured on your Ubuntu machine. This involves editing the Samba configuration file located at /etc/samba/smb.conf. You can use any text editor to do this, but in this example, we will use nano:

sudo nano /etc/samba/smb.conf

In this file, you need to define the share. Here is an example of how to define a share:

[Protected]
path = /path/to/your/directory
valid users = zombie
read only = no

In this example, ‘Protected’ is the name of the share, the ‘path’ is the location of the directory you want to share, ‘valid users’ defines who can access the share, and ‘read only’ is set to ‘no’ to allow both reading and writing to the share.

After editing the file, save and close it. Then, restart the Samba service for the changes to take effect:

sudo service smbd restart

Accessing the Share from Windows 10

With the Samba share configured, you can now access it from your Windows 10 machine. To do this, open File Explorer and enter the network path to the Samba share in the address bar. The network path is usually in the format \\server\share. For example:

\\ubuntu\Protected

or

\\192.168.0.100\Protected

When prompted for credentials, enter the username and password you created on the Ubuntu machine.

Troubleshooting

If you encounter an error message stating “Multiple connections to a server or shared resource by the same user, using more than one username, are not allowed,” you can try the following workarounds:

  1. Map the Windows user to the local Linux user by creating a file at /etc/samba/smbusers and adding the mapping. Then, reference the map in /etc/samba/smb.conf and restart the smbd service.
  2. Make another connection to the Linux server using a different hostname, IP address, or mDNS name. Windows sees these as separate hosts even though they point to the same machine.
  3. When mapping a drive, select the “connect using different credentials” option and enter the Ubuntu username and password.

That’s it! You should now be able to access your Samba protected directory on Ubuntu 18.04 from Windows 10. Remember to ensure that the Samba share permissions and firewall settings are properly configured to allow access from the Windows machine.

How do I install Samba on Ubuntu 18.04?

To install Samba on Ubuntu 18.04, you can use the following command:

sudo apt-get install samba
How do I check if Samba is running on my Ubuntu machine?

You can check if Samba is running on your Ubuntu machine by using the following command:

sudo service smbd status

If Samba is running, it will display the status as "active (running)".

How can I change the Samba password for a user?

To change the Samba password for a user, you can use the following command:

sudo smbpasswd username

Replace ‘username’ with the actual username. You will be prompted to enter and confirm the new Samba password.

How do I access a Samba share from Ubuntu?

To access a Samba share from Ubuntu, open the file manager and click on "Other Locations" in the sidebar. Then, enter the network path to the Samba share in the address bar in the format smb://server/share. Replace ‘server’ with the hostname or IP address of the Samba server, and ‘share’ with the name of the share.

Can I access a Samba share from macOS?

Yes, you can access a Samba share from macOS. Open Finder, click on "Go" in the menu bar, and select "Connect to Server". Then, enter the network path to the Samba share in the format smb://server/share. Replace ‘server’ with the hostname or IP address of the Samba server, and ‘share’ with the name of the share.

How can I secure my Samba share with encryption?

To secure your Samba share with encryption, you can enable the "server signing" option in the Samba configuration file. Open the file /etc/samba/smb.conf and add the following line under the [global] section:

server signing = mandatory

Save the file and restart the Samba service for the changes to take effect:

sudo service smbd restart

This will enforce the use of digital signatures for all communication with the Samba server.

How can I restrict access to a Samba share to specific IP addresses?

To restrict access to a Samba share to specific IP addresses, you can add the following lines to the Samba configuration file, /etc/samba/smb.conf, under the share definition:

hosts allow = IP_ADDRESS1 IP_ADDRESS2
hosts deny = ALL

Replace ‘IP_ADDRESS1’ and ‘IP_ADDRESS2’ with the actual IP addresses you want to allow access from. This will only allow connections from the specified IP addresses and deny all others.

How do I uninstall Samba from Ubuntu 18.04?

To uninstall Samba from Ubuntu 18.04, you can use the following command:

sudo apt-get remove --purge samba

This will remove Samba and all its associated packages from your system.

Leave a Comment

Your email address will not be published. Required fields are marked *