Handing unix permissions with a Synology file server

I’m going to assume that you already have setup ssh access to your synology diskstation and are familiar with basic linux shell commands.

Edit the samba config file at:

/usr/syno/etc/smb.conf

Add the following in the [global] section

 veto files=/@eaDir/.DS_Store/Thumbs.db/
delete veto files=yes
create mask=640
security mask=640
directory mask=750
directory security mask=750
force create mode=640
force security mode=640
force directory mode=750
force directory security mode=750

This ensures a fairly strict set of permissions.  Note that this only affects the permissions on the files themselves.  Samba still uses its own rules to determine who has read and write access for users accessing files over CIFS but this gets FTP permissions correct.

Now would also be a good time to shutdown all media indexing to make sure that your Synology box isn’t “helpfully” filling all your directories with @eaDir directories full of thumbnails.  To do this, you need to disable all the indexing services that are auto-launched for you as part of the rc init scripts.  An easy way to do that is to simply make those files unreadable.  Here’s a quick script to do that:

ETC='/usr/syno/etc.defaults/rc.d'
SERVICES='S66fileindexd.sh S66synoindexd.sh S77synomkthumbd.sh S88synomkflvd.sh'
for s in $SERVICES
do
${ETC}/$s stop
done
for s in $SERVICES
do
chmod -rwx ${ETC}/$s
done

You can save this as a script in /root and run it anytime you update your DSM.

Adding some Tux to Windows 7

When I switched to using Windows 7 for development purposes, I missed some of the comforts my trusty old Linux install had offered me.  I was using XFCE (and before that, ion3) and depended on workspaces and mouse focusing among other things.  Here is how I got them to work on Windows 7:

  1. Go get VirtuaWin which gives you a familiar workspace layout.  It can be a bit stuttery, but it is fairly stable and very configurable.
  2. Run regedit (Win-R -> regedit)
  3. Change HKEY_CURRENT_USER\Control Panel\Mouse\ActiveWindowTracking to 1.
  4. Edit HKEY_CURRENT_USER\Control Panel\Desktop\UserPreferencesMask which should be a REG_BINARY string: something like 9e 3e 07 …  Take the first byte of this string and change it to 9f.  To be more precise, take the first byte and bit-wise or it with 0x1 – i.e. set the lowest bit on that byte.  You should now have 9f 3e 07 …
  5. This enables mouse focusing but you definitely want a small delay between hovering over a window and it receiving focus.  This is essential for tasks like using contexts menus from the start bar because the pop-up elements are not exactly adjacent to the start menu – they have a minor gap separating them.  If you don’t have a focus delay, the moment you move your move away from a start bar icon to use the menu, the window underneath the menu would receive focus and the pop-up menu would get dismissed.
  6. To change the focus delay, edit HKEY_CURRENT_USER\Control Panel\Desktop\ActiveWndTrkTimeout which should be a REG_DWORD to the number of milliseconds to pause before giving focus.  0x80 (128 ms) works quite well.  Note the name ActiveWndTrkTimeout.  Make sure you have not made a spelling error.  You may already have an existing entry for ActiveWndTrackTimeout.  If you do, rename that entry to use the correct spelling.
  7. Close out your programs, log out and log back in.  Your changes will have taken effect.  Enjoy a more Tuxy Windows machine.

Happy hacking.

Thanks to:

Timeless Myths

Slow Time in Wrist Watch on Dry Leaf

Image by epSos.de via Flickr

Today, we’re going to talk about time.  Not time in the metaphysical sense, but the measurement of time.  In most of the modern world, we use a number of common units of duration such as seconds, minutes, hours, days, months and years.  Most of us have an intuitive feel for these units and are comfortable using them everyday to do things like setting alarm clocks, booking flights, paying for parking, remembering birth days etc.  We even think of the system as a reasonably logical one – 60 seconds in a minute, 60 minutes in an hour, 24 hours in a days 365 days a year etc.  Here, we shall take a look at how these intuitive models ignore some of the more bizarre aspects of time keeping.  If not understood correctly, these mistakes creep into unexpected places, affecting everything from software systems, medical and aeronautical system to financial and legal frameworks.

Read More…

New Theme

The old theme felt a little cramped and too sterile.  How do you guys feel about the new one?  Thumbs up/down?

A Fly in the Ointment

SR-71B Blackbird - wikipedia.org

SR-71B Blackbird - wikipedia.org

