Home > System Tutorial > LINUX > body text

What is the command to switch username in Linux?

下次还敢
Release: 2024-04-11 21:03:16
Original
448 people have browsed it

The command to switch usernames in Linux is usermod [option] . The available options are: -c to set descriptive comments -d to set home directory -e to set Expiration time -L Lock account -U Unlock account -m Move home directory -s Set up login shell -G Add group membership

What is the command to switch username in Linux?

Switch Linux Username command

To switch the username in the Linux system, you can use the usermod command.

Syntax:

<code>usermod [选项] <新用户名> <用户名></code>
Copy after login

Options:

  • -c Comments: Set user descriptive notes.
  • -d Directory: Set the user's home directory.
  • -e Expiration time: Set the expiration time of the user account.
  • -L Lock: Lock the user account.
  • -U Unlock: Unlock the user account.
  • -m Move: Move the user's home directory to a new location.
  • -s shell: Set the user's login shell.
  • -G Group: Add group membership to a user.

Example:

To change the username of user john to jack, you can run the following command :

<code>sudo usermod -l jack john</code>
Copy after login

To add membership to group sales to user mary, run the following command:

<code>sudo usermod -aG sales mary</code>
Copy after login

The above is the detailed content of What is the command to switch username in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!