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

Common mistakes and Solutions of linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the common mistakes and solutions of linux, which has certain reference value and can be used for reference by friends who need it. The following information is about common errors and solutions in linux.

In daily development, especially when operating in Linux, you often encounter a variety of errors. For the record, practice makes perfect, slowly understand the mystery of linux

1) when installing the ssl certificate, the certbot command cannot be used

Solution:

Reinstall using yum and uninstall the software installed using pip

Pip uninstall requestsyum reinstall python-requests pip uninstall sixyum reinstall python-six pip uninstall urllib3yum reinstall python-urllib3

2) problems. Xxx is not in the sudoers file. This incident will be reported. (error prompt when you want to switch to root permissions as xxx, use the sudo su command and follow the prompt to enter the password of *.)

Solution

1. Modify the sudoer file to make it possible to use the sudo command su (switch to root user); enter the root user password Ls-l / etc/sudoers (view sudoers file) chmod Ubunw / etc/sudoers (add write permissions to root users) Ls-l / etc/sudoers (view sudoers file) vim / etc/sudoers (open sudoers file) then add XXX ALL= (ALL) ALL after root ALL= (ALL) ALL, where XXX represents your user name, and then launch chmode Umurw / etc/sudoers (restore the original read and write permissions of sudoers file) ls-l / etc/sudoers (view sudoers file) exit (exit root user) so that you can use sudo to do root permissions under xxx users.

2) is not in the sudoers file

Solution:

1) switch to root identity (su: just switch to root, instead of passing the environment variable of root, su -: bring the environment variable together, just like root login)

Execute the command directly: visudo copies the configuration of root root ALL= (ALL) ALL, for example, add lanlanglanlang ALL= (ALL) ALL

2) add users directly to the wheel user group

Usermod-a-G wheel lanlang-a: appended without deleting the previous user group-G: execute the user group to be added

3) add a new user and add it to / etc/sudoers as a group, and finally add another user to the group

Useradd sudogroupecho "% sudogroup ALL= (ALL) ALL" > > / etc/sudoersuseradd xingusermod-aG sudogroup xing

3. When switching users with su, it becomes-bash5.1-$

Inquiry into the reasons:

1) there is no relevant environment configuration file (.bash _ logout .bash _ profile, .bashrc) in the user's home directory.

2) the user's home directory is not the same as that when it was added.

Resolve:

1) copy the user environment configuration file of / etc/skel to the specified directory

Cp-a / etc/skel/. / home/lanlang Note: dots in the skel/ directory cannot be lost.

2) Migration operation is required

Usermod-md / tmp/lanlang lanlang-d: modify the user's home directory is usually used with-m: modify the user's home directory is usually used with-d

4. To create a user, login displays only the $symbol (Ubuntu)

Solution: need to create user's use to create corresponding permissions and directories

Adduser lanlang

5.-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8):

Solution: vim / etc/environment

LANG=en_US.utf-8LC_ALL=en_US.utf-8

Configuration takes effect: source / etc/environment

6.nginx: [emerg] bind () to 0.0.0.0 bind 443 failed (98:Address already in use)

Solution: forcibly shut down the interface occupancy process

Sudo fuser-k 80/tcp # shuts down programs that occupy port 80

7. After Tencent Cloud resets the service, you cannot connect using ssh or connection tools.

Solution: delete invalid key

Ssh-keygen-R "you server hostname or ip"

8. Grep Command prompt Binary file jzl_search_stdout.log matches

Resolve:

Grep-nr-a "400" jzl_search_stdout.log-a,-- text equivalent to-- binary-files=text, that is, make binaries equivalent to text.

These are the details of the common mistakes and solutions of linux. Have you learned anything after reading them? If you want to know more about it, you are welcome to follow the industry information!

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