I was flying last month to attend a graduation and it occurred to me that I was, in fact, flying in a large metal tub with metal flappy bits bolted on.  How do airplanes fly? Well, they have wings.  Duh! But why do wings fly?  What makes a wing a wing?  Can any flat sheet of metal be used?  Why do planes only fly when moving?  This is quite an interesting question indeed.  The answer is quite subtle – subtler than you may think.  It is in fact confusing enough that a lot of high school text books and a good chunk of introductory university physics textbooks explain it incorrectly.  You may have been taught the answer in high school and you have just accepted it without thinking too hard about it.  Read on if you wish to check if you were indeed taught correctly.

Read More…

The Science of a Simple Scam

Last weekend, I put up a couple of ads on Craigslist for some of my old furniture and appliances – amongst them, a big rug.  For those of you who have never heard of such a thing, Craigslist is an online, unsecured, unverified market place.  You put up your ad for free and prospective buyers can contact you over email.  You then haggle, arrange a rendezvous and exchange your wares.  This is all well and good in theory, but in practice, things get a bit more….  interesting.  Consider this reply that I received with respect to the rug that I put up for sale.

still available for sale? please let me know..

This is how most Craigslist conversations start.  Very informal.  Not much detail revealed besides an email address (and perhaps, a name).

It is for sale!  You can reach me at XXX-XXX-XXXX.
Let me know when you want to come pick it up.

So far so good.

Hi,
Thanks for your response. I'm going on a vacation to London
but I will instruct my assistant to prepare and mail your
payment which I'm sure you will get in about 4 - 6 business
days. I'll add $20 extra for the delay. I'll pay by M O or
cashier check so send me your info (i.e full name, mailing
address and your phone number) so payment can be mailed out
immediately. I will also make arrangement for pick-up which
will be after you must have received and cashed the payment.Awaiting your info.Thanks
Frank

Now things are getting a little more interesting.  How many of you think that this is reasonably innocent?

Read More…

… how I learned to stop worrying and love the bomb.

Chapelcross Nuclear Power Station

Chapelcross Nuclear Power Station

This is the last post in our series of posts on nuclear energy.  Here, I shall describe the basic principles behind the design and continued operation of a nuclear reactor.  In our last post, we looked at the techniques responsible for making fissile matter release energy as quickly as possible (in a nuclear explosion).  Today, we will instead look at techniques to control nuclear fission reactions and usefully harness the resultant energy.  Since there are a variety of various nuclear reactor designs and fuels, I shall stick to talking about a reasonably common (although a bit aged) design known as the pressurized-water reactor using U-235 fuel.

Read More…

Welcome Skepchicks!

For those of you who are here from Skepchick (and the rest of you too), HI!  Here is a little plug for other places you can follow Emma.  Being a school teacher and applying to grad school, she has a number of compartmentalized blogging personas.  This is where she explains interesting phenomena in science to lay non-scientists.  She also rants about her life and her activism at http://sigstarskeptic.wordpress.com/ (which is quite new at the moment) and blogs about high-level chemistry (paper summaries for grad school and research) at http://blog.curiouschemist.net/.  You can follow her at https://twitter.com/#!/sigmastarstate.

Clean, Green Energy: The Search for a Free Lunch

You’ve heard it all before, we need to find a new, sustainable, clean source of energy, and fast. People are looking to wind, solar, nuclear, and biofuels. But what do these things mean, really?

Today, I will discuss solar.

The sun is the main source of energy for this entire planet. We get much of our energy from coal and oil which is made of millions-of-years-old plant and animal matter.  Animals get their energy from plants, which get their energy from the sun.  The wind blowing your hair in your face and turning the wind turbines?  That’s from the difference in temperature in different locations (due to the sun) and the rotation of the earth.  Hydroelectric power like that made at the Hoover Dam?  That’s from rainwater filling up a high altitude river source.  What causes rain?  The evaporation of water by heat from the sun, of course.  As you can see, there are few sources of energy (nuclear and geothermal being the primary exceptions) which are not directly related to energy recently emitted from the sun. The problem with all of these forms of energy is that there is a “middle man” between the sun’s energy and usable electricity.  Solar cells, which have been around since the mid-1950’s, attempt to dispose of the middle man allowing us to directly harness the power of the sun.

Read More…

Dr. Strangelove…

Atomic bombing of Nagasaki

Atomic bombing of Nagasaki - via wikipedia.org

Today’s post is about nuclear bombs.  Big boom.  Mushroom clouds.  Yep, those bombs.  In our last post, we discussed the basic mechanism behind the uranium fission chain reaction.  We also briefly talked about the difficulties involved in making it a continuous, feasible reaction.  In this post, I’ll talk about the basic principles behind the design of a nuclear fission bomb.  We’ll see two classic designs – the designs of the Hiroshima and the Nagasaki bombs, known as Little Boy and Fat Man.  I assume that you have read the previous posts, or are familiar with basic scientific terminology related to nuclear reactions.

Read More…