How to mount Windows share on Red Hat Enterprise Linux system using CIFS

本文介绍如何使用cifs选项通过mount命令在Red Hat Enterprise Linux系统上挂载Windows共享。文中详细解释了基本挂载命令的用法,包括指定用户名、密码及域的方法,并提供了设置默认权限、持久化挂载设置以及解决权限错误的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/448263

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Issue

  • How can Windows shares be mounted on Red Hat Enterprise Linux?

Resolution

  • Windows share can be mounted on RHEL system using cifs option of mount command as :
Raw
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
  • In case your user is in windows domain then you can define the domain as follows:
Raw
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password>,domain=example.com //WIN_PC_IP/<share name> /mnt
  • By default windows share mounted with the full permission (777) in Linux. To change the default permission use the dir_mode and file_mode options to set directory and file permission.
Raw
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0755,file_mode=0755 //WIN_PC_IP/<share name> /mnt
  • To make the mount persistant across reboots, make the below entry to the /etc/fstab
Raw
 //WIN_PC_IP/<share name>    /<mntpoint>   cifs  _netdev,username=<share user>,password=<share password>,dir_mode=0755,file_mode=0755,uid=500,gid=500 0 0
  • If you receive the following error when try to mount the share folder from windows machines
Raw
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Example:

1.checking the mounted file systems: mount | column -t | grep mnt
2. create a folder in 172.29.65.205, and share the folder.example : Test_dd 
3. login as root 
4. issue command : mount -t cifs //177.11.11.111/Test_dd -rw -o username=e_kkkl,password=Password  /mnt/MD5
5. un-mount it :  umount /mnt/MD5
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值