Rename user linux mint

How To Change or Rename Username and User ID In Linux?

The problem is we want to change the already created user name or user id. As we know there is a lot of configuration those rely on the user id like permissions. We will use usermod command to make this change. Keep in mind this changes will effects system wide.

List User Info

Before starting to big changes we will list users detailed info with cat command like below.

List User Info

  • test is our user name for this operation
  • 1000 is the current id of our test user.

Change User Name

We will change username with the following command by providing new username. We will provide the -l option with the new username and old username. In this example we will change username ismail into ali .

  • usermod is command we issue to chage
  • -l ali is the new username
  • ismail is the original username

Change User ID

Another opportunity is changing the user ID. Previously we have listed user information of the ismail . We know that the user id of the ismail is 1000 . We will use -u option and the new user id with the user name. In this example we will change the user id of ismail into 1010

  • usermod is command used too
  • -u 1010 is new user id provided for the user
  • ismail is the user whose id will be changed.

Check It Again

After these steps we need to the if there is a problem or everything is OK. We will list user information again with the cat command like below.

  • test2 is new username but home directory stays the same
  • 1010 is the users new id

Источник

Как изменить имя пользователя в Ubuntu, Debian, Deepin, Linux Mint, elementary OS или Fedora

Это пошаговое руководство о том, как изменить имя пользователя в Debian, Ubuntu, Deepin, Linux Mint, elementary OS (и других дистрибутивах Linux на основе Debian или Ubuntu) и Fedora.

В инструкциях объясняется, как изменить (переименовать) имя пользователя вместе с именем домашней папки пользователя, а также простой способ устранения потенциальных проблем с файлами конфигурации, которые все еще указывают на старое имя домашней папки. Также есть шаг для изменения полного имени (отображаемого имени), которое отображается на экране входа в систему и в других местах на рабочем столе.

Во всех приведенных ниже инструкциях или командах не забудьте заменить newusername его новым именем пользователя и oldusername старым именем пользователя.

Читайте также:  Нет пакета windows installer при установке itunes

1. Создайте временного пользователя и предоставьте ему привилегии sudo

Мы войдем в систему с временным пользователем, чтобы выполнить команды смены имени пользователя. Таким образом, не будет проблем при запуске их от того же пользователя, которого мы пытаемся переименовать (например, процессы, запущенные для этого пользователя и т. д.).

Добавьте нового временного пользователя ( tempuser ) и предоставьте ему привилегии sudo в Debian, Ubuntu, Deepin, elementary OS или Linux Mint (после ввода пароля вы можете продолжать нажимать, Enter чтобы пропустить ввод остальной информации):

Добавьте новый tempuser и предоставьте ему привилегии sudo на Fedora:

2. Войдите в систему как tempuser и измените (переименуйте) имя пользователя, домашнюю папку и группу

Выйдите из системы и на экране входа выберите tempuser и войдите под этим пользователем. Затем откройте терминал и выполните эти команды, чтобы изменить имя пользователя, домашнюю папку и группу с oldusername на newusername :

Если вы получили ошибку об использовании процесса для старого имени пользователя, убейте этот процесс ( kill PID ), но в большинстве случаев этого не должно происходить, поскольку мы вошли в систему, используя временное промежуточное имя пользователя для внесения этих изменений. Если это произойдет, другой обходной путь – это перезагрузить компьютер, а затем войти в tempuser напрямую, таким образом, нет никаких процессов, используемых старым именем пользователя.

3. Создайте символическую ссылку из /home/newusername в /home/oldusername

Некоторые приложения будут отображать ошибки при изменении имени пользователя, потому что в некоторых случаях есть файлы конфигурации, которые указывают на домашнюю папку старого имени пользователя. Решением для этого является создание символической ссылки из новой домашней папки на старую домашнюю папку:

4. Измените отображаемое имя или полное имя (имя, фамилия)

В моем случае при попытке переименовать имя пользователя в Ubuntu 19.04 и Fedora 29 отображаемое имя (полное имя) осталось неизменным на экране входа в GDM3 и в меню пользователя. Это можно изменить, используя:

Заменить firstname и lastname с первым и последним именем, или что вы хотите, чтобы показать на экране входа и различных других местах по всей системе. firstname и lastname также может быть одним элементом, например, вашим новым именем пользователя.

Команда chfn доступна на Fedora в util-linux-user пакете, который не установлен по умолчанию. Вы можете установить его на Fedora, используя:

После установки этого пакета chfn команда должна работать на Fedora.

5. Войдите в систему с новым (переименованным) именем пользователя и удалите временного пользователя, созданного в шаге 1

Выйдите из системы, выберите новое, переименованное имя пользователя на экране входа в систему и перейдите к входу в систему. Теперь вы можете удалить временного пользователя, созданного в шаге 1 ( tempuser ), и его домашнюю папку:

Источник

How To Change Username On Ubuntu, Debian, Linux Mint Or Fedora

This is a step by step guide on how to change your username on Debian, Ubuntu, Linux Mint (and other Linux distributions based on Debian/Ubuntu), and Fedora.

The instructions explain how to change (rename) the username along with the user’s home folder name, as well as a simple work-around for potential issues with configuration files that still point to the old home folder name. There’s also a step for changing the full name (display name), which is shown on the login screen and other places throughout the desktop.

Throughout all the instructions / commands below, remember to replace newusername with the new username, and oldusername with the . old username.

