姿态 -- a site by bzy

1001 – rsync with permissions

life |

rsync | jekyll | ubuntu | dropbox | windows |

I bought a Surface Pro 3, mainly for teaching purpose—I find it quite nice to have the possibility to really write something during my MBA lectures, and those notes I jot down can actually be saved and redistributed. Of course, it came with Windows 8 and of course I installed Virtualbox and ubuntu to make it also possible to do proper coding on this nice piece of machine.

Everything turned out amazing: The touch screen works like a charm also in ubuntu. I can also write with the Surface Pen in ubuntu. With some efforts, I managed to get a set of shortcut keys to switch between Windows and ubuntu seemlessly.

Since most of my research are synced with Dropbox, I need it also in my guest ubuntu system. The way I proceed is to install Dropbox client in Windows, so that Windows manages the syncing part, and then through Virtualbox’s folder sharing I can access everything from ubuntu.

This works wonderfully except that because all Dropbox files are now hosted in Windows, the shared folder in ubuntu has all files in permission 770.

Well, that should be okay as there was not much of security concern to me.

But then when I started to update my blog with jekyll, problem occurred. After I wrote a draft on ubuntu, I wanted to sync with my website host. As usual, I run the “rsync” command but then… oops, because of the 770 permission of all files, the files on the website are no longer accessible. There was a “permission denied” error.

I did a lot of research on how to make the Virtualbox shared folder in ubuntu also adopt “normal” file permissions. But apparently that is a very difficult thing to achieve. So I gave up.

The other route worked: In “rsync” one can actually specify the permissions of the files that are synced.

Tl;dr: Simply set “rsync –chmod=755” did the job. Voila!

16:22:51, Dec 05, 2014
bzy@GMT+5