Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello.
How can I restore my Linux setting after a specific time? For example, You want configure SSH on a remote web server but if you did a wrong command and your connection to a remote server lost, After a specific time the SSH configuration restore to default.
How can I do it?
Not really following you on this in regards to "SSH configuration restore to default", however I do have a suggestion.
If you are going to run things on SSH and fear you may lose connection then use 'screen' or 'tmux'. If you lose connectivity then you can connect back into the screen or tmux session afterwards and carry on from where you were.
Last edited by r3sistance; 02-13-2017 at 05:54 AM.
No undo, no reset. This isn't a video game.
You messed up by not verifying from a secondary terminal that you could reconnect.
Experience. Priceless. and Funny.
If we are talking about resetting the system, then there is such an option. Snapshotting, of course it'll reset EVERYTHING!. Some filing systems support it, as does LVM. Also if it is a Virtual Server then the hypervisor may also support doing it. Heh. But again it resets everything . Oh and of course, too late to reset if you didn't set-up the snapshot prior to the event!
Hello.
How can I restore my Linux setting after a specific time? For example, You want configure SSH on a remote web server but if you did a wrong command and your connection to a remote server lost, After a specific time the SSH configuration restore to default.
How can I do it?
Thank you.
You can make a second server configuration file (sshd_config) and launch a second instance of sshd. Use the -p option to force it to use an alternate port. Then you can test it with the alternate port.
With that you can connect once to the server on port 2345 and the logs from that session will be in a separate file. When the session is over, sshd ends. The whole time, the original server never goes away.
Otherwise, you can make a backup copy of the file and then use an at job to restore from the backup copy and then restart sshd
There will usually be some kind of console access at the hosting provider which you can use to interface with the lost system.
Usually prevention is the best policy and if you are messing with iptables you can use iptables-apply or at to help out. The latter can be set to restore the last known good configuration after a timeout. It can also be used for messing with sshd configurations though when testing that, it is best to leave the existing SSH server alone and start up an alternate SSH server on a separate port using the -p option with the second instance of sshd.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.