Home >Operation and Maintenance >Linux Operation and Maintenance >What are the common errors in Linux?

What are the common errors in Linux?

hzc
hzcOriginal
2020-06-06 16:20:353800browse

What are the common errors in Linux?

Solutions to common Linux errors:

In daily development, especially when operating in Linux, we often encounter to various errors. Record it, practice makes perfect, slowly understand the mysteries of Linux

1) When installing the SSL certificate, the certbot command cannot be used

What are the common errors in Linux?

Solution :

Use yum to reinstall and uninstall the software installed using pip

pip uninstall requests
yum reinstall python-requests
 
pip uninstall six
yum reinstall python-six
 
pip uninstall urllib3
yum reinstall python-urllib3

 2) Problem. xxx is not in the sudoers file. This incident will be reported.(When thinking When you want to switch to root permissions as xxx, use the sudo su command and enter the password of *** as prompted (the error message that appears)

Solution

1.修改sudoer文件,使得能够使用sudo命令
su  (切换到root用户下);
输入root用户密码;
ls -l /etc/sudoers (查看sudoers文件)
chmod u+w /etc/sudoers(给root用户增加写权限);
ls -l /etc/sudoers (查看sudoers文件)
vim /etc/sudoers(打开sudoers文件)然后在 root ALL=(ALL) ALL 后面加上 XXX ALL = (ALL) ALL,其中XXX表示你的用户名,保存之后推出
chmode u-w /etc/sudoers (恢复sudoers文件原来的读写权限)
ls -l /etc/sudoers (查看sudoers文件)
exit(退出root用户)
如此,就可以在xxx用户下使用sudo来做root权限的事情啦

2) is not in the sudoers file

Solution:

1) Switch to root identity (su: Just switch to root, and do not pass the root environment variables to it, su -: Put the environment variables together Bring it over, just like root login)

直接执行命令:
    visudo 
复制root的配置
root ALL=(ALL) ALL
例如添加lanlang
lanlang ALL=(ALL) ALL

2) Directly add the user to the wheel user group

usermod -a -G wheel lanlang
-a: 追加的方式添加, 不会删除掉之前所属的用户组
-G: 执行要添加的用户组

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

useradd sudogroup
echo "%sudogroup  ALL=(ALL)   ALL">> /etc/sudoers
useradd xing
usermod -aG sudogroup xing

3. When using su to switch users, it becomes -bash4.1-$

Cause exploration:

  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 inconsistent with the one when added,

Solution:

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

cp -a /etc/skel/. /home/lanlang
注意: skel/ 目录中的点不能丢哦

2) Migration operation is required

usermod -md /tmp/lanlang lanlang
-d: 修改用户端额家目录通常和-m一起使用
-m: 修改用户家目录通常和-d一起使用

4. Create user , only the $ symbol is displayed when logging in (Ubuntu)

Solution: You need to create a user and create the corresponding permissions and directory

adduser  lanlang

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

Solution: vim /etc/environment

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

Configuration takes effect: source /etc/environment

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

Solution: Forcefully close the interface occupying process

sudo fuser -k 80/tcp #关闭占用80端口的程序

7. After Tencent Cloud resets the service, it cannot be used with ssh or connection tools. Connect

Solution: Delete invalid key

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

8. grep command prompts Binary file jzl_search_stdout.log matches

Solution:

grep -nr -a "400" jzl_search_stdout.log
-a, --text equivalent to --binary-files=text,即让二进制文件等价于文本。

Recommended tutorial: "linux tutorial"

The above is the detailed content of What are the common errors in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn