Modify User1 's home directory directly

Source: Internet
Author: User

If we have created a normal user User1, the default user's home directory for/home/user1, do experiment to prove can directly modify the/etc/passwd configuration file User1 home directory that field and change User1 home directory? (Hint: You can use the "CD ~" command to enter the current user home directory to verify the method)
[Email protected] ~]# Useradd user1
[[email protected] ~]# grep user1/etc/passwd
User1:x:502:503::/home/user1:/bin/bash
[Email protected] ~]# sed-i ' s#/home/user1#/tmp# '/etc/passwd
[[email protected] ~]# grep user1/etc/passwd
User1:x:502:503::/tmp:/bin/bash
[Email protected] ~]# Su-user1
-bash-3.2$ Echo $HOME
/tmp
-bash-3.2$ CD
-bash-3.2$ pwd
/tmp
Prove that you can change the user's home directory by changing the/etc/passwd

This article is from the "Sen Wang" blog, make sure to keep this source http://zhibeiwang.blog.51cto.com/7555525/1787779

Modify User1 's home directory directly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.