如何在安装后更改我的Cygwin主文件夹? [英] How can I change my Cygwin home folder after installation?
问题描述
我刚刚安装Cygwin,它看起来像主目录在bash提示符是在我的Z:驱动器。
db_home:windows
或者,等价于:
db_home:/%H
您需要使用后一种形式,如果你想在这个方案的一些变化,如隔离您的Cygwin主文件您的Windows用户个人资料目录的子目录:
db_home:/%H / cygwin
Windows
选项加上几个其他的替代方案有 c>其他%
令牌可以代替%H
或除此之外。请参见 nsswitch.conf code>语法说明
,位于 Cygwin用户指南。
如果您在1.7.34之前安装了Cygwin或者已经运行 mkpasswd
实用程序,以便您拥有 / etc / passwd
文件,可以通过编辑用户在该文件中的条目来更改Cygwin主目录。您的主目录是您的用户在 / etc / passwd
中的第二个到最后一个元素。
无论以何种方式,这将导致在shell启动期间设置 HOME
环境变量。
a href =http://www.cygwin.com/faq.html#faq.setup.home =noreferrer>此常见问题项目了解更多相关主题。
脚注:
-
请考虑移动 / etc / passwd
和 / etc / group
href =http://www.cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping =noreferrer>新的基于SAM / AD的机制。
-
虽然可以通过控制面板设置%HOME%
,但正式阻止。它不仅不经意地覆盖了上面的机制,而且并不总是可行,比如通过 cron
运行shell脚本。
I just installed Cygwin, and it looks like the home directory in the bash prompt is on my Z: drive. That's not where I want it.
How can I change this?
解决方案 Starting with Cygwin 1.7.34, the recommended way to do this is to add a custom db_home
setting to /etc/nsswitch.conf
. A common wish when doing this is to make your Cygwin home directory equal to your Windows user profile directory. This setting will do that:
db_home: windows
Or, equivalently:
db_home: /%H
You need to use the latter form if you want some variation on this scheme, such as to segregate your Cygwin home files into a subdirectory of your Windows user profile directory:
db_home: /%H/cygwin
There are several other alternative schemes for the windows
option plus several other %
tokens you can use instead of %H
or in addition to it. See the nsswitch.conf
syntax description in the Cygwin User Guide for details.
If you installed Cygwin prior to 1.7.34 or have run its mkpasswd
utility so that you have an /etc/passwd
file, you can change your Cygwin home directory by editing your user's entry in that file. Your home directory is the second-to-last element on your user's line in /etc/passwd
.¹
Whichever way you do it, this causes the HOME
environment variable to be set during shell startup.²
See this FAQ item for more on the topic.
Footnotes:
Consider moving /etc/passwd
and /etc/group
out of the way in order to use the new SAM/AD-based mechanism instead.
While it is possible to simply set %HOME%
via the Control Panel, it is officially discouraged. Not only does it unceremoniously override the above mechanisms, it doesn't always work, such as when running shell scripts via cron
.
这篇关于如何在安装后更改我的Cygwin主文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!