All was ok. I could login as a normal user or root, thru SSH method or password, on FTP or Bash/Terminal (on Win10 pc).
Then today I was working on some wordpress permissions. Then I found that nginx wasn’t starting upon droplet/server reboot. I gave 1-2 nginx commands and rebooted.
But after that, I’m no longer able to login as root over FTP or Bash Terminal. Thru ssh keys method or password. Error comes: “Permission Denied. Pls try again”. Although, I’m able to login as root in console, with the same root’s password. And I’m able to login in FTP or Bash as another user. Also I’m able to login as root in another droplet with the same ssh keys which are already uploaded in my DO control panel and whose pvt keys are lying there in my same local pc.
That is/The scene becomes: pvt keys on my local pc and public keys on remote host are ok, because I’m able to login to another droplet on the same DO account.
Root pw is ok, because the same pw is working thru console. (moreover, when I login as another user in bash, then inside there I switch to root, then the same root password works and I become root there).
sshd_config files all options seem to be ok, because I can login as another user (and I’ve checked all 3-4 relevant options manually also).
Kindly help. I’m just striking my head to the wall, but nothing is coming to mind.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
Have you checked the PermitRootLogin value in your /etc/ssh/sshd_config config file?
You need to make sure that it is set to yes and restart sshd after that:
sudo systemctl restart sshd
But note that it is better to have your root access disabled and access your server with a non-root user and then su as root. For more information you could take a look at this guide here on some good practices for initial server setup:
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
Regards, Bobby
In the meantime I’ve diagnosed and have found the following, even bigger problem, to be the reason of above:
Whenever I reboot my droplet, the keys in the ‘authorized_keys’ file under /root/.ssh get deleted and a strange, UNKNOWN key, which I never inserted by any method, nor have I seen even in DO control panel, shows there already present. What is peculiar is that in the end of the key, where comment is written, “motherfucker” is written in these letters: “mdrfckr”
I’ve tried deleting all keys from this file and from my DO control panel and then inserting fresh keys thru DO control panel (thinking that perhaps DO control panel takes precedence and resets the contents of this authorized_keys file at every reboot). Due to this, every time my droplet reboots, I’ve to delete this key and insert 2 keys from myself, one ppk key for ftp, and another openssh key for bash terminal. After inserting them, I’m able to work/login normally.
Pls help fast. Lest there might be some intrusion into my droplet.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.