<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Shell Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900971#M820605</link>
    <description>Hello, &lt;BR /&gt;&lt;BR /&gt;I'm writing a script to automate some tasks on the network. The problem that I came a cross is that I don't know how to open /etc/passwd file, edit the line, saved and exit. &lt;BR /&gt;What I would like to do is the next: &lt;BR /&gt;our PDC is on HP-UX 11.00. &lt;BR /&gt;In order for the workstation to join domain, it has to have $ in the end of the name e.g. &lt;BR /&gt;wsat1210$:*:125:102:MVRMachine:/dev/null:/bin/false &lt;BR /&gt;&lt;BR /&gt;This is not a standard characters for the password file, so I can't do that via SAM. &lt;BR /&gt;&lt;BR /&gt;I know that there is the command to open file for editing, but I didn't have too much luck doing it. &lt;BR /&gt;&lt;BR /&gt;Thank you &lt;BR /&gt;Miro &lt;BR /&gt;</description>
    <pubDate>Mon, 10 Feb 2003 17:34:20 GMT</pubDate>
    <dc:creator>mvr</dc:creator>
    <dc:date>2003-02-10T17:34:20Z</dc:date>
    <item>
      <title>Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900971#M820605</link>
      <description>Hello, &lt;BR /&gt;&lt;BR /&gt;I'm writing a script to automate some tasks on the network. The problem that I came a cross is that I don't know how to open /etc/passwd file, edit the line, saved and exit. &lt;BR /&gt;What I would like to do is the next: &lt;BR /&gt;our PDC is on HP-UX 11.00. &lt;BR /&gt;In order for the workstation to join domain, it has to have $ in the end of the name e.g. &lt;BR /&gt;wsat1210$:*:125:102:MVRMachine:/dev/null:/bin/false &lt;BR /&gt;&lt;BR /&gt;This is not a standard characters for the password file, so I can't do that via SAM. &lt;BR /&gt;&lt;BR /&gt;I know that there is the command to open file for editing, but I didn't have too much luck doing it. &lt;BR /&gt;&lt;BR /&gt;Thank you &lt;BR /&gt;Miro &lt;BR /&gt;</description>
      <pubDate>Mon, 10 Feb 2003 17:34:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900971#M820605</guid>
      <dc:creator>mvr</dc:creator>
      <dc:date>2003-02-10T17:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900972#M820606</link>
      <description>This doesn't sound like a terribly good idea to begin with, but its your system.  In Unix, you can do almost anything, including hack the password file.  Easiest would be to use sed.&lt;BR /&gt;sed 's/wsat1210/wsat1210$/' /etc/passwd&amp;gt;/tmp/somefile&lt;BR /&gt;mv /tmp/somefile /etc/passwd&lt;BR /&gt;&lt;BR /&gt;This uses the 'swap' command to exchange "wsat1210" with "wsat1210$", and copies the result into a temporary file.  The second command copies the temporary file over the original.  It would be an EXCELLENT idea to make a backup copy of your password file before attempting this.  &lt;BR /&gt;&lt;BR /&gt;Good Luck&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 10 Feb 2003 17:45:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900972#M820606</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-02-10T17:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900973#M820607</link>
      <description>Many potential problems can occur with the kind of changes you're attempting to do.&lt;BR /&gt;&lt;BR /&gt;But, to make a change to any file, many tools exist. Some of the more popular are "perl", "awk", and "sed".&lt;BR /&gt;&lt;BR /&gt;Using "sed" you could do the following (again editting the /etc/passwd file could have unexpected results, especially on a "trusted" system) -&lt;BR /&gt;&lt;BR /&gt;sed -e 's/^wsat1210:/wsat1210$:/' /etc/passwd2&lt;BR /&gt;mv /etc/passwd /etc/passwd.orig&lt;BR /&gt;mv /etc/passwd2 /etc/passwd&lt;BR /&gt;&lt;BR /&gt;Good Luck (be sure you have good backups...)&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 10 Feb 2003 17:46:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900973#M820607</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-02-10T17:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900974#M820608</link>
      <description>&lt;BR /&gt;Are you confusing workstation name with username ??? ==&amp;gt; "In order for the workstation to join domain"&lt;BR /&gt;&lt;BR /&gt;What kind of "domain" requires a $ at the end of a users name?&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 10 Feb 2003 18:04:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900974#M820608</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-02-10T18:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900975#M820609</link>
      <description>This is for Harry Brown. Hi - you require such usernames suffixed with a $ when you have your unix box acting as a pdc for a windows domain, with samba running.&lt;BR /&gt;&lt;BR /&gt;As for you Miro i have nothing much to add over the info the others have posted.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Ramkumar.</description>
      <pubDate>Tue, 11 Feb 2003 06:26:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900975#M820609</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-02-11T06:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900976#M820610</link>
      <description>Hi Miro,&lt;BR /&gt;&lt;BR /&gt;I guess you do know $user ??&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;userline=`/usr/bin/cat /etc/passwd | grep "^${user}:"`&lt;BR /&gt;&lt;BR /&gt;/usr/bin/cat | grep -v "^${user}:" &amp;gt;/etc/passwd.mv&lt;BR /&gt;&lt;BR /&gt;user="${user}\$"&lt;BR /&gt;userline=`echo $userline | awk -F: '{print $2 ":" $3 ":" $4 ":" $5 ":" $6 ":" $7}'`&lt;BR /&gt;userline="${user}:${userline}"&lt;BR /&gt;&lt;BR /&gt;echo "$userline"&amp;gt;&amp;gt;/etc/passwd.mv&lt;BR /&gt;rt=`/usr/bin/diff /etc/passwd /etc/passwd.mv`&lt;BR /&gt;&lt;BR /&gt;if [ "$rt" &amp;lt; "5" ]&lt;BR /&gt;  then&lt;BR /&gt;    mv /etc/passwd.mv /etc/passwd&lt;BR /&gt;  else &lt;BR /&gt;    /usr/bin/logger -p user.warning "$0: Error in addapting user !!"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I prefer perl for doing things like this, but he. You have to be able to understand perl for that. And as you can see I'm not very good at writing shell-scripts.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Tue, 11 Feb 2003 07:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900976#M820610</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-02-11T07:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900977#M820611</link>
      <description>Hi Miro,&lt;BR /&gt;&lt;BR /&gt;Try the following lines:&lt;BR /&gt;awk 'BEGIN { FS = ":"; OFS = ":"} {$1=$1"$"; print $0}??? /../yourfile &amp;gt; file1&lt;BR /&gt;mv file1 /../yourfile&lt;BR /&gt;&lt;BR /&gt;Hope this help you!!!&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Sylvia&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Feb 2003 10:26:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900977#M820611</guid>
      <dc:creator>Sylvia Nikolova</dc:creator>
      <dc:date>2003-02-11T10:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900978#M820612</link>
      <description>Thank you all for the comments as well as help. I know that is not the best idea to do this with password file, but I have to. In our environment in order to add a new user and the new workstation in to domain we need 6 steps. Most of the time there is confusion what need to be done firs and the way to do it. On this way it will be strait forward and hopefully no problems.&lt;BR /&gt;&lt;BR /&gt;Miro</description>
      <pubDate>Tue, 11 Feb 2003 12:57:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900978#M820612</guid>
      <dc:creator>mvr</dc:creator>
      <dc:date>2003-02-11T12:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900979#M820613</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Lots of neat solutions.  Here is a real easy one.  Use the 'useradd' command as root and you can specify a '$' in the user ID.  Like this:&lt;BR /&gt;&lt;BR /&gt;useradd -u 50001 -g users -d /home/users/testjp "testjp$"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This gives me this entry in /etc/passwd:&lt;BR /&gt;&lt;BR /&gt;testjp$:*:50001:20::/home/users/testjp:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;Of course, you'll still have to set the password but you can use the 'passwd' command to set the password discipline, requiring a change at the first login.&lt;BR /&gt;&lt;BR /&gt;Just one way to do it.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Feb 2003 14:34:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900979#M820613</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-02-11T14:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900980#M820614</link>
      <description>If you want to add the '$' to an existing account on the system, you can use the 'usermod' command, like this:&lt;BR /&gt;&lt;BR /&gt;# tail -1 /etc/passwd           &lt;BR /&gt;testjp:*:50001:20::/home/users/testjp:/sbin/sh &lt;BR /&gt;&lt;BR /&gt;# usermod -l "testjp$" testjp   &lt;BR /&gt;# tail -1 /etc/passwd           &lt;BR /&gt;testjp$:*:50001:20::/home/users/testjp:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Feb 2003 14:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900980#M820614</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-02-11T14:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900981#M820615</link>
      <description>Hi there, &lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/tcsh&lt;BR /&gt;# SCRIPT&lt;BR /&gt;&lt;BR /&gt;      set numPassLines = (`grep -c ":" passwd`) &lt;BR /&gt;      @ i = 1&lt;BR /&gt;      while ( $i &amp;lt;= $numPassLines )&lt;BR /&gt;        echo $ &amp;gt;&amp;gt; passwd&lt;BR /&gt;        echo -n "Gx"  &amp;gt;&amp;gt; temp_vi_cmd  &lt;BR /&gt;        echo -n "$i"  &amp;gt;&amp;gt; temp_vi_cmd  &lt;BR /&gt;        echo -n "G"  &amp;gt;&amp;gt; temp_vi_cmd  &lt;BR /&gt;        echo "wP"     &amp;gt;&amp;gt; temp_vi_cmd&lt;BR /&gt;        echo "ZZ"     &amp;gt;&amp;gt; temp_vi_cmd&lt;BR /&gt;        (vi  passwd    &amp;lt;  temp_vi_cmd) &amp;gt;&amp;gt; &amp;amp; temp&lt;BR /&gt;        rm -f temp temp_vi_cmd &lt;BR /&gt;        @ i ++ &lt;BR /&gt;      end  &lt;BR /&gt;        unset numPassLines</description>
      <pubDate>Tue, 11 Feb 2003 19:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting/m-p/2900981#M820615</guid>
      <dc:creator>Cody Godines_1</dc:creator>
      <dc:date>2003-02-11T19:42:37Z</dc:date>
    </item>
  </channel>
</rss>

