Question

All other users, except root, are able to login thru FTP and Bash terminal.

Posted December 11, 2019 699 views
Ubuntu 18.04

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.

edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

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

by Justin Ellingwood
When you first create a new Ubuntu 18.04 server, there are a few configuration steps that you should take early on as part of the basic setup. This will increase the security and usability of your server and will give you a solid foundation for subsequent...

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.

Submit an Answer