Thursday, November 3, 2011

mount windows share in linux - owner other than root

When you mount a windows directory in a linux machine , its default owner is root.You can't change it directly.For some purpose you need to mount a windows directory with some other owner other than root. Then follow the below mentioned steps.

1. Change mount point owner from root to user oracle (Assume)
    # chown oracle:oinstall linuxdir

2. Change permission to  access command mount by the user other than root.
# chmod 6555 mount    
    -rwsr-sw-x mount         

   For details refer
   http://labor-liber.org/en/gnu-linux/introduction/special_permissions

3. To run sudo as user 'oracle'  edit sudo conf file

   # visudo
     oracle ALL=(ALL)ALL
   Add above mentioned line

For details refer
http://www.gratisoft.us/sudo/intro.html
http://www.go2linux.org/sudoers-how-to

4. Now Run from user oracle
  
 sudo mount -t cifs //systemname/share /mnt/linux  -o username=windowsusername,password=pass,uid=oracle,gid=oinstall

5. Now you can see the change in owner name to your mounted windows shared directory.


Change archive location


Login as sys user . Use EM to change the location.