If you are looking to share a user's home directory on an Ubuntu 22.04 system using Samba, this article is for you. Samba is a popular open-source implementation of the SMB/CIFS protocol for sharing files, printers, and other resources between computers.
In this article, we will walk you through the process of setting up Samba on Ubuntu 22.04 and sharing a user's home directory.
Prerequisites
Before we begin, make sure you have the following:
A working installation of Ubuntu 22.04
A user account on the system
Access to the terminal or console
Installing Samba
The first step is to install Samba on your system. To do this, open the terminal and run the following command:
sudo apt-get update
sudo apt-get install samba
Configuring Samba
Once Samba is installed, we need to configure it to share the user's home directory. To do this, we need to edit the Samba configuration file smb.conf
. Open the file using the following command:
sudo nano /etc/samba/smb.conf
Add the following to the bottom of the file, replacing "username" with the actual username:
[username]
path = /home/username
valid users = username
read only = no
browsable = yes
Restarting Samba
Save the changes to the smb.conf
file and close the text editor. Next, we need to restart Samba to apply the changes. Use the following command to restart Samba:
sudo systemctl restart smbd
Creating a Samba Password
Before we can access the shared directory, we need to create a Samba password for the user. Use the following command to do this, replacing "username" with the actual username:
sudo smbpasswd -a username
Accessing the Shared Directory
You can now access the shared directory from another computer on the same network using the following format:
\\<server-ip-address>\username
Enter the username and password when prompted to access the shared directory.
Conclusion
In this article, we have shown you how to share a user's home directory on an Ubuntu 22.04 system using Samba. We hope that this article has been helpful and that you now have a working Samba setup. If you have any questions or comments, please leave them below.