Score:-1

Can't log into Centos SSH server after changing port

nr flag

I was changing my ssh server's port to create a honeypot.

I changed the port through /etc/ssh/sshd_config

It originally said

#Port 22

And I changed to

Port 69

I now realise that I can't log back into it. I am hosting the server through AWS ec2.

Please can somebody tell me how I can re-login to the server as there is years worth of shit on it!

Score:2
de flag

The number itself doesn't mean you're using UDP. Most probably, sshd is running on TCP with port 69. In this case, try to allow incoming traffic to TCP 69 by modifying a security group attached to this instance.

1423 avatar
nr flag
can you help me with that?
Tim avatar
gp flag
Tim
You can search for something like "AWS how to open a port in a security group".
Brandon Xavier avatar
us flag
Log in on the console and tinker with it (or put it back to 22)
1423 avatar
nr flag
@BrandonXavier how would I do that exactly?
1423 avatar
nr flag
@Tim I have added a Custom TCP rule with the port that I want but I don't know how to connect to it.
Brandon Xavier avatar
us flag
here's one easy way: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-methods.html#ec2-instance-connect-connecting-console
Tim avatar
gp flag
Tim
Good idea, Systems Manager Session Manager uses a different mechanism. Log in like that and fix SSH. @1423 you have to make sure you've allowed access on a port that you've already configured SSH for. If that's not working you may have to restore from snapshot / backup, or create a new instance and mount the existing drive as a data drive to copy your data over.
1423 avatar
nr flag
@BrandonXavier It says "There was a problem connecting to your instance" and "We were unable to connect to your instance. Make sure that your instance’s network settings are configured correctly for EC2 Instance Connect. For more information, see Task 1: Configure network access to an instance."
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.