(原文)http://www.gigascale.org/softdevel/faq/19.html
Christopher Brooks , 29 Oct 2001
Last updated: 14 Nov 2004
If, under Windows, when you run cvs update
you are prompted for the Administrator password on the CVS repository, or you have permission problems writing to files, then you may need to set up /etc/passwd
on machine to include your name and UID.
/etc/passwd
Note that the actual location of /etc/passwd
varies depending on where you installed Cygwin. If Cygwin is installed in c:/cygwin
, then /etc/passwd
will actually end up in c:/cygwin/etc/passwd
.
mkpasswd
The easiest way to update /etc/passwd
is to run the mkpasswd
command that is included with the Cygwin toolkit. Usually, when Cygwin is installed, mkpasswd
is run and /etc/passwd
is automatically created. If your account was added after Cygwin was installed, then you may need to run mkpasswd
by hand.
mkpasswd -help
will print out the help for mkpasswd.
Below are a few scenarios for updating /etc/passwd
:
If your Windows machine is a member of a Windows domain, use this command to add yourself to /etc/passwd:
mkpasswd -d | grep yourlogin > /etc/passwd
Note that if your domain is rather large, then mkpasswd -d
could take a minute to complete.
To generate /etc/passwd
for all the local Windows accounts, try:
mkpasswd -l > /etc/passwd
/etc/passwd
also defines where your home directory is. Usually, Cygwin will set your initial default home directory to /home/yourname
, which maps to c:/cygwin/home/yourname .
Unfortunately, tools like Java do not know about the Cygwin directory mapping, so you may want to reset your home directory to a location outside of the Cygwin tree.
For example, if your home directory was at c:/users/yourname
, then Cygwin would find this as /cygdrive/c/users/yourname
because Cygwin mounts the c:
drive as /cygdrive/c
To set up Cygwin so that it finds your home directory, edit c:/cygwin/etc/passwd
and change your home directory from /home/yourname
to /cygdrive/c/users/yourname
/etc/passwd
by handStephen Neuendorffer suggests
Edit /etc/passwd and add a new line that contains your information.
username :: userid : groupid : fullName : home directory :/bin/sh
Your username and fullname should be obvious. If you forget these, then CVS probably won't be much use to you! Your home directory is probably /home/ username . Your groupid should probably be the same as the administrator and your userid should be some unique number that is not used elsewhere in the file and less than 65535. Adding one to the largest number in the file will probably work.
Another suggestion for obtaining a userid is to look at your entry in /etc/passwd
on a Unix machine and use that number.
mkgroup
There is also a mkgroup
command that is similar to mkpasswd
. mkgroup
can be used to create /etc/group
:
mkgroup -l > /etc/group
The CVS Account Name FAQ covers how to use a CVS repository with a login that is different than your current login. Note that even if you configure your system to properly use a different login on the cvs server, then you may still have permission problems if you do not have /etc/passwd
set up properly.