1. Create a temporary user and give it sudo privileges.

We’ll login with the temporary user to perform the username change commands. This way there won’t be any issues running them from the same user we’re trying to rename (e.g. processes running for that user, etc.).

Читайте также:  Windows update stop working

Add a new temporary user ( tempuser ) and give it sudo privileges on Debian, Ubuntu or Linux Mint (after entering a password you can keep pressing Enter to skip entering the rest of information):

Add a new tempuser and give it sudo privileges on Fedora:

2. Login with tempuser and change (rename) the username, home folder and group.

Logout, and on the login screen select tempuser and login with that user. Next, open a terminal and run these command to change your username, home folder, and group from oldusername to newusername :

If you get an error about a process being in use for the old username, kill that process ( kill PID ), but that shouldn’t happen in most cases since we’re logged in using a temporary, intermediate username to make these changes. If it does happen, another workaround is to reboot and then login straight with tempuser , that way there aren’t any processes used by the old username.

3. Create a symbolic link from /home/newusername to /home/oldusername .

Some applications will show errors when changing the username, because in some cases there are configuration files that point to the old username’s home folder. A solution for this is to create a symbolic link from the new home folder to the old home folder:

4. Change the display name / full name (firstname lastname).

In my case, trying to rename a username on Ubuntu 19.04 and Fedora 29, the display name (full name) remained unchanged on the GDM3 login screen and on the user menu. This can be changed though, using:

Replace firstname and lastname with your first and last name, or whatever you want to show up on the login screen and various other places throughout the system. firstname and lastname can also be one item, e.g. your new username.

The chfn command is available on Fedora in the util-linux-user package, which is not installed by default. You can install it on Fedora using:

After installing this package, the chfn command should work on Fedora.

5. Login using the new (renamed) username, and delete the temporary user created on step 1.

Logout and select the new, renamed username from the login screen, and proceed to login. You can now delete the temporary user created in step 1 ( tempuser ) and its home folder:

Источник

How to rename Linux users and their home directory

Overview

In this tutorial, you will learn how to a rename a user in CentOS, Debian, Ubuntu and most other Linux distributions. More than that, you will also learn how to rename thier home directory, primary group, and change their UID.

Renaming Users in Linux

Linux provides a tool named usermod specifically for making modifications to user accounts. In this case we are using it to rename a user account, which is done using the -l flag.

For example, to rename a user named student1 to johndoe, you would run the usermod command as follows.

The -l flag will only change the user’s name. All other things attached to the user will remain unaffected, such as home directory. and UID.

Changing a User’s Home Directory in Linux

After renaming a user it may make sense to change their home directory, too. Otherwise, it would cause a lot of confusion trying to explain why johndoe ‘s home directory is /home/student .

To change the user’s home directory we once again use the usermod command. However, this time we need to perform to actions: change the home directory to a new path, and move the contents from the old path into the new path.

Читайте также:  Файл начала установки windows

We set the new home directory path using the -d or —home flag with the path to the new directory. We must also use the -m flag to copy the contents of the old home directory into the new one.

Renaming a User’s Group

Every user on a Linux system is created with a group of the same name. When we change the name of a user their group name is left untouched. It’s a good idea to also change the user’s primary group name as well.

To change a user’s primary group name we use the groupmod command with the -n flag. We must supply the old name and a new name.

For example, to rename the newly renamed user johndoe ‘s primary group to johndoe from student1 , we would run the following command.

Changing a User’s UID

A little more rare than renaming a user or changing their home directory is changing their UID. A User’s UID is their unique ID on a Linux system. When we assign permissions to file and directories, we use their UID. Processes started by a user are also executed using a user’s UID.

To change a user’s ID we use the usermod command with the -u flag, followed by a new, unique integer.

For example, to set johndoes UID to 5001, we would run the following usermod command.

Источник

How to add, remove, and rename Users by command-line in Ubuntu, Linux Mint

I n this session of our Terminal Tuts series, let’s learn how to add, remove, and modify user accounts from the terminal using commands in Ubuntu, Linux Mint, and derivatives.

View list all the users of your PC

Before heading to add, remove, and modifying the users, let’s first know how to view the list of user accounts in your PC.

System user accounts is stored in the file etc/passwd. We will use cut command in combination with a delimiter and a fetch field function. Launch ‘Terminal’ and run the following command.

In the above command, we are using cut to remove a part from each line of the file etc/passwd and using a delimiter d for field. Also the f1 selects the first part from the mentioned file in the path provided. So the actual file content can be seen just by using the following command. You will lot of information. The above command filters only the name which we want.

cat /etc/passwd Output

Add New User Accounts

To add new user accounts in Ubuntu, you can use adduser or useradd command. Both gives same result. Replace ‘username’ with the name you want in the below command.

This will add the new user with all default settings applied. If you want the new user to be a part of a group you can add the group at last. Replace ‘user name’ and ‘usergroup’ with name and group you want respectively. For example:

Remove User Account and Data

To delete a user account in Ubuntu, use the deluser command. Replace ‘username’ with name you user account name you want to delete on your PC.

You may want to delete that user’s home directory as well. Use ‘Remove’ (rm) command:

If you want to remove all the files, use this command too:

To Rename a User Account

If you want to modify an existing user account, use the following command format. Replace new_username and old_username accordingly with what you want.

Change Password of an User Account

You can change he password for a user account using passwd command:

Hope these commands are useful to you. Good luck!

Источник

Оцените статью