Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

root login debian vps cloud instance

Tags:

vps

debian

Can't seem to be able to allow root login any more. I have an other vps that is a debian 10 too with same hosting (infomaniak) where I did get root login to work some time ago where I can login as root. I did a git diff server1/etc server2/etc and can't seem no see what I'm missing

so in /etc/cloud/cloud.cfg

users:
 - default

disable_root: false

and in /etc/ssh/sshd_config I've tried both of those (auth is done via ssh key)

# PermitRootLogin prohibit-password
PermitRootLogin yes

but I keep getting

$ ssh root@server2
Please login as the user "debian" rather than the user "root".

It's a fresh install of debian 10 did apt update etc...

on both server /etc/pam.d and /etc/pam.conf are identical

please help... this is driving me nuts!

what i get in auth.log (so pam does let me in but what kicks me out then?)

Sep 22 00:45:52 wlt2 sshd[3528]: Accepted publickey for root from 152.156.217.156 port 38902 ssh2: RSA SHA256:avR910sytysAwPa2MOdoudSlMDmOL2cy1JtQH/Sce3s
Sep 22 00:45:52 wlt2 sshd[3528]: pam_unix(sshd:session): session opened for user root by (uid=0)
Sep 22 00:45:52 wlt2 systemd-logind[467]: New session 16 of user root.
Sep 22 00:45:52 wlt2 systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)
Sep 22 00:46:03 wlt2 sshd[3528]: Received disconnect from 152.156.217.156 port 38902:11: disconnected by user
Sep 22 00:46:03 wlt2 sshd[3528]: Disconnected from user root 152.156.217.156 port 38902
Sep 22 00:46:03 wlt2 sshd[3528]: pam_unix(sshd:session): session closed for user root
Sep 22 00:46:03 wlt2 systemd-logind[467]: Session 16 logged out. Waiting for processes to exit.
Sep 22 00:46:03 wlt2 systemd-logind[467]: Removed session 16.
Sep 22 00:46:13 wlt2 systemd: pam_unix(systemd-user:session): session closed for user root
like image 448
Antony Gibbs Avatar asked Jul 26 '26 13:07

Antony Gibbs


1 Answers

Finally found the issue.

The problem came from the install made by the hosting service infomaniak that automatically puts the key in /root/.ssh/authorized_keys but with a command that displays the message and dies...

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"debian\" rather than the user \"root\".';echo;sleep 10" ssh-rsa AAAAB3Nz....

I didn't know we could do things like that in that file!

like image 173
Antony Gibbs Avatar answered Jul 30 '26 10:07

Antony Gibbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!