Difference between revisions of "Removing the info share"
m |
(→With sed) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
===Automatic removal of the info share=== | ===Automatic removal of the info share=== | ||
===Disabling updating of smb.conf=== | ===Disabling updating of smb.conf=== | ||
− | + | See [http://nas-central.org/index.php/How_to_disable_the_automatic_update_of_smb.conf%2C_proftpd.conf%2C_Applevolumes.default How to disable the automatic update of smb.conf] Linkstation (LS1/LS2) section. | |
+ | |||
=LSPro/LSLive with stock or modified stock firmware= | =LSPro/LSLive with stock or modified stock firmware= | ||
==Description of the mechanism== | ==Description of the mechanism== | ||
− | nas_configgen!! | + | nas_configgen!! (/usr/local/sbin/nas_configgen) |
+ | |||
+ | This is called by /etc/init.d/smb.sh in the configure() section. | ||
+ | /usr/local/sbin/nas_configgen -c samba | ||
+ | |||
+ | This file with the correct arguments, will parse /etc/melco/shareinfo & /etc/melco/info to obtain the info required to create the smb.conf. | ||
+ | |||
+ | When you create/edit the shares/basic with the WebUi, shareinfo, info & the smb.conf are rewritten & the samba service is restarted by smb.sh | ||
+ | |||
+ | |||
+ | Within nas_configgen, Buffalo have included a default [Global] section which requires a minimal amount of information taken from /etc/melco/info. Such as 'dos charset', 'netbios name', 'server string', 'wins server' & 'workgroup'. | ||
+ | The default [info] share is also added at this point. | ||
+ | |||
+ | |||
+ | The shares sections added by the user in the WebUi, are then added at the bottom of the smb.conf. These are taken from /etc/melco/shareinfo, in the following format. | ||
+ | |||
+ | Raw | ||
+ | share<>disk1<>LinkStation folder<>all<>all<>all<>all<>1<>1<>0<>0<><>0<>0<>0<>0; | ||
+ | Translated | ||
+ | Share Name<>Disk<>Comment<>RW Users<>RW Groups<>RO Users<>RO Groups<>Windows<>Mac<>FTP<>Backup<>Backup Pass<>RO<>Trash<>Quota Status<>Quota Size; | ||
+ | |||
==Solutions== | ==Solutions== | ||
− | + | If you have telnet/ssh access to your box & happy with editing files read on, else read [http://nas-central.org/index.php/Custom_Partitions_on_the_LS_Pro#How_to_enable_telnet_w.2F_ACP_Commander_.28both_hddrootfs_in_EM_Mode.29 How to enable telnet w/ ACP Commander (both hddrootfs in EM Mode)] & [http://nas-central.org/index.php/Vi_text_editor_tutorial Vi text editor tutorial] | |
+ | |||
===With sed=== | ===With sed=== | ||
Line 21: | Line 43: | ||
Paste that after line 20 in the /etc/init.d/smb.sh - info share is removed on restart, and every restart thereafter. | Paste that after line 20 in the /etc/init.d/smb.sh - info share is removed on restart, and every restart thereafter. | ||
+ | |||
+ | '''Warning''': It's possible that the above sed line will not clean out the entire <tt>'''[info]'''</tt> stanza. In my case (LS-GL v2), the last line is not <tt>'''guest ok = yes'''</tt> but <tt>'''csc policy = disable'''</tt>. Also, if there's a problem with the sed command (eg sed gets corrupted) then smb.conf can end up empty. So perhaps this scriptlet will work more reliably: | ||
+ | |||
+ | sed '/^\[info\]$/,/^\[/{/^ /d;/^\[info\]$/d}' /etc/samba/smb.conf > /etc/samba/smb.conf.new && | ||
+ | mv /etc/samba/smb.conf.new /etc/samba/smb.conf | ||
+ | |||
+ | The conditional ensures that the new config file is not copied into place unless sed returns with no error. | ||
===With a perl script=== | ===With a perl script=== | ||
Line 32: | Line 61: | ||
'''Install:''' | '''Install:''' | ||
− | Extract tarball ([http://downloads. | + | Extract tarball ([http://downloads.nas-central.org/Users/kaiten/removeinfoshare.tgz]) to / |
+ | |||
+ | cd /tmp | ||
+ | wget http://downloads.nas-central.org/Users/kaiten/removeinfoshare.tgz | ||
+ | tar -C / -xzvf removeinfoshare.tgz | ||
+ | |||
Add the following line to "/etc/init.d/smb.sh" after "/usr/local/sbin/nas_configgen -c samba": | Add the following line to "/etc/init.d/smb.sh" after "/usr/local/sbin/nas_configgen -c samba": | ||
Line 48: | Line 82: | ||
/usr/local/bin/removeinfoshare.pl | /usr/local/bin/removeinfoshare.pl | ||
− | |||
− |
Latest revision as of 12:38, 12 October 2009
Contents
Why this article?
On the original and modified stockfirmwares we always have a some default shares. The normal "share" is not the problem, but "info" is as you cannot get rid of it. This article describes how to deal with that problem.
LS1/LS2/HG/HS with Openlink
Description of the mechanism
mkcode!!
Solutions
Disabling updating of smb.conf
See How to disable the automatic update of smb.conf Linkstation (LS1/LS2) section.
LSPro/LSLive with stock or modified stock firmware
Description of the mechanism
nas_configgen!! (/usr/local/sbin/nas_configgen)
This is called by /etc/init.d/smb.sh in the configure() section.
/usr/local/sbin/nas_configgen -c samba
This file with the correct arguments, will parse /etc/melco/shareinfo & /etc/melco/info to obtain the info required to create the smb.conf.
When you create/edit the shares/basic with the WebUi, shareinfo, info & the smb.conf are rewritten & the samba service is restarted by smb.sh
Within nas_configgen, Buffalo have included a default [Global] section which requires a minimal amount of information taken from /etc/melco/info. Such as 'dos charset', 'netbios name', 'server string', 'wins server' & 'workgroup'.
The default [info] share is also added at this point.
The shares sections added by the user in the WebUi, are then added at the bottom of the smb.conf. These are taken from /etc/melco/shareinfo, in the following format.
Raw
share<>disk1<>LinkStation folder<>all<>all<>all<>all<>1<>1<>0<>0<><>0<>0<>0<>0;
Translated
Share Name<>Disk<>Comment<>RW Users<>RW Groups<>RO Users<>RO Groups<>Windows<>Mac<>FTP<>Backup<>Backup Pass<>RO<>Trash<>Quota Status<>Quota Size;
Solutions
If you have telnet/ssh access to your box & happy with editing files read on, else read How to enable telnet w/ ACP Commander (both hddrootfs in EM Mode) & Vi text editor tutorial
With sed
cp -a /etc/samba/smb.conf /etc/samba/smb.orig sed '/^\[info\]/,/guest ok = yes/d ; /^###info###/d' /etc/samba/smb.orig > /etc/samba/smb.conf
Paste that after line 20 in the /etc/init.d/smb.sh - info share is removed on restart, and every restart thereafter.
Warning: It's possible that the above sed line will not clean out the entire [info] stanza. In my case (LS-GL v2), the last line is not guest ok = yes but csc policy = disable. Also, if there's a problem with the sed command (eg sed gets corrupted) then smb.conf can end up empty. So perhaps this scriptlet will work more reliably:
sed '/^\[info\]$/,/^\[/{/^ /d;/^\[info\]$/d}' /etc/samba/smb.conf > /etc/samba/smb.conf.new && mv /etc/samba/smb.conf.new /etc/samba/smb.conf
The conditional ensures that the new config file is not copied into place unless sed returns with no error.
With a perl script
Sources:
http://search.cpan.org/~sscotto/File-Samba-0.03/lib/File/Samba.pm
http://search.cpan.org/~gaas/Data-Dump-1.08/lib/Data/Dump.pm
Install:
Extract tarball ([1]) to /
cd /tmp wget http://downloads.nas-central.org/Users/kaiten/removeinfoshare.tgz tar -C / -xzvf removeinfoshare.tgz
Add the following line to "/etc/init.d/smb.sh" after "/usr/local/sbin/nas_configgen -c samba":
/usr/local/bin/removeinfoshare.pl
Configure SMB through the WebUI as normal.
Tarball Contents:
/usr/local/lib/perl5/5.8.8/Data/Dump.pm
/usr/local/lib/perl5/5.8.8/File/Samba.pm
/usr/local/bin/removeinfoshare.pl