Saving and restoring root's home directory?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Tue Oct 18, 2022 6:13    Post subject: Saving and restoring root's home directory? Reply with quote
Is it possible to auto-magically save and restore files in /tmp/root?

If not, how about setting a directory in USB storage to become /tmp/root?


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14126
Location: Texas, USA

PostPosted: Tue Oct 18, 2022 14:36    Post subject: Reply with quote
If I am not mistaken, those are restored on boot as /tmp is RAM. Any changes that apply are taken from nvram, etc.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Tue Oct 18, 2022 15:17    Post subject: Reply with quote
kernel-panic69 wrote:
If I am not mistaken, those are restored on boot as /tmp is RAM. Any changes that apply are taken from nvram, etc.

I don't think there is a nvram method to do it, as you could not predict how much space would be needed. I guess I could just use USB script ... maybe using `mount -o bind` as suggested by some messages.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14126
Location: Texas, USA

PostPosted: Tue Oct 18, 2022 16:04    Post subject: Reply with quote
The entire contents of /tmp is written / read on boot. The only other things that apply here are in nvram which is checked, written to if needed, and read on boot. Don't know how to explain it any clearer. The only way to change specific contents is via script (echo, sed, etc.).
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Tue Oct 18, 2022 16:59    Post subject: Reply with quote
kernel-panic69 wrote:
The entire contents of /tmp is written / read on boot. The only other things that apply here are in nvram which is checked, written to if needed, and read on boot. Don't know how to explain it any clearer. The only way to change specific contents is via script (echo, sed, etc.).

Ignore my question for the mean time. USB and Shutdown Scripts should do.
(I remember JFFS2, but it does not offer /tmp/root)

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Tue Oct 18, 2022 17:14    Post subject: Reply with quote
Without explaining what you want to save in /tmp/root the thread is quite pointless.

I only have the files authorized_keys and ssh_host_rsa_key in there.
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Tue Oct 18, 2022 17:32    Post subject: Reply with quote
ho1Aetoo wrote:
I only have the files authorized_keys and ssh_host_rsa_key in there.

They are restored from nvram keys!
Code:
# nvram show | grep host | grep key

size: 33510 bytes (32026 left)
ping_ip=nvram show | grep host | grep key
sshd_rsa_host_key=-----BEGIN OPENSSH PRIVATE KEY-----

# nvram show | grep -i authorized

size: 33508 bytes (32028 left)
ping_ip=nvram show | grep -i authorized
sshd_authorized_keys=

Quote:
Without explaining what you want to save in /tmp/root the thread is quite pointless.

I will go with USB and Shutdown scripts. Thanks!

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum