I am relatively new to Linux/Debian, and I have encountered an issue which I can't find any relevant solutions for despite days of troubleshooting and a variety of Google, StackOverflow, and AskUbuntu queries.
Background: I created a Compute Engine VM Instance and successfully used Cloud Launcher to deploy Wordpress to it. I set up WordPress in Multisite mode and added a couple of sites. I also set up LetsEncrypt using Certbot and have successfully applied certificates to all my sites along with their mapped domains.
Problem: Going through steps to harden my server against various security concerns, I was applying and testing some permissions and directory ownership settings. I was working on a slow connection that started dropping, and after a few disconnections I gave up and hibernated my laptop. After getting home and attempting to SSH back into my VM Instance, my FTP client (Notepad++ FTP) returned the following output:
[NppFTP] Everything initialized Connecting [SFTP] Host key accepted [SFTP] Successfully authenticated [SFTP] Error initialising sftp: Short sftp packet! Unable to connect Disconnected
Attempting a browser-based connection from the SSH link in the VM Instances page produces similar results, first displaying:
Connecting... Transferring SSH keys to the VM.
for a few seconds, then quickly displaying:
Connecting... Establishing connection to SSH server...
before flashing to a black screen and closing the popup.
When I attempt to connect (or send any commands) using gcloud in Cloud Shell, such as:
josef@my-project-name:~$ gcloud compute ssh --zone "us-central1-f" josef@my-instance-1-vm
I can see the following error (IP addresses removed):
Last login: Thu Oct 26 20:09:28 2017 from ZZZ.ZZZ.ZZZ.ZZZ /bin/bash: Permission denied Connection to XXX.XXX.XXX.XXX closed.
I have tried countless variants of the above command, using no username, "root", and other valid usernames from my environment, but all produce the same result.
I am certain this is some sort of permissions issue arising from changes I was attempting to make in hardening my environment, but I have no idea how to go about restoring my permissions to allow me to SSH back into my VM Instance.
I believe the last changes I made were to modify the user/group under which Apache runs to be a non-root account, similar to the instruction in Step 2 of https://geekflare.com/10-best-practices-to-secure-and-harden-your-apache-web-server/
My Wordpress sites are still operating normally, and I can log into the admin dashboard of them. However, I can't upload plugins or media, and my root site (within WP Multisite) will not display the live preview in Customizer, nor allow any edits from within Customizer.
Any suggestions for ways to restore my permissions to
/bin/bash and allow an SSH connection (will probably have to be executed via gcloud from Cloud Shell as a
--command directive) would be most appreciated.