Difference between revisions of "How to disable the automatic update of smb.conf, proftpd.conf, Applevolumes.default"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(LS-GL information added.)
(Linkstation Pro (LS-GL))
 
(4 intermediate revisions by 4 users not shown)
Line 39: Line 39:
 
   smb.sh:20:    /usr/local/sbin/nas_configgen -c samba
 
   smb.sh:20:    /usr/local/sbin/nas_configgen -c samba
  
* In nas_configgen, some options are HARDCODED such as ftp port number or ftp remote charset. If anyone who wants to change these options AND to use buffalo web admin tool, he needs to hexa-edit nas_configgen. Or, a good neighbor might add a customized nas_configgen in the next version of OpenLink for LS-GL.. I wish :)
+
* In nas_configgen, some options are HARDCODED such as ftp port number or ftp remote charset. If anyone who wants to change these options AND to use buffalo web admin tool, he needs to hexa-edit nas_configgen. Or, a good neighbor might add a customized nas_configgen in the next version of OpenLink for LS-GL.. I wish :)
 +
 
 +
* Instead of customized nas_configgen you can replace it with a small shell script:
 +
:Make a backup of nas_configgen '''cp /usr/local/sbin/nas_configgen ~/nas_configgen.backup'''
 +
:Rename nas_configgen '''mv /usr/local/sbin/nas_configgen /usr/local/sbin/nas_configgen.bin'''
 +
:Create a new file '''vi /usr/local/sbin/nas_configgen''' with following:
 +
  /usr/local/sbin/nas_configgen.bin $1 $2
 +
 
 +
  # Replace ftp charset CP932 with ISO8859-15
 +
  cp /etc/proftpd/proftpd.conf /tmp/proftpd.conf
 +
  cat /tmp/proftpd.conf | sed 's/CP932/ISO8859-15/' > /etc/proftpd/proftpd.conf
 +
 
 +
I'm afraid but this doesn't work anymore. I had to unbrick my LS
 +
 
 +
Hmmm, this works for me.  The only problem is that on reboot, the OS restores nas_configgen to the original.  I'll get that sorted out soon enough.
 +
 
 +
====Modifying nas_configgen behavior to Hide Shares====
 +
 
 +
When /etc/init.d/recover_shareinfo.sh runs at boot time, it finds new directories to share (any dir at the root level of a mounted data disk partition).  It puts shares that it's created in a file /etc/melco/shareinfo, for nas_configgen to use.  By tweaking values in there you can change the way nas_configgen creates smb.conf.
 +
 
 +
I wanted two shares to be invisible (not present in smb.conf) so I adjusted the file from this:
 +
 
 +
tmp<>disk1<>recovered<>all<>all<>all<>all<>1<>1<>0<>1<><>1<>0<>0<>0;
 +
.optware<>disk1<>recovered<>all<>all<>all<>all<>1<>1<>0<>1<><>0<>0<>0<>0;
 +
 
 +
to this:
 +
 
 +
tmp<>disk1<>Temp Folder<>all<>all<>all<>all<>'''0'''<>1<>0<>1<><>1<>0<>0<>0;
 +
.optware<>disk1<>Optware<>all<>all<>all<>all<>'''0'''<>1<>0<>1<><>1<>0<>0<>0;
 +
 
 +
Note the 1 changed to 0.  Then re-ran nas_configgen and restarted samba.
 +
 
 +
I don't know what all the fields do, but some of them relate to read-only status, and user/group access (those 'all' entries) which are changeable in the web GUI.
 +
 
 +
Similarly, the file /etc/melco/shareinfo.hidden will append a dollar sign to a sharename (eg [home$]) to hide it, if the first "on" is removed.  Compare these two share lines:
 +
 
 +
share<>on<>on<><><><><>;
 +
home<><>on<><><><><>;
  
 
===Terastation===
 
===Terastation===

Latest revision as of 12:41, 12 October 2009

Can anyone please confirm that chkshare or mkshare.sh are existing on the terastation & terastation pro? (i suppose chkshare will be there...i want to add the categories) if this files are there then this is valid for all terastations..even if only telnet access is available.

Contents

Linkstation (LS1/LS2)

