Tony's Blog

ubuntu映射网络驱动器

1. 首先本地要安装samba文件系统安装命令行如下:

  1. sudo apt-get install cifs-utils

2.安装完毕后,修改nsswitch.conf配置文件。

  1. sudo gedit /etc/nsswitch.conf

更改

  1. hosts: files mdns4_minimal [NOTFOUND=return] dns

为(后面增加wins)

  1. hosts: files mdns4_minimal [NOTFOUND=return] wins dns

3.修改fstab配置文件。

a.先备份下配置文件

  1. sudo cp /etc/fstab /etc/fstab_old

b.创建一个校验文件

  1. gedit ~/.smbcredentials

内容如下:

  1. 1. username=Ji
  2. 2. password=741852963

c.创建文件夹用于显示驱动器名称

  1. sudo mkdir /media/ABM-Share

d.修改配置文件如下:

  1. sudo gedit /etc/fstab

配置如下:

  1. 1. # /etc/fstab: static file system information.
  2. 2. #
  3. 3. # Use 'blkid' to print the universally unique identifier for a
  4. 4. # device; this may be used with UUID= as a more robust way to name devices
  5. 5. # that works even if disks are added and removed. See fstab(5).
  6. 6. #
  7. 7. # /etc/fstab: static file system information.
  8. 8. #
  9. 9. # / was on /dev/sda2 during installation
  10. 10. UUID=e05ea45a-0dbf-4313-9e1a-4640e8af6c7c / ext4 errors=remount-ro 0 1
  11. 11. # /boot/efi was on /dev/sda1 during installation
  12. 12. UUID=2E11-A546 /boot/efi vfat umask=0077 0 1
  13. 13. # swap was on /dev/sda3 during installation
  14. 14. UUID=375c1c38-74dc-4400-b1b2-1a14d5d4d136 none swap sw 0 0
  15. 15. #这里是增加的自定义内容
  16. 16. //192.168.2.100/ABM-Share /media/ABM-Share cifs credential=/home/username/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 00

4.连接驱动器

  1. sudo mount -a

参考连接:

http://ubuntuhandbook.org/index.php/2014/08/map-network-drive-onto-ubuntu-14-04/