Bonjour,
J'ai un soucis avec le changement du mot de passe "root", j'ai très bien suivi le tutoriel https://help.ovhcloud.com/csm/fr-vps-root-password?id=kb_article_view&sysparm_article=KB0047687 ,
The change of passwd is successfull, when I exit the rescue mod and reboot VPS, I can't connect with the new passwd of root, (incorrect)
> root@vps-XXXXXXXXXX.vps.ovh.net's password:
> Linux vps-XXXXXXXXXX 6.1.0-15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.66-1 (2023-12-09) x86_64
> GNU/Linux, to the rescue!
> Server: vps-XXXXXXXXXX
> Login: root
> Password: PxxxXXxxxxxxxXxxxxxx
> [RESCUE] root@vps-XXXXXXXXXX:~ $ df -h
> Filesystem Size Used Avail Use% Mounted on
> udev 16G 0 16G 0% /dev
> tmpfs 3.1G 532K 3.1G 1% /run
> /dev/sdb1 2.9G 2.3G 360M 87% /
> tmpfs 16G 0 16G 0% /dev/shm
> tmpfs 5.0M 0 5.0M 0% /run/lock
> [RESCUE] root@vps-XXXXXXXXXX:~ $ lsblk
> NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
> sda 8:0 0 160G 0 disk
> └─sda1 8:1 0 160G 0 part
> sdb 8:16 0 2.9G 0 disk
> └─sdb1 8:17 0 2.9G 0 part /
> [RESCUE] root@vps-XXXXXXXXXX:~ $ mkdir -p /mnt/sdb1/
> [RESCUE] root@vps-XXXXXXXXXX:~ $ mount /dev/sdb1 /mnt/sdb1
> [RESCUE] root@vps-XXXXXXXXXX:~ $ chroot /mnt/sdb1/
> [RESCUE] root@vps-XXXXXXXXXX:/ $ ls -l
> total 76
> lrwxrwxrwx 1 root root 7 Feb 1 07:01 bin -> usr/bin
> drwxr-xr-x 3 root root 4096 Feb 1 07:04 boot
> drwxr-xr-x 4 root root 4096 Feb 1 07:01 dev
> drwxr-xr-x 76 root root 4096 Feb 13 11:01 etc
> drwxr-xr-x 3 root root 4096 Feb 13 11:01 home
> lrwxrwxrwx 1 root root 30 Feb 1 07:03 initrd.img -> boot/initrd.img-6.1.0-15-amd64
> lrwxrwxrwx 1 root root 30 Feb 1 07:02 initrd.img.old -> boot/initrd.img-6.1.0-10-amd64
> lrwxrwxrwx 1 root root 7 Feb 1 07:01 lib -> usr/lib
> lrwxrwxrwx 1 root root 9 Feb 1 07:01 lib32 -> usr/lib32
> lrwxrwxrwx 1 root root 9 Feb 1 07:01 lib64 -> usr/lib64
> lrwxrwxrwx 1 root root 10 Feb 1 07:01 libx32 -> usr/libx32
> drwx------ 2 root root 16384 Feb 1 07:01 lost+found
> drwxr-xr-x 3 root root 4096 Feb 1 07:01 media
> drwxr-xr-x 3 root root 4096 Feb 13 11:09 mnt
> drwxr-xr-x 2 root root 4096 Feb 1 07:01 opt
> drwxr-xr-x 2 root root 4096 Jul 14 2023 proc
> drwx------ 3 root root 4096 Feb 1 07:02 root
> drwxr-xr-x 2 root root 4096 Feb 1 07:03 run
> lrwxrwxrwx 1 root root 8 Feb 1 07:01 sbin -> usr/sbin
> drwxr-xr-x 2 root root 4096 Feb 1 07:01 srv
> drwxr-xr-x 2 root root 4096 Jul 14 2023 sys
> drwxrwxrwt 7 root root 4096 Feb 13 11:01 tmp
> drwxr-xr-x 14 root root 4096 Feb 1 07:01 usr
> drwxr-xr-x 11 root root 4096 Feb 1 07:01 var
> lrwxrwxrwx 1 root root 27 Feb 1 07:03 vmlinuz -> boot/vmlinuz-6.1.0-15-amd64
> lrwxrwxrwx 1 root root 27 Feb 1 07:02 vmlinuz.old -> boot/vmlinuz-6.1.0-10-amd64
> [RESCUE] root@vps-XXXXXXXXXX:/ $ passwd
> New password:
> Retype new password:
> passwd: password updated successfully
> [RESCUE] root@vps-XXXXXXXXXX:/ $
######
I tried too with : passwd root
What is the solution?
I can't connect with the new passwd of root, (incorrect)
Your /mnt/etc/ssh/sshd_config forbids probably root login.
No bro
look line:
PermitRootLogin yes
#PermitRootLogin prohibit-password
--------
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Feb 14 09:12:33 2024 from 154.68.3.3
debian@vps-XXXXXXXXX:~$ sudo nano /etc/ssh/sshd_config
GNU nano 3.2 /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
PermitRootLogin yes
#PermitRootLogin prohibit-password
# Authentication:
#LoginGraceTime 2m
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
With your 'debian' user account, (not in rescue), try this
sudo passwd root
Tryed, successfull changing passwd,
and when I try to reconnect, doesn't work.
I suppose it is useless to recommend you
`/etc/init.d/ssh restart` after changing your sshd_config file.
since you already rebooted from the rescue mode.
I have no more idea.
Try enable password auth :
> PasswordAuthentication yes
Then restart sshd
I have the same problem with a Fedora VPS. After an 'dnf update' I am not able to login with root. I can login in rescue mode, chroot in my partition and execute 'passwd' with success. When I reboot to normal VPS I cannot login via KVM.
What can I do to access my VPS again?
I found a solution. In my case I solved executing "touch /.autorelabel" and rebooting.
It could be that your SELinux labels are incorrect.
SELinux will apply all labels correctly (may take a while).