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

2018/09/0818:06:45 发表评论

需求来源:我想通过远程挂载文件的方式开发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!

  • 微信扫码赞助
  • weinxin
  • 支付宝赞助
  • weinxin

发表评论

您必须才能发表评论!