Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the confusion caused by su handover users in Linux common system failures

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to solve the doubts caused by Linux common system failures su switching users, the content is very detailed, interested friends can refer to, hope to be helpful to you.

This is a customer's case. One of the customer's Oracle database servers suddenly went down. Due to the needs of the online business, the customer restarted the server without thinking too much, and there was no problem after the system was restarted. But then, when the customer was ready to switch to the oracle user to start the database, the su switch could not be carried out, so the problem arose.

1. Case phenomenon

Under the root user, an error occurred when su switched to a normal user oracle, as shown in figure 1.

Figure 1 Permission denied error occurred in su switching

Therefore, I tried to log in to the system directly through the oracle user, and found that the oracle user could not log in at this time, with the same error as above.

2. Solution

If you can see from the above error that there is a problem with the permission, you can start with the permission. The basic ideas are as follows:

● user directory / home/oracle permission issue.

● su program execution permission issue.

Shared library permissions that ● programs depend on.

A problem with ● SELinux caused.

● system root space problem.

3. Troubleshooting problems

According to the above idea, check one by one, considering that su will read the environment variable configuration file under the oracle directory when switching to the oracle user, so first check whether there is a problem with the permissions in the / home/oracle directory:

[root@loaclhost home] # ls-al / home | grep oracle drwx---- 4 oralce oinstall 4096 01-31 10:45 oracle

As you can see from the output, the owner of the / home/oracle directory is the oracle user, and the oracle user has "rwx" permission on this directory, so the permission setting of the oracle user directory is correct and this problem can be eliminated.

Then check the issue of su execution permissions:

[root@loaclhost home] # 11 / bin/su-rwsr-xr-x 1 root root 24120 2007-11-30 / bin/su

It can be seen that there is no problem with the permission to execute the su command, and this problem has been eliminated.

Continue to check the shared library permissions that su depends on, and use the ldd command to check the shared library files that the su command depends on, as shown in figure 2.

Figure 2 check the shared library files that the su command depends on through the ldd command

According to the above operation, check the permissions of each library file on which the su command depends, and find that they are all normal and have executable permissions, so the problem of shared libraries is also eliminated.

According to the above idea, continue to check the settings of SELinux and execute the command as shown in figure 3.

Figure 3 check the settings of SELinux

As you can see from the output, SELinux is off, and this reason is ruled out.

So far, the problem has become complicated and confusing. What went wrong? As a Linux operation and maintenance staff, it is very necessary to routinely check the status of the root partition of the system, so first check the disk space size of the root partition and find that there is a lot of space left to eliminate the space problem. Since the error reported is that there is a permission problem, as long as you take the permission as a clue and do not deviate from this core, continue to try to check the permissions of each user under the / home directory and execute the command as shown in figure 4.

Figure 4 check the permissions of each user under the / home directory

From the output, the directory permissions of each user are "rwx-", which is no problem at all. Careful examination of the train of thought, found that the current eyes have been stuck in the user's corresponding directory, while ignoring other output information, and the problem lies in the information that did not pay attention to before. In the first two lines of this command output, the first line of permissions corresponding to the directory is ".", on behalf of the current directory, that is, the / home directory, the permissions are "rwxr-xr-x", that is, "755", and the second line of permissions corresponding to the directory is "..", that is, the root directory, but the permissions are "rw-rw-rw-", that is, "666". At this time, the problem is finally found that it is the root directory permission problem.

It is obviously not normal to set root permissions to "rw-rw-rw-". Under normal circumstances, the permission of the root directory should be "755". Why is it set to this? it is most likely a misoperation. It is not very clear when viewing the permissions of the root directory through the ls command, and it is easy to be ignored by many operators. In fact, we can check the permissions of each directory in detail through another command, stat, as shown in figure 5.

Figure 5 View root permissions through the stat command

Through this command, you can clearly see that the permission of the root directory is "0666", which is the root cause of the failure of su execution.

4. Solve the problem

Knowing the cause of the problem, it is very easy to solve the problem by executing the following command:

[root@localhost] # chmod 755 /

The su switching command can then be successfully executed.

Finally, to make a simple summary, this problem is mainly due to the fact that the root directory does not have executable permissions, and all operations under Linux are performed in the root directory, resulting in no execution permissions in the / home/oracle directory. In fact, the loss of root permissions has the same impact on every user running in the system. Therefore, when there is a problem with permissions, be sure to pay attention to the permissions of the root directory.

On how to solve the common Linux system failures su switching users to share the doubts brought here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report