One of my colleague removed by error etc/passwd and etc/shadow files.
The problem is that now the system doesn't have any account.Impossible to connect by ssh or to work on it.
How can I create a root account?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
If you don't have an existing rootshell open then I doubt you can fix this without bios or bootloader access.
At that point you have two options.
which is easier will depend on the particular circumstances.
If you do have an existing root shell open you should be able to use it.
Now you have a way to create files the next question is what to put in there. Debian has several categories of users (Debian policy 9.2.2).
The first step should be to restore the users in the first category. This will be most easilly done by copying their password and shadow entries from another system running the same release of Debian.
If you have also destroyed your group files then the same ID ranges apply.
Once you have the basics restored you can start re-creating other users. For regular users looking in /home should give you clues as to which user goes with which UID. For system users it may take some more effort to figure out, probablly involving searching for files with unidentified owners and then looking at another system with the same software installed to figure out what user is supposed to own those files.