Linux如何挂载Windows下的共享文件

 

说明:
windows下有一共享文件夹APP,windows本地ip是192.168.9.155
现在需要在linux服务器上挂载这个APP文件夹,linux服务器ip是192.168.9.200

操作记录如下:

1)windows上的准备工作

首先将windows上D盘下的APP文件夹设置为共享。右击APP文件夹的“共享”属性.

选择“特定用户”共享,添加共享用户。如下

 这样,APP文件夹就设置为共享文件夹了,上面的O3zyrm2d4gnp5j2是windows的机器名。查看APP下里面的文件

 

2)linux服务器上的操作

创建挂载目录/mnt/APP

[root@dev ~]# mkdir /mnt/APP

使用mount.cifs进行挂载操作:(下面的用户名和密码是登陆windows的)

[root@dev ~]# mount.cifs //192.168.9.155/APP /mnt/APP/ -o user=administrator,pass=dsff#$TTT

查看下,发现已经挂在上了
[root@dev ~]# ls /mnt/APP/
2.sql 3.sql 8633上线sql.zip

[root@dev mnt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 450G 97G 331G 23% /
tmpfs 3.9G 228K 3.9G 1% /dev/shm
/dev/sda1 194M 34M 150M 19% /boot
//192.168.9.155/APP 123G 12G 111G 10% /mnt/APP

[root@dev mnt]# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
//192.168.9.155/APP on /mnt/APP type cifs (rw)

卸载
[root@dev mnt]# umount /mnt/APP
[root@dev mnt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 450G 97G 331G 23% /
tmpfs 3.9G 228K 3.9G 1% /dev/shm
/dev/sda1 194M 34M 150M 19% /boot

posted @ 2016-10-18 18:38  散尽浮华  阅读(41493)  评论(0编辑  收藏  举报