I posted it because I want to tell you that if you make a mistake in chown and chmod as root, the server will be destroyed.
$ #Owner change
$ cd /home/testuser/targetdir
$ chown -R ${User name}:${group name} ./
$ #Change permissions
$ cd /home/testuser/targetdir
$ chmod -R ${permission} ./
If you are doing it as above, we recommend that you stop it.
The target is not currently under the directory but all directories, and various functions are broken. It's almost impossible to get it back.
Rm -rf /
, which is often talked about in the command to break the server, may have a safety function depending on the CentOS version, but the above is executed because it seems that the safety function does not currently exist.
Make the directory specification of the change command an absolute path,
Or just before, use the cd
command to move up one level of the directory to be changed and specify the directory to be changed.
$ #Make the directory specification of the change command an absolute path
$ chown -R ${User name}:${group name} /home/testuser/targetdir
$ chmod -R ${permission} /home/testuser/targetdir
$ #Just before`cd`Use the command to move up one level of the directory to be changed and specify the directory to be changed.
$ cd /home/testuser/
$ chown -R ${User name}:${group name} targetdir
$ chmod -R ${permission} targetdir
Don't be overconfident that you won't make such a mistake. People make careless mistakes right away. If you break the server due to the careless mistake, it will not be fashionable.