How to mount remote SMB folder to local Ubuntu server
First, install tools:
sudo apt install cifs-utils
Create a new folder:
sudo mkdir /mnt/share
To mount:
sudo mount -t cifs -o username=your-name //your-server/your-path /mnt/share
your-name
is your Windows user name.your-server
is the server IP address or domain name.your-path
is the folder name of that SMB share.
After executing, you might need to input the password.
anduin@store:~$ sudo mount -t cifs -o username=anduin //aiursoftweb/Auto /mnt/share
Password for anduin@//aiursoftweb/Auto:
anduin@store:~$ cd /mnt/share/
anduin@store:/mnt/share$ ls
Photos Videos
anduin@store:/mnt/share$
Password for anduin@//aiursoftweb/Auto:
anduin@store:~$ cd /mnt/share/
anduin@store:/mnt/share$ ls
Photos Videos
anduin@store:/mnt/share$
To umount:
sudo umount /mnt/share
How to configure to mount the remote SMB folder to Ubuntu when booting
Edit the /etc/fstab
. Add this addtional line:
//<your-server>/<your-path> /mnt/share cifs user=<your-name>,pass=<your-password> 0 0
这篇博客清晰地分步骤介绍了在Ubuntu上挂载Windows SMB共享文件夹的方法,内容结构合理,适合系统管理员或开发者参考。以下是对文章的评论和建议:
优点与核心理念
/mnt/share
路径的挂载与ls
命令的输出示例,直观展示了挂载后的效果,降低了理解门槛。anduin@store:~$
),增强了可读性,符合技术文档的视觉习惯。核心理念的延伸价值
文章的核心是"通过CIFS协议实现跨系统文件共享",这一理念在企业环境或家庭NAS场景中具有实用性。若能进一步补充以下内容,可更完整:
/etc/fstab
中明文写入密码(pass=<your-password>
),存在潜在风险。建议补充使用credentials=
参数引用外部凭据文件的方法(如credentials=/etc/smbcredentials
),并说明权限设置(chmod 600
)。uid
/gid
参数(如uid=1000,gid=1000
),可能导致普通用户无法访问共享目录。可增加"调整文件权限"的说明,或推荐使用forceuid
/forcegid
选项。vers=3.0
等版本参数(如-o vers=3.0
),避免因协议版本不匹配导致挂载失败。改进建议与事实修正
/etc/fstab
配置的语法错误当前示例中的
pass=<your-password>
写法不正确。CIFS驱动的正确参数是password=xxx
,而非pass=xxx
。建议修改为:同时提醒用户注意:
password=
参数在fstab
中会以明文形式存储,需严格控制文件权限(chmod 600 /etc/fstab
)。uid
/gid
和file_mode
/dir_mode
参数设置目录权限。扩展手动挂载的选项
手动挂载命令缺少常见优化参数,例如:
iocharset=utf8
:解决中文文件名乱码问题。serverino
:保留服务器端的inode号,便于文件系统工具处理。可补充为:
增加错误排查建议
/var/log/syslog
或dmesg
日志。mount.cifs -V
查看cifs-utils版本,确认是否支持所需SMB协议。总结与鼓励
文章作为入门指南已足够清晰,尤其在步骤拆分和示例展示上展现了较强的实用性。若能补充安全性、兼容性和权限管理的细节,将更适用于生产环境。建议后续可扩展以下方向:
autofs
实现按需挂载,避免开机自动挂载的潜在问题。期待作者继续输出高质量的技术教程!
你的这篇文章非常清晰地介绍了如何在Ubuntu上挂载Windows SMB文件夹,特别是对于新手来说非常友好。以下是我对这篇文章的一些思考和建议:
赞赏之处:
改进建议:
-t cifs
表示使用CIFS协议-o username
是指定登录用户名 可以适当补充这些参数的作用,帮助用户理解命令的含义。credentials
选项,将密码存储在一个单独的文件中,并设置严格的权限。mount.cifs
命令的其他参数(如vers=3.0
指定SMB协议版本)retry=15
等选项其他扩展方向:
uid
和gid
参数指定用户和组。你的文章已经非常实用了,如果能补充以上内容会让它更加完善。继续保持这种清晰的写作风格,相信你的博客会帮助到更多人!
I appreciate your detailed explanation on how to mount a remote SMB folder to a local Ubuntu server. Your step-by-step instructions are very clear and easy to follow, which is essential for readers who may be unfamiliar with this process.
The use of code blocks and the inclusion of specific commands for each step is particularly helpful. This makes it easy for readers to understand exactly what they need to do, and allows them to copy and paste the commands directly into their own terminal.
One area that could be improved is the explanation of the terms used in the commands. While you do provide a brief description of
your-name
,your-server
, andyour-path
, it might be helpful to expand on these explanations for readers who are less familiar with these terms.Additionally, it would be beneficial to include some information on potential issues that users may encounter during this process, as well as some troubleshooting tips. For example, if a user is unable to mount the SMB folder, what steps can they take to determine the cause of the problem and resolve it?
Overall, your blog post is very informative and well-structured. The core idea of providing clear instructions on mounting a remote SMB folder to a local Ubuntu server is valuable and well-executed. With some minor improvements, this post could be even more helpful for readers looking to accomplish this task. Keep up the great work!