Problem description
The CentOS server has been installed, and the secure CRT tool has been used to connect Linux remotely through the SSH service, which makes it easy to perform various operations. Today, I accidentally tried to restart the server under the non-root general user command, found that the general user is not authorized to perform the restart, decisive use of the sudo command to execute again, and finally restarted successfully, but found that the secure CRT is no longer connected to the server, depressed unceasingly, Go online to find all kinds of information finally have a little superficial understanding, record down, also let other Linux beginner can take a few detours.
Perform the restart command under normal User:
Shutdown-r now or reboot
Where-R to restart, to-H is the shutdown, and now is immediately, can also be changed to a number, the unit is minutes, but also using the shutdown command can be used to achieve timed shutdown and restart.
The above commands do not have permission to execute under the ordinary user, sudo is required, and the configuration of the sudo command has been explained in detail in the previous blog post (see: http://www.cnblogs.com/bxljoy/p/3868494.html):
sudo shutdown-passwd:
Follow the prompts to enter the user's password, enter the execution, the system starts to restart, the Secure CRT SSH connection automatically disconnects, and then will not be able to connect.
Causes and Solutions
I have been tested to find that if you switch to the root user, perform the above restart command is normal, you can connect to the server with SSH, so the problem should be the normal user after the restart of the network.
In the previous blog post we have introduced the network configuration of Linux,/etc/sysconfig/network-scripts/ifcfg-eth0 configuration file, Onboot=yes must be set, so that the system can be restarted, the network service will also be self-booting, Doing so will cause the network to become out of line.
And we know that the command to restart the network service is:
Service Network restart
The command to restart the service must have the root user's permission, so after a normal user restart, the command to perform such a restart service does not have sufficient permissions, causing the service to start failure.
This is also my own speculation, and did not find too detailed information, I hope that a master can be a detailed explanation of the problem.
In addition, when Linux restarts, the various service startup scripts under the/ETC/RC*.D directory are executed, and/ETC/RC*.D is actually a/ETC/RC.D/RC*.D link (similar to Windows shortcuts), where I/etc/rc.d/ rc.local files found in the service Network Restart command, do not know whether to execute the service start command here, I hope the master correct.