I have mounted a windows shared folder to a raspberry pi directory using

sudo mount.cifs ip_address_windows_machine/folderpath /home/pi/shared_folder -o user=MY_USERNAME,password=MY_PASSWORD

The owner group for the shared_folder changes to root:root after the above command. How can I avoid that, I need the owner group of the /home/pi/shared_folder to be pi:pi only.

I have tried sudo chown -R pi:pi /home/pi/shared_folder after mounting. But the owner group doesn't change from root to pi. Please suggest a method to change the owner group from root to pi after mounting the common folder(from windows).


You need to use the uid/gid options when mounting the share you can't do it after mounting, because you can't actually change the owenership (that doesn't make sense to a windows share)

sudo mount.cifs <remotetarget> <dir> -o uid=pi,gid=pi,user=<username>,pass=<password>
  • Thanks a lot, it works. I wish I could up vote your answer, but I've got <15 reputation points. – Vasanth Dhinakaran Sep 6 '18 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.