Lightsail Django Instance access w/o SSH service running

0

Hi, thanks for this forum to ask questions.

I foolishly ran sudo service ssh restart after editing my /etc/ssh/sshd_config file on my instance, and have been struggling to gain access for a day now. Logging in with the browser Lightsail SSH route doesn't work, yields the Upstream_Not_Found error; the instance is "running"; I've attempted a launch script [ sudo service start ssh ; grep -v "-foolish lines I added to sshd file-" > newfile, mv newfile to sshd ] with a snapshot instance of the damaged instance, create the instance, wait 15 minutes, but same error as above.

I'm at a loss -- what can I do to gain access and fix those files?

I've also go through the tutorial provied by AWS for using the Systems Manager (https://repost.aws/knowledge-center/lightsail-resolve-ssh-console-errors) to use Run Command, but can't find my instance listed whenever I try to use it --- help!!!!! thanks!

질문됨 8달 전177회 조회
2개 답변
0

Hello.

Did you copy any files before modifying /etc/ssh/sshd_config?
If you have done so, I think you should write a startup script to restore the configuration file from the copy and restart sshd.
If you do not have a copy left, try running a startup script that edits the configuration file using a command such as "sed" to restore the configuration file to its original state.

profile picture
전문가
답변함 8달 전
  • Thanks for the response! Unfortunately, I just tried this variation on my grep method, and still no go.

    Am I formatting the launch script correctly? I simply add my 1 line commands to the launch script dialog box when creating a new instance from a snapshot in the Lightsail browser portal. Does it need the bash shebang at the top? Should I use sudo for the command?

    I am willing to settle with simply accessing the files for copying purposes now, as I've created a new fresh instance and begun to migrate over: What options do I have to simply access the files if ssh is down on the system? < ---- any insight into this MUCH APPRECIATED! Thanks!

  • Hi again! Any follow up? Is there a way I can mount the snapshot/back-up I made of the instance so I can copy out the files I need? Thanks!

0

Have you considered making a snapshot of the instance, and then converting that into an EBS volume so that you can attach to another instance? This would let you view and edit the files, or clone them onto the new instance.

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lightsail/create-disk-from-snapshot.html

AWS
중재자
답변함 8달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