Start script when /etc/init.d is lost on reboot (Samba related)?

rseiler

Senior member
Apr 17, 2000
200
0
76
I have an Avermedia media server box for which I've managed to gain root access via telnet (BusyBox).

What I'm trying to do is change the name of the Samba share, which cannot be done in the box's UI on my TV. It defaults to "eSATA Disk1" as defined in /tmp/samba/lib/smb.conf.

While it's defined in that file, it's rewritten with every boot, so it's futile.

I've tried to find from where it's writing that information by searching for other instances of smb.conf, but other than a generic, dummy file, none exists.

So I decided to take an idea from here and here and simply copy an edited smb.conf stored on an attached drive to /tmp/samba/lib upon boot, overwriting the one generated on boot.

Except, you guessed it, additions to /etc/init.d also don't survive boot, making it effectively read-only.

Is there any other way to execute a copy automatically on boot? Or otherwise solve my original problem another way?

Thanks
 

Red Squirrel

No Lifer
May 24, 2003
70,000
13,484
126
www.anyf.ca
That's an odd place for the config file, is there by chance a samba config file in /etc/samba? And I know your frustration with config files that get overwritten... it seems so many distros do that now with system files like network config scripts. Definitely annoying.

You can also try /etc/rc.local as that also gets executed at startup. Hopefully that does not get overwritten too. You will want to put a "service samba restart" line after too. It sounds like they have this box locked down pretty tight though sadly.
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,163
514
126
Its not so odd a location when you consider that the device is embedded and /etc is most likely read-only. Changing config files to be located under /tmp and created upon boot (most likely in the init file embedded in the initrd). The only way to probably change that would be to create a custom firmware, but you really run the risk of bricking the device at that point.

Unless they left a place open for you to run a custom script on start, the only thing you can do is setup something to check and change it from another computer automatically.
 

rseiler

Senior member
Apr 17, 2000
200
0
76
The only Samba locations are:
/tmp/samba
/home/dma/samba

The second location is where the sbin dir is that has nmbd and smbd.

The other smb.conf (the dummy one that doesn't serve as the source of the real one) is here:
/home/dma/samba_conf/lib/smb.conf

This file doesn't exist:
/etc/rc.local

Yes, you could consider /etc to be read-only in that, while you can write to it, it's not sticking around long. I suppose it's a RAM disk.

So, yeah, it's sounding like I'm pretty well stuck short of finding a non-volatile script area or figuring out how the conf is being generated. I've looked around a lot with telnet but nothing jumps out.
 

Red Squirrel

No Lifer
May 24, 2003
70,000
13,484
126
www.anyf.ca
Is there SSH on this box by chance and does the root home directory get overwritten too or can you put stuff in it?

You could setup public key SSH logon (to make it automated) and have a script that runs off another machine that rsyncs the files over. Kinda dirty but it could maybe work.