linux挂载windows共享权限问题


当用以下命令挂载windows共享以后挂在目录的属主变成了root其他用户没有写权限

mount -t cifs -o username=administrator,password='1234' //172.23.0.163/ftp /home/oracle/backup/baobiao/data

[root@sy-st_db_master baobiao]# ls -l
total 24552
drwxr-xr-x 2 oracle oinstall 4096 Jan 21 14:23 baobiao
-rwxr-xr-x 1 oracle oinstall 3131 Jul 24 11:34 baobiao.sh
 drwxr-xr-x 1 root root 0 Jan 21 11:58 data

用chown更改挂载目录的属主提示没有权限

[root@sy-st_db_master baobiao]# chown -R oracle:oinstall data

chown: changing ownership of `data': Permission denied

这不扯淡的么,在网上找了半天找到了解决方案。

只需要挂载的时候指定目录属主就好了

[root@sy-st_db_master baobiao]# id oracle
uid=10001(oracle) gid=592(oinstall) groups=593(dba),592(oinstall)
[root@sy-st_db_master baobiao]# mount -t cifs -o           username=administrator,password='1234',gid='592',uid='10001' //172.23.0.163/ftp    /home/oracle/backup/baobiao/data

查看一下属主已经变成了oracle,成功!

QQ截图20140121143934

还可以这样

mount -t cifs -o           username=administrator,password='1234',rw,file_mode=0777,dir_mode=0777,setgid='592',setuid='10001' //172.23.0.163/ftp    /home/oracle/backup/baobiao/data

加入开启启动项:

vim /etc/fstab

//172.23.0.163/ftp   /home/oracle/backup/baobiao/data cifs  username=xxx,password=xxx,rw 0 0

 


Whatever is worth doing is worth doing well.