- I think the best way for hiding all is to put the database on other host and source code website on the other host But how to encrypt config file and database. If someone get all source code and database of website but they can't setup again?
- If someone log in server by ssh protocol with administrator privilege, how can they remove all log files on unix or linux server. If one can't get root on the server, they can't remove all log file. How can somebody take over root privilege or edit chmod?
- Except hashcat tool, what is the best to for check password encryption type?
If someone get all source code and database of website but they can't setup again?
The closest you can do is obfuscate the way how to get to the data. Languages like PHP have an obfuscation with products such as ZendGuard. This prevents a user to figure out the logic of an application easily. This is similar to running closed source products, it's possible to figure out the execution flow, it will just take more effort.
If you encrypt something, your app still need to have a way to decrypt that data, such as a key. You could try to load this data upon bootup into memory, so they (the attackers) can't read it form a file, but it will live in the ENV, which is accessible too.
If one can't get root on the server, they can't remove all log file. How can somebody take over root privilege or edit chmod?
Usually by guessing local credentials or a local privilege escalation exploit.
Except hashcat tool, what is the best to for check password encryption type?
Not sure what you mean with "password encryption type", any password cracker (like JohnTheRipper) will do an initial round to determine what hashing algorithm is used.
1: If somebody has access to your server, none of this well help. If the application can make a query to the database, the application can be changed to make an arbitrary query.
One thing you can do is use separate database accounts for, for example, reading and writing, or for sensitive and non-sensitive. Then SQL injection will only compromise one of them, though that doesn't really buy you much.
2: Somebody gets root privilege from a user account by using a "privilege escalation attack". They might exploit a kernel or driver vulnerability, an insecure setuid program, or guess the root password. Keep in mind that an attacker doesn't necessarily need root access to cause damage: with a user account, they can generally read your data, set up persistence, pivot to other servers, etc. They probably can't get your OS passwords, install a kernel rootkit, or wipe logs, though, so there are definitely some advantages to gaining root.
3: It's password hashing, not password encryption. Hashcat is probably the most popular tool, but an older tool you might research is called "John the Ripper" (preferably with the "Jumbo patch").