Ubuntu 20.04 常用操作

    用户相关

    禁用密码长度限制

    Ok, I will answer my question :)

    I've found that pam_unix module performs password complexity check and it can be configured.

    man pam_unix:
    
       minlen=n
           Set a minimum password length of n characters. The default value is
           6. The maximum for DES crypt-based passwords is 8 characters.
    
       obscure
           Enable some extra checks on password strength. These checks are
           based on the "obscure" checks in the original shadow package. The
           behavior is similar to the pam_cracklib module, but for
           non-dictionary-based checks.
    

    Solution:
    Alter the line in the pam_unix module in the /etc/pam.d/common-password file to:

    password    [success=1 default=ignore]  pam_unix.so minlen=1 sha512
    

    It allows you to set any password with minimal length of 1.

    启用 ROOT 远程访问

    设置 ROOT 密码

    sudo passwd
    

    切换 ROOT 登录

    su root
    

    配置 SSH 远程访问 vim /etc/ssh/sshd_config

    # 关键在以下几个配置项
    Port 22
    ListenAddress 0.0.0.0
    PermitRootLogin yes
    PasswordAuthentication yes
    

    评论栏