Safely change home directory

前端 未结 12 2338
南旧
南旧 2020-12-12 10:22

I\'m trying to safely update the home directory as specified in /etc/passwd, but the standard Linux utils - usermod and vipw - for doing so aren\'t provided by

12条回答
  •  臣服心动
    2020-12-12 11:17

    For the current user the following worked for me:

    1. Close Cygwin.
    2. Set the HOME Windows user environment variable.
    3. Start Cygwin.
    4. run "mkpasswd -c -p "$(cygpath -H)" > /etc/passwd".
    5. Restart Cygwin.

    I confirmed it worked by running ssh-keygen without any arguments. After making this change the app now defaults to saving the key to /cygdrive/c/Users/user instead of /home/user.

    I don't know if setting HOME is required, but I did it anyway per instructions for setting up TortoiseGit with Cygwin using Tortoise's official documentation for unofficial Cygwin support here. Setting HOME alone though was not enough for ssh-keygen to recognize the home directory change.

    Also, note that Cygwin's official documentation on this issue can be found here.

    Confirmed in Windows 7 using 64-bit Cygwin v1.7.35.

提交回复
热议问题