/etc/init.d/chkshare is responsible for updating the files on ppc-based boxes
/etc/init.d/mkshare.sh is responsible for updating the files on the LS2 (MIPS)
 #!/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 # generate configuration files 
 if [ -x /bin/mkcode ]; then 
       echo "Netatalk configration file generating..." 
 # The next line is all we need to comment out for disabling the update of AppleVolumes.default
       /bin/mkcode -a > /dev/null 
       /bin/nkf -sEO /etc/atalk/AppleVolumes.default /tmp/AppleVolumes 
       mv -f /tmp/AppleVolumes /etc/atalk/AppleVolumes.default 

       echo "Samba configration file generating..." 
 # The next line is all we need to comment out for disabling the update of smb.conf.conf 
       /bin/mkcode -s > /dev/null 
       /bin/nkf -sEO /etc/samba/smb.conf /tmp/smb.conf 
       mv -f /tmp/smb.conf /etc/samba/smb.conf 

       echo "FTP configration file generating..." 
 # The next line is all we need to comment out for disabling the update of proftpd.conf 
       /bin/mkcode -f > /dev/null 
       /bin/nkf -sEO /etc/wu-ftpd/ftpaccess /tmp/ftpaccess 
       mv -f /tmp/ftpaccess /etc/wu-ftpd/ftpaccess 
       /bin/nkf -sEO /etc/proftpd.conf /tmp/proftpd.conf 
       mv -f /tmp/proftpd.conf /etc/proftpd.conf 
 fi

Linkstation Pro (LS-GL)

This information is based on firmware 1.03 with OpenLink jtymod5 version.

On LS-GL, the update sequence is in three files, /etc/init.d/atalk.sh, /etc/init.d/ftpd.sh, /etc/init.d/smb.sh, which are responsible for appletalk, proftpd, and samba.

 atalk.sh:20:    /usr/local/sbin/nas_configgen -c atalk
 ftpd.sh:17:    /usr/local/sbin/nas_configgen -c proftpd
 smb.sh:20:    /usr/local/sbin/nas_configgen -c samba
  • In nas_configgen, some options are HARDCODED such as ftp port number or ftp remote charset. If anyone who wants to change these options AND to use buffalo web admin tool, he needs to hexa-edit nas_configgen. Or, a good neighbor might add a customized nas_configgen in the next version of OpenLink for LS-GL.. I wish :)
  • Instead of customized nas_configgen you can replace it with a small shell script:
Make a backup of nas_configgen cp /usr/local/sbin/nas_configgen ~/nas_configgen.backup
Rename nas_configgen mv /usr/local/sbin/nas_configgen /usr/local/sbin/nas_configgen.bin
Create a new file vi /usr/local/sbin/nas_configgen with following:
 /usr/local/sbin/nas_configgen.bin $1 $2
 
 # Replace ftp charset CP932 with ISO8859-15
 cp /etc/proftpd/proftpd.conf /tmp/proftpd.conf
 cat /tmp/proftpd.conf | sed 's/CP932/ISO8859-15/' > /etc/proftpd/proftpd.conf

I'm afraid but this doesn't work anymore. I had to unbrick my LS

Hmmm, this works for me. The only problem is that on reboot, the OS restores nas_configgen to the original. I'll get that sorted out soon enough.

Modifying nas_configgen behavior to Hide Shares

When /etc/init.d/recover_shareinfo.sh runs at boot time, it finds new directories to share (any dir at the root level of a mounted data disk partition). It puts shares that it's created in a file /etc/melco/shareinfo, for nas_configgen to use. By tweaking values in there you can change the way nas_configgen creates smb.conf.

I wanted two shares to be invisible (not present in smb.conf) so I adjusted the file from this:

tmp<>disk1<>recovered<>all<>all<>all<>all<>1<>1<>0<>1<><>1<>0<>0<>0;
.optware<>disk1<>recovered<>all<>all<>all<>all<>1<>1<>0<>1<><>0<>0<>0<>0;

to this:

tmp<>disk1<>Temp Folder<>all<>all<>all<>all<>0<>1<>0<>1<><>1<>0<>0<>0;
.optware<>disk1<>Optware<>all<>all<>all<>all<>0<>1<>0<>1<><>1<>0<>0<>0;

Note the 1 changed to 0. Then re-ran nas_configgen and restarted samba.

I don't know what all the fields do, but some of them relate to read-only status, and user/group access (those 'all' entries) which are changeable in the web GUI.

Similarly, the file /etc/melco/shareinfo.hidden will append a dollar sign to a sharename (eg [home$]) to hide it, if the first "on" is removed. Compare these two share lines:

share<>on<>on<><><><><>;
home<><>on<><><><><>;

Terastation

The terastation has the /etc/init.d/mkshare.sh file, its contents are...

 #!/bin/sh
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
 if [ ! -x /sbin/teractrl ]; then
         exit 1
 fi
 
 # check folder
 /sbin/teractrl -s > /dev/null 2>&1
 
 # generate configuration files
 /sbin/teractrl -k > /dev/null 2>&1
 /usr/local/bin/mkrsconf.pl > /dev/null
 
 exit 0