• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue I messed up, can't access ssh/sftp

filipetakanap

New Pleskian
Server operating system version
CentOS Linux 8.5.2111
Plesk version and microupdate number
18.0.41
Hey,

I did a dumb thing which was to add on /etc/ssh/sshd_config a line "AllowUsers developer"
And now i can't access the server with root by ssh or sftp.

I was trying unsecure FTP (which uses not ssh), but for some reason it keeps trying to connect but fails in the end.
In security i've enabled "allow only non-secure FTP".


Would appreciate some help
 
There are a number of workarounds. I assume you are "admin" of your server? Here are some ideas how to gain access again, probably there are even more ways:

For one you can login through SSH using the "developer" user name if it exists. Once logged in you can escalate your privileges with su to gain root access.

If a "developer" user does not yet exist, you could login to Plesk, create a subscription and grant the subscription full SSH privileges. Then you need to rename the system user of that subscription to "developer". From there you can either login with "developer" as described above or you can use the SSH extension to login through the GUI.

If that fails, maybe you can let a PHP script do the work. The only prerequisite is that open_basedir in your subscription account is disabled. As you are "admin" you can disable that for your special subscription that you use to gain access again. Then let your script edit the sshd_config file for you.

If that fails, e.g. for reasons of missing permissions, maybe your data center offers a "rescue mode" into which you can boot your system. From there you can mount your disk, edit the sshd_config file, then reboot into your normal system.

If that fails, maybe your data center offers a KVM console. That is a device that connects externally to your server and gives you remote hands access as if you were sitting right in front of the machine. It does not need direct network access to the machine, because the external console lets you login as if you were sitting right there in front of it. Could work maybe.

If that fails, I suggest installing the Plesk SSH Support extension and open a ticket with Plesk. Because Plesk staff may be able to bypass the user name limit. Not perfectly sure, but it could work.
 
Back
Top