LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-13-2017, 02:11 AM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 11
Post Restore to default settings in a specific time.


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.
 
Old 02-13-2017, 05:53 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 02-13-2017, 07:17 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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.

Last edited by Habitual; 02-13-2017 at 07:21 AM.
 
Old 02-13-2017, 01:46 PM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Habitual View Post
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!
 
Old 02-13-2017, 01:56 PM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
Quote:
Originally Posted by hack3rcon View Post
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.

Code:
/usr/sbin/sshd -dd -p 2345 -E /var/log/ssh.test.log -f /etc/ssh/sshd_config.test
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
 
Old 02-18-2017, 05:42 AM   #6
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
If my server is in another country and did a wrong command and blocking myself then how can I solve it?
 
Old 02-18-2017, 11:23 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to restore to default desktop settings graybeard19 Linux - Newbie 1 11-02-2013 04:45 AM
Need Help, Is There A Way To Restore Default Network Settings ShadowEW Linux - Networking 6 08-14-2008 06:19 PM
Restore default install settings? zero79 Debian 1 06-14-2005 10:33 PM
restore default settings on fc3 tamashii Fedora 1 11-21-2004 09:16 AM
restore default kde settings? slinky2004 Linux - Newbie 1 10-18-2004 01:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration