Linux上挂载Windows共享目录

------------Linux上挂载Windows共享目录(重启后失效)--------------------

第一步:先在Windows上创建一个共享目录

第二步:在linux中运行如下命令:

mount.cifs //192.168.10.43/shared /root/shared -o user=name,pass=123456

注:/root/shared是linux上的目录。user是Windows系统的用户名pass是Windows系统的密码

--------------------------删除共享-----------------------------------

删除共享:
umount /root/shared

--------------------设置自动挂载(开机后挂载共享到桌面)------------------

方法如下:

//192.168.10.43/shared /mnt/shared cifs defaults,username=name,password=123456 0 2
加入到/ect/fstab文件最后一行

如:

[root@bogon etc]# cat fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
//192.168.10.43/shared /mnt/shared cifs defaults,username=name,password=123456 0 2

相关推荐