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:
- Install Samba: Open a terminal and run the following commands to update your package list and install Samba:
sudo apt update sudo apt install samba - Create a Shared Folder: Choose a directory you want to share (e.g.,
~/shared_folder) and create it using:mkdir ~/shared_folder - Adjust Folder Permissions: Grant read/write access to all users (or restrict as needed) with:
chmod 777 ~/shared_folder - Configure Samba: Edit the Samba configuration file (
/etc/samba/smb.conf) using a text editor (e.g.,nano):
Add the following block at the end of the file (replacesudo nano /etc/samba/smb.confyour_usernamewith 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 = yesbrowseable: Allows the folder to appear in network listings.writable: Enables file modifications.guest ok: Permits anonymous access (remove if password protection is needed).
- Restart Samba: Apply changes by restarting the Samba services:
sudo systemctl restart smbd sudo systemctl restart nmbd - Access the Share: On a Windows PC, open File Explorer and enter
\\Ubuntu_IP_Address\shared_folderin the address bar (replaceUbuntu_IP_Addresswith your Ubuntu machine’s IP). For Linux clients, usesmbclientor mount the share viamount.cifs.
Using Nautilus (GUI) for Quick Sharing
If you prefer a graphical interface, Ubuntu’s default file manager (Nautilus) supports one-click sharing:
- Install Nautilus Share Plugin: If the “Local Network Share” option is missing, install the plugin:
sudo apt install nautilus-share - Restart Nautilus: Run
nautilus -qto apply changes. - Share a Folder: Right-click the target folder, select Properties, go to the Local Network Share tab, and check “Share this folder.” Enable “Allow others to create and delete files” for write access, then click “Create Share.”
Troubleshooting Common Issues
- Service Not Starting: Ensure the Samba service is enabled and running:
sudo systemctl enable smbd sudo systemctl status smbd - Permission Denied: Verify folder permissions (
chmod 777) and Samba user credentials (smbpasswd -a your_username). - Firewall Blocking: Allow Samba traffic through the firewall:
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).
以上就是关于“Ubuntu Notepad文件共享方法”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm