|
|
PGTS Humble BlogThread: Tips/Tricks For Programming etc |
|
Gerry Patterson. The world's most humble blogger | |
Edited and endorsed by PGTS, Home of the world's most humble blogger | |
| |
Cygwin UID and Group IDs |
|
Chronogical Blog Entries:
|
|
| |
Date: Fri, 06 Sep 2013 00:31:46 +1000If your Windows environment is going through a domain changes your SIDs (Security IDs) will change. Windows SIDs are poorly documented and not well understood. If you have cygwin in the mix, don't forget to regenerate the UID and Group IDs. |
Many cygwinners are already familiar with the mkpasswd and mkgroup commands which interrogate the Windows Domain for information regarding user names and groups. But since these commands are most commonly used when the installation is first done, they may be forgotten during a domain migration.
Traditionally the way to use these commands is:
mkpasswd >/etc/passwd mkgroup >/etc/group
However, according to the MAN pages, domain users should consider using them with the -d option.
mkpasswd -d >/etc/passwd mkgroup -d >/etc/group
Omitting this step can lead to some problems when domains are modified or when machines are migrated to a different domain. The security information contained in /etc/passwd and /etc/group becomes out of date, and some things might be broken ... Recently I encountered a problem due to the fact that $HOME contained Windows network shares. This effected the behaviour of programs that determine the HOME folder by reading /etc/passwd ... And there were a surprisingly large number of them. Many programs which use the SSH protocol in Cygwin use /etc/passwd rather than ${HOME} to determine where to look for the .ssh folder.
You can fix the problem by either manually editing /etc/passwd or regenerating it with mkpasswd. While you are at it you probably should regenerate /etc/group with mkgroup.
Due to changes to termio, recent versions of Cygwin no longer support the windows FTP command line in the Cygwin terminal. You may choose to use the windows FTP client with a Windows cmd prompt. Or you might choose substitutes such as the perl module Net::FTP ... But if you still prefer to use the command line and want to continue to use the Cygwin bash shell, you should try the enhanced ftp client, tnftp for Cygwin ... This gives all the commands that you usually get with a Unix FTP client, including support for the .netrc protocol (including macros), plus additional commands only available for the enhanced client. The enhanced client is also available for Ubuntu. If you install it in Ubuntu using APT, the tnftp client will replace the FTP client (in /etc/alternatives). In Cygwin, you could create a logical link to tnftp if you can't get out of the habit of typing "ftp" every time you want to interact with an FTP client.
Installing tnftp from source
Installing tnftp in Windows 7 however, seemed to require compiling the package from source. This requires quite a bit of effort but is well worth the effort.
In order to install from source in Cygwin, run the appropriate setup command from the windows command line and choose the tnftp source (you should find it in Net)
After I'd done this I found some documentation in the folder: /usr/share/doc/Cygwin. This included instructions for building the package.
According to this I looked in /usr/src for the source code. I installed gcc and make --- Since this would always be the most basic requirement for compiling packages. Getting it to work was trial and error --- I ended up installing quilt, lndir, expat-devel, libncurses-devel, OpenSSL and openssl-devel (from Net). Although it may not have been necessary to install all these.
Initially I tried to build it with the script in /usr/src:
cd /usr/src ./tnftp-20130505-1.sh all
This seemed to get through the compilation but failed on the install. I Finally resorted to the old reliable:
cd tnftp-20130505-1 ./configure make make install