Home  >  Article  >  Computer Tutorials  >  How to create a non-login user in Linux?

How to create a non-login user in Linux?

WBOY
WBOYforward
2024-02-21 13:00:231043browse

如何在 Linux 中创建非登录用户?

In Linux, you can create a non-login user by following these steps:

  1. Open a terminal and log in to the Linux system as an administrator.
  2. Use the following command to create a non-login user, replacing "username" with the username you want to create:

    sudo useradd -r username
    • The -r option specifies that the created user is a system user, also known as a non-login user. This type of user is typically used to run system services or specific applications.
  3. If you want to set a password for this user, you can use the following command:

    sudo passwd username

    You will be prompted to enter your new password and confirm it. If you don't want to set a password, you can skip this step.

  4. After completing the above steps, the non-login user has been successfully created.

Please note that creating a non-login user will only generate a user account and will not automatically set the home directory or other permissions for it. If you need to assign specific permissions or access controls to this user, please further configure the user settings.

Through the above method, you can create a non-login user in the Linux system and set a password for it (optional). This type of user is suitable for running system services or specific applications without logging into the system.

The above is the detailed content of How to create a non-login user in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete