LinuxQuestions.org
Review your favorite Linux distribution.
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 04-24-2024, 02:27 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,157

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
SSH Remote Access - Testing


Hi guys, how do you revert settings for SSHD on remote VMs? in order not to be locked out if something goes wrong.

- sshd -T >> will check if config is ok or not, before exiting the VM.

Is there a way to revert the original settings after a certain time? just as a back up, if really some unforeseen circumstances that will pop-up and not able to SSH

Thanks.
 
Old 04-24-2024, 02:46 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,327
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
One way is to fire up a parallel instance of the SSH daemon on a second port, but otherwise using all the same settings. You'd obviously need some other port open at least temporarily or use a bastion or jump host:

Code:
sudo /usr/sbin/sshd -p 2222

# or

sudo /usr/sbin/sshd -p 2222 -f /root/some.test.configuration.file
The command line arguments override the configuration file, so you can add more options that way, too.

Another way is to save the working configuration and set an at job to restore it + reload it in the daemon after a number of minutes. That way, if you can get back in you can cancel the at job but if you can't get back in, if you set up the job correctly, you can get back in. That can certainly be used with firewall / packet filter settings, too.

I'd go with the -p option myself.
 
1 members found this post helpful.
Old 04-24-2024, 02:47 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
you can set a crontab or something similar to overwrite the config and restart sshd if you wish.
 
1 members found this post helpful.
  


Reply

Tags
ssh access



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
RAT infected files (remote access tool - remote access trojan) - corrupt? jettjett Linux - Newbie 16 03-20-2018 10:07 PM
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Work on a remote project with Eclipse via SSH and SVN+SSH (2 remote Linux) alwaystudent Linux - Software 5 08-12-2015 11:40 AM
SSH access problems: Can only allow users SSH access by adding to root group dhupke Slackware 10 12-21-2008 09:48 AM
Testing remote administration via ssh on Internet satimis Linux - Networking 9 11-05-2003 09:52 AM

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

All times are GMT -5. The time now is 06:23 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