In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to modify the user directory in linux". Many people will encounter such a dilemma in the operation of the actual case, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Linux user directory modification method: 1, the use of "vi / etc/passwd" command, modify the "/ etc/passwd" file to modify the user directory; 2, the use of usermod command modification, syntax for "usermod-d user name-u uid".
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to modify the user directory in linux
The first method:
Vi / etc/passwd
Find the lines of the user you want to modify and modify them. This method is very violent and is recommended to be used with caution.
/ etc/passwd file format
Login name: encrypted password: digital user ID: numeric group ID: comment field: starting directory: shell program
After using this method to modify the user host directory, some exceptions will occur, such as: bash environment exception. You need to copy the hidden files under the user's original host directory to the changed host directory.
Cp / original host directory /. * / target directory
The second kind: usermod
Usermod-d / usr/newfolder-u uid
-u be sure to connect with uid, not username
Attached: detailed parameters of usermod
Grammar:
Usermod [- LU] [- c] [- d] [- e] [- f] [- g] [- G] [- l] [- s] [- u] [user account]
Note: usermod can be used to modify the settings of a user's account.
Parameters:
-c modify the remarks of the user account.
-d login directory > modify the directory when the user logs in.
-e modify the validity period of the account.
-f modify how many days after the password expires to close the account.
-g modify the group to which the user belongs.
-G modifies the additional group to which the user belongs.
-l modify the user account name.
-L locks the user's password, invalidating it.
-s modifies the shell used by the user after login.
-u modify user ID.
-U unlocks the password.
Finally, switch to the regular account and you will see that the current default directory has been changed.
This is the end of the content of "how to modify user directories in linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.