The sudo command under Ubuntu is mainly used to increase the authority of the account, which can save time and improve the security of Ubuntu. However, in some cases, the execution of sudo commands under Ubuntu is slow. How to solve this problem?
Here's how:
1. First make sure that the current user can execute sudo
You can check the /etc/sudoer file to see if there is a current user. If not, please contact the administrator or add it through the root user.
2. Check your host name
[root@centos ~]# hostname
centos.6.7
[root@centos ~]#
3. Add your own host name to the /etc/hosts file in the following format:
127.0.0.1 centos.6.7 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
At this point, the problem of slow execution of sudo commands under Ubuntu has been solved. If you use sudo commands to switch users very slowly, you can refer to: What should I do if sudo switching of users is too slow in RHEL 6.0 system?