[nfbcs] help requested with cygwin & ssh-
Joseph C. Lininger
devnull-nfbcs at pcdesk.net
Wed Mar 25 17:32:10 UTC 2015
I've quoted you below and answered your message at appropriate points.
> Hi Joseph, What you described is exactly what I am experiencing. I
> attempted to try the command you suggested and that appears to work
> for what ever reason.
It works because the way ssh-agent operates is that it creates a socket
which ssh-add and other programs must use to communicate with it. The
environment variables tell those other programs (and ssh-agent itself in
some situations) the running pid of ssh-agent and the socket to use.
Your solution of running a script in every shell instance will work, but
it has one major issue. You'll end up with multiple instances of
ssh-agent running. Those instances are not terminated when you exit the
cygwin bash shell. Look in the Windows task list if you want proof of
that. You have two choices for combatting that problem.
1. Run the command "ssh-agent -k" before you terminate your shell. That
will kill the agent process. This works as long as your shell doesn't
exit unexpectedly, and as long as you don't forget to type the command.
(Maybe put it in your .bash_logout?)
2. What I do is to have a script, just like you do. It runs ssh-agent,
and copies all but the first line of output (the one that echoes the
pid) into a file in my home directory called .ssh-agent. Then, in my
.profile, I have this little bit of code.
if [ -r "~/.ssh-agent ]; then
source .ssh-agent
fi
This causes all instances of the shell that I run to use the same agent
process. If the agent is kill (or the system restarts), it doesn't
matter because if the socket and suck are invalid, ssh will just not use
them. There are some minor potential issues, and I could probably code
around them, but I haven't bothered because I'm the only one using this
machine.
> A follow up question. As far as I know, there is no concept of root
> in cygwin. So if someone else logs onto my windows box with their own
> account and run the same cygwin executeable they will get their own
> home directory. If I create a read only file (chmod 400 <filename>)
> will the file permissions be enforced and only I will be able to read
> the file? in cygwin or as a windows file on the machine? Will an
> administrator on the windows
As for your permissions issue, cygwin and permissions can be a bit
tricky. My advice to you is to avoid the issue altogether by using cacls
or icacls to change the windows ACL directly. That way you don't have to
try to predict what the effect of a chmod will be.
Joe
More information about the NFBCS
mailing list