Difference between revisions of "Terastation Samba"
m (Samba moved to Terastation Samba)
|(One intermediate revision by the same user not shown)|
|Line 1:||Line 1:|
''(moved here from [[Hacking]])''
''(moved here from [[Hacking]])''
Latest revision as of 00:44, 11 November 2007
(moved here from Hacking)
There are prebuilt packages of Samba 3.0.25 available for the Terastation, which provide many advantages.
It is possible to modify the TeraStation's Samba install to properly map the System, Archive, Hidden, and Read-Only attributes for files (not directories). This modification will require you have Telnet access to your TeraStation as per the modifications previously mentioned.
The general approach is this. The /etc/samba/smb.conf file contains Samba's configuration settings. To map the attributes, we need to add the following to the global section or to the individual shares:
map hidden = yes map archive = yes map system = yes create mode = 771 directory mode = 770
We also need to remove the "force create mode" and "force directory mode" entries. Unfortunately, just modifying the file is not enough because every boot, a script calls /sbin/teractrl -k which overwrites the configuration file. I noticed that most of the scripts also called /usr/local/bin/mkrsconf.pl afterwards to setup the rsync config for backup purposes, so I piggy back on that script to rewrite the Samba configuration.
Make a backup of your existing mkrsconf.pl file, and then replace the original with the new file content I have below. If you're working in Windows, you can copy the file to one of the shares under /mnt/array1, just be sure to use a UNIX compatible text editor if you don't want your newlines to get messed up. Then you can copy from there to the /usr/local/bin folder via Telnet to overwrite the original file.
The other thing you'll need to do when you're done is update all of the attributes on your existing shares since previously everything was probably created with 777 permisions, which will result in all of your files now showing up as hidden, system files. You can change the permissions from Telnet using chmod, or you can do it from a Windows Command Prompt using the attrib command.
Also of note, TeraStation generated files are created by "root", so with group permissions adjusted now you may not be able to modify attributes of files like backup logs. It's probably not necessary though as you can still read/write the content, but if you need to, you can either take care of those from Telnet by doing a chown to change the owner, or you can modify the script to also add:
force group = root force user = root
I haven't tested the latter scenario, but I understand it will force all content on disk to be owned by root and have all share access performed as root. This isn't quite as bad as it sounds. Check out this link for more information: http://www.oreilly.com/catalog/samba/chapter/book/ch05_03.html
Why these extremely useful features weren't on by default I don't know. Here's a link to the modified file. Be sure to rename it to mkrsconf.pl on your side!
One word of caution, for most configurations I think I'm picking up all of the required entries from the system configuration files. But, it's entirely possible you may have a configuration parameter that isn't currently read by the script. If so, please note the discrepency, let me know so I can update it, and make sure you update your copy to pick up the extra parameter if you need to use it in the mean time.
Once you've replaced the file, just type "reboot" from the Telnet prompt and when your TeraStation comes back up, you should have the ability to change file attributes. This will allow you to use real backup programs that make use of the Archive attribute for incremental backups.
--Aaron 23:58, 10 Mar 2006 (CET)
I have noticed the chown and chmod on the TS were not compiled with large file support, so if you may get something like the following if you try and change the permissions on a large file:
# chown kimbotha:hdusers ./hdc-20060305.img.bz2 chown: ./hdc-20060305.img.bz2: Value too large for defined data type
# chmod g+w ./hdc-20060305.img.bz2 chmod: ./hdc-20060305.img.bz2: Value too large for defined data type
Luckily, perl is compiled with large file support so some equivalent commands would be:
# perl -e 'chown 1002, 100, "hdc-20060305.img.bz2";'
# perl -e 'chmod 0775, "hdc-20060305.img.bz2";'
-- Kimbotha 11:21, 26 October 2006 (CEST)