0senjed0

Registered
Aug 21, 2010
4
1
53
i was wrongly run command
# chsh -s /usr/local/cpanel/bin/jailshell ${username}
and now my root user gives me error

'0' is not a valid user id, and may not run jailshell (cpanel users file missing).


how can i recover my root user ?
 

gryzli

Well-Known Member
Jul 23, 2012
49
6
58
cPanel Access Level
Root Administrator
I firstly thought about su, but it seems to spawns the root shell also.

If you have sudo and sudoers, this could save you.

If not the rescue cd or (mounting the root partition externally if this is VPS) seems to be the solution for this.
 

0senjed0

Registered
Aug 21, 2010
4
1
53
This centos dedicated server . does it possible to recover it with KVM Access ? i'm so amature on this issue
 

gryzli

Well-Known Member
Jul 23, 2012
49
6
58
cPanel Access Level
Root Administrator
You must be able to boot some rescue cd (centos has this) through KVM,

After booting the rescue, you should mount your system partition and be able to directly edit /etc/passwd in order to fix the shell.

In fact, if you choose centos rescue to try automatically find your partitions and mount them for you, there is a pretty big chance, the system will handle this and you will have ready mounts (so only the edit of passwd must be made). If the rescue mounts your partitions, they usually reside into: "/mnt/sysimage"

This video must be close enough to your steps in order to get into rescue mode:
youtube.com/watch?v=I46_BHe9N6o

The only prereqiusity is to find Centos 6.x ISO , mount it through KVM and boot from it.
You can get the ISO from some Centos mirror, which will look something like this:
http : //mirror.some_close_to_you_mirror.com/centos/6.8/isos/x86_64/CentOS-6.8-x86_64-netinstall.iso

Where "mirror.some_close_to_you_mirror.com" is one of the list here:
Mirror List

Hope this helps.
 
Last edited by a moderator:

davidcp

Registered
Jun 3, 2020
1
0
1
Phnom Penh
cPanel Access Level
Reseller Owner
Hello,
Anyone help please, i am facing this problem too.
i was wrongly run command
# chsh -s /usr/local/cpanel/bin/jailshell ${username}
and now my root user gives me error

'0' is not a valid user id, and may not run jailshell (cpanel users file missing).


how can i recover my root user ?