Archive | Programming RSS for this section

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.

Advertisements

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: