Using Samba for File Sharing (Recommended for Cross-OS Compatibility)
Samba is a widely-used service that enables Ubuntu to share files with Windows, macOS, and other Linux systems over a local network. Below are the step-by-step instructions to set it up:
sudo apt update
sudo apt install samba
~/shared_folder
) and create it using:mkdir ~/shared_folder
chmod 777 ~/shared_folder
/etc/samba/smb.conf
) using a text editor (e.g., nano
):sudo nano /etc/samba/smb.conf
Add the following block at the end of the file (replace your_username
with your Ubuntu username and adjust the path if needed):[shared_folder]
path = /home/your_username/shared_folder
browseable = yes
writable = yes
create mask = 0777
directory mask = 0777
guest ok = yes
browseable
: Allows the folder to appear in network listings.writable
: Enables file modifications.guest ok
: Permits anonymous access (remove if password protection is needed).sudo systemctl restart smbd
sudo systemctl restart nmbd
\\Ubuntu_IP_Address\shared_folder
in the address bar (replace Ubuntu_IP_Address
with your Ubuntu machine’s IP). For Linux clients, use smbclient
or mount the share via mount.cifs
.Using Nautilus (GUI) for Quick Sharing
If you prefer a graphical interface, Ubuntu’s default file manager (Nautilus) supports one-click sharing:
sudo apt install nautilus-share
nautilus -q
to apply changes.Troubleshooting Common Issues
sudo systemctl enable smbd
sudo systemctl status smbd
chmod 777
) and Samba user credentials (smbpasswd -a your_username
).sudo ufw allow samba
By following these steps, you can easily share files from Ubuntu using Samba (for cross-OS compatibility) or Nautilus (for quick GUI-based sharing). Adjust permissions and configurations based on your specific needs (e.g., restricting access to specific users).