弹性云服务器 ECS-手工搭建Ghost博客(Ubuntu 20.04):创建新用户

时间:2024-08-27 15:44:43

创建新用户

由于Ghost官方不推荐使用root用户直接操作,因此需要重新创新的用户,并为其配置权限。

  1. 执行以下命令,创建新用户。本文以user为例。

    adduser user

    回显信息如下:

    Adding user `user' ...
    Adding new group `user' (1000) ...
    Adding new user `user' (1000) with group `user' ...
    Creating home directory `/home/user' ...
    Copying files from `/etc/skel' ...
    New password:
    Retype new password:
    passwd: password updated successfully
    Changing the user information for user
    Enter the new value, or press ENTER for the default
            Full Name []:
            Room Number []:
            Work Phone []:
            Home Phone []:
            Other []:
    Is the information correct? [Y/n] Y
    1. New password:Retype new password:提示信息中,请按照提示输入并确认用户密码,密码默认不显示,输入完成后按Enter。
    2. Enter the new value, or press ENTER for the default提示信息中,按Enter保持默认即可,您也可以根据实际情况填写用户相关信息。
    3. Is the information correct? [Y/n]提示信息中,输入Y确认信息,并按Enter,完成设置。
  2. 执行以下命令,将新创建的用户添加到组。

    usermod -aG sudo user

  3. 执行以下命令,切换到user用户。

    su - user

support.huaweicloud.com/bestpractice-ecs/zh-cn_topic_0149023604.html