商务合作加Q:411239339

Ubuntu 16.04中挂载其它Linux共享的samba

浏览:253次阅读
没有评论

共计 1107 个字符,预计需要花费 3 分钟才能阅读完成。

需求来源:我想通过远程挂载文件的方式开发 Django

1、服务端配置

服务器使用的系统是 CentOS 6 x64,在 /etc/samba/smb.conf 中加上以下一段:

[public]

    comment = Public Stuff

    path = /data/dj_project/mysites

    public = yes

    writable = yes

    valid users = root

    browseable = yes

    create mask = 0664

    directory mask = 0775

为了简单点,我们直接使用 root 用户加入 samba,并将设置 root 的密码:

smbpasswd -a root

然后输入两次密码,假设我们输入的密码为:123456

2、客户端配置

2.1 安装 cifs 支持

客户端使用的是 Ubuntu 16.04,需要安装一些必要的支持软件:

sudo apt-get install cifs-utils

2.2 挂载 samba 目录

接下来在 Ubuntu 中进行挂载:

sudo mount -t cifs //192.168.1.1/public/ /mountpoint -o user=root,passwd=123456

2.3 排错

结果发现挂载报错:

mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

此时,莫慌,我们可以通过查看 /var/log/syslog 来确定是什么原因:

Sep  8 18:00:28 chin kernel: [3091.859721] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.

Sep  8 18:00:28 chin kernel: [3091.866282] CIFS VFS: cifs_mount failed w/return code = -112

意思就是说我们的服务端版本太低?WTF!
那好吧!我们按错误提示将挂载命令修改成:

sudo mount -t cifs //192.168.1.1/public/ /mountpoint -o user=root,passwd=123456,vers=1.0

OK!Done!Ubuntu 16.04 中挂载其它 Linux 共享的 samba

正文完
扫码赞助
post-qrcode
 0
果子
版权声明:本站原创文章,由 果子 于2018-09-08发表,共计1107字。
转载说明:除特殊说明外本站文章皆由果较瘦原创发布,转载请注明出处。
评论(没有评论)