Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 000581.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
11
12    <title>Status for Andrew DeFaria: gpdb_add_project.pl using gpdb user and Nice</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/000579.html" title="Improved gpdp_add_project" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/000582.html" title="PerlDB Tips" />
17
18    
19
20    
21
22    <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
23 </head>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
25    <div id="container">
26       <div id="container-inner" class="pkg">
27
28          <div id="banner">
29             <div id="banner-inner" class="pkg">
30                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31                <h2 id="banner-description">Searchable status reports and work log</h2>
32             </div>
33          </div>
34
35          <div id="pagebody">
36             <div id="pagebody-inner" class="pkg">
37                <div id="alpha">
38                   <div id="alpha-inner" class="pkg">
39
40                      <p class="content-nav">
41                         <a href="http://defaria.com/blogs/Status/archives/000579.html">&laquo; Improved gpdp_add_project</a> |
42                         <a href="http://defaria.com/blogs/Status/">Main</a>
43                         | <a href="http://defaria.com/blogs/Status/archives/000582.html">PerlDB Tips &raquo;</a>
44                      </p>
45
46                      <a id="a000581"></a>
47                      <div class="entry" id="entry-581">
48                         <h3 class="entry-header">gpdb_add_project.pl using gpdb user and Nice</h3>
49                         <div class="entry-content">
50                            <div class="entry-body">
51                               <ul>
52   <li>Attempted to integrate Rexec into gpdb_add_project.pl and have it talk to Nice</li>
53
54   <li>Looked into problem with Cygwin, Samba and ssh</li>
55 </ul>
56                            </div>
57                            <div id="more" class="entry-more">
58                               <h3>Rexec, gpdb_add_project.pl and Nice</h3>
59
60 <p>I've been making some slow but steady progress with gpdb_add_project.pl. I've:</p>
61
62 <ul>
63   <li>Implemented an Rexec Perl module that allows better access to remote sites. It does this by attempting ssh then rsh and finally telnet in an attempt to contact the remote site. It's object oriented and allows you to repeatedly execute remote commands without having to repeatedly login. Finally it can take a different username than the person running the script.</li>
64
65   <li>David then got me set up with a generic gpdb user for the Dallas and Nice sites.</li>
66 </ul>
67
68 <p>In attempting to use the new generic gpdb user I encountered a few problems. The biggest difference isg pdb user is tcsh (and csh I think) oriented whereas the Rexec module assumes a Borne/Ksh/Bash orientation. This has caused a number of problems:</p>
69
70 <ol>
71   <li>When logging onto the system the prompt is different (csh style shells use "%")</li>
72
73   <li>When logging onto the Nice site not only is the prompt different but it contains special characters. It uses embedded escape sequences that colorize the prompt. Rexec needs to find the prompt so it knows when it can send commands. Needless to say this si problematic forRexec. For now I set the prompt for gpdb@Nice to simply "% ", which  works.</li>
74
75   <li>Some of the commands that gpdb_add_project.pl issues are decidedly Borne shell oriented. For example, it uses 2&gt;&amp;1 to combine stdout and stderr. This syntax is not valid under csh style shells. Additionally, Rexec would wrap commands in an "echo start; &lt;cmd&gt;; echo errono=$?" in order to obtain the return status of the remotely executed command. The $? variable is not available in csh style shells. So I added a shellstyle parameter to Rexec to handle these differences (though that doesn't fix #2).</li>
76 </ol>
77
78 <p>One way around all of these problems is to require generic service
79 level accounts such as gpdb to run the default Borne shell (/bin/sh).</p>
80
81 <p>Next, and forgive me since my NIS is a bit rusty, but gpdb_add_project.pl would attempt to get certain NIS maps for remote sites that use NIS (it is also NIS+ aware/sensitive). In doing so it does an ls -1 /etc then looks for files such as auto_master. It then cat's auto_master and looks for lines that have "+auto" or "data" in them. It then uses that as a key file for ypcat as in ypcat -k auto_master.</p>
82
83 <p>Now @Nice (svrscity01.tif.ti.com) it finds:</p>
84
85 <div class=code><pre>
86 % cat /etc/auto_master
87 # Master map for automounter
88 #
89 +auto_master
90 /xfn -xfn
91 /net -hosts      -intr,rw,grpid
92 </pre></div>
93
94 <p>So it then does ypcat -k auto_master which:</p>
95
96 <div class=code><pre>
97 % ypcat -k auto_master
98 no such map in server's domain
99 </pre></div>
100
101 <p>The following does work though:</p>
102
103 <div class=code><pre>
104 % ypcat -k auto.master
105 /clearcase auto.clearcase
106 /home_drp auto.home_drp -intr,ro
107 /apps_drp auto.apps_drp -intr,ro
108 /db_drp auto.db_drp -intr,ro
109 /user auto.user -intr,rw,grpid
110 /tool auto.tool -intr,rw,grpid,noquota,noatime
111 /home auto.home -intr,rw,grpid
112 /apps auto.tool -intr,rw,grpid,noquota,noatime
113 /xfn -xfn -noquota
114 /sim auto.sim
115 /net -hosts -intr,rw,grpid,noquota
116 /db auto.db
117 /u auto.tool -intr,rw,grpid,noquota
118 </pre></div>
119
120 <p>It appears to be trying to find the auto_data map, of which there are none, and then will look for "sync_custom" in there. As such I don't see how this ever worked at Nice.</p>
121
122 <p>Thoughts? Pointers?</p>
123
124 <h3>Cygwin, Samba and ssh</h3>
125
126 <p>Here's the story. I use Cygwin on my XP desktop. I like having a home directory on Windows that is the same home directory on Unix/Linux machines. Often companies offer access to your Unix/Linux home directory via Samba. Also, often companies do not bother to set up a Samba server wish participates in a domain, so the Samba server is configured as being in a workgroup.</p>
127
128 <p>Now for a long time I struggled with this. I would map //&lt;samba server&gt;/&lt;home share&gt; -&gt; my H drive then mount the H drive as /home and make sure my Cygwin /etc/password referred to my home directory of /home/$USER. All is great.</p>
129
130 <p>But when dealing with Samba servers who are configured into workgroups innocuous activities in Cygwin would elicit permission denied messages. For example, touching a file in the home directory and indeed even vi'ing a file, etc. Creating a file within Windows Explorer or using
131 other Windows oriented tools would work just fine. Files created on the Unix/Linux side would also work fine but when looked at from Cygwin on the PC would have odd (read "nobody") ownerships and permissions.</p>
132
133 <p>Of course as Cygwin is often not supported by the typical company's IT department and because many people do not attempt to utilize Cygwin fully often requests for assistance and change fell on deaf ears...</p>
134
135 <p>Eventually I figured out that my Windows SID in /etc/passwd is the SID of my domain user and since the Samba server was not in the domain my SID does not authenticate properly. Then I had a break through in that I realized that I was using SMBNTSEC as well as NTSEC in my Cygwin environment. I figured "Yeah I want to use the same Windows security for SMB mounted drives too". This is where my problem lies and it's because the Samba server configured by the client does not participate in the Windows domain from which I've logged in. </p>
136
137 <p>Now I'm pretty sure that Samba could be configured properly into a Windows domain as Samba can be configured as a PDC or a BDC, but many clients don't bother to go that far. So why is Windows able to deal with this but not Cygwin?</p>
138
139 <p>I believe that this is because within Samba a very basic approach is kept towards storing of user identification information. Indeed basic Samba just has an smbpasswd file which is much like your typical Unix/Linux /etc/passwd file and it is not designed to carry extra information about users and machine accounts as well as multiple groups and trust associations, etc. Even Samba documents talks about hooking Samba up to either LDAP or what they call a Trivial DataBase (TDB) in order to store such additional Windows only information.</p>
140
141 <p>So I thought the simple solution was to remove SMBNTSEC from my Cygwin environment and all would be fine. And indeed it is! Well almost...</p>
142
143 <p>Along comes ssh... So I like to use ssh to log into various Unix/Linux systems as I work. And again I share my home directory between Windows and Unix/Linux. Finally I like setting up passwordless public key ssh login as I'm not one of those who likes having to type in his password hundreds of times a day. But ssh's is picky about permissions of your ~/.ssh and ~/.ssh/id_&lt;type&gt; key files. When ssh'ing from Cygwin to a Unix/Linux box I am now receiving the following:</p>
144
145 <div class=code><pre>
146 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
147 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
148 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
149 Permissions 0644 for '/home/x0062320/.ssh/id_rsa' are too open.
150 It is recommended that your private key files are NOT accessible by others.
151 This private key will be ignored.
152 bad permissions: ignore key: /home/x0062320/.ssh/id_rsa
153 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
154 @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
155 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
156 Permissions 0644 for '/home/x0062320/.ssh/id_dsa' are too open.
157 It is recommended that your private key files are NOT accessible by others.
158 This private key will be ignored.
159 bad permissions: ignore key: /home/x0062320/.ssh/id_dsa
160 x0062320@stashu's password:
161 </pre></div>
162
163 <p>And, of course, I need to type in my password again! What I believe is happening is that because my home directory is SMB mounted and SMBNTSEC is off then Cygwin reports that files like ~/.ssh/id_rsa are 0644 even if I change them on Unix/Linux to 0600. So, for example:</p>
164
165 <div class=code><pre>
166 &lt;unix box&gt;$ ls -l ~/.ssh/id_rsa
167 -rw-------  1 x0062320 generic 887 Aug 31 16:43 /home/x0062320/.ssh/id_rsa
168 </pre></div>
169
170 <p>While:</p>
171
172 <div class=code><pre>
173 &lt;cygwin&gt;$ ls -l ~/.ssh/id_rsa
174 -rw-r--r-- 1 x0062320 Domain Users 887 Aug 31 16:43 /home/x0062320/.ssh/id_rsa
175 </pre></div>
176
177 <p>Is there any way to work around this problem (short of reconfiguring the Samba server)?</p>
178                            </div>
179                         </div>
180                         <p class="entry-footer">
181                            <span class="post-footers">Posted by  on October 13, 2006  5:31 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000581.html">Permalink</a>
182                         </p>
183                      </div>
184
185                      
186
187                      
188                   </div>
189                </div>
190             </div>
191          </div>
192       </div>
193    </div>
194 </body>
195 </html>