<?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 Re: Setting variable for remote ssh connection. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906222#M405124</link>
    <description>Ankur,&lt;BR /&gt;according to what I tested on my servers you can get rid of the single quotes and you are all set.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;Devesh&lt;BR /&gt;</description>
    <pubDate>Wed, 08 Jun 2005 23:39:05 GMT</pubDate>
    <dc:creator>Devesh Pant_1</dc:creator>
    <dc:date>2005-06-08T23:39:05Z</dc:date>
    <item>
      <title>Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906213#M405115</link>
      <description>Hi friends,&lt;BR /&gt;Need help in executing the following.&lt;BR /&gt;&lt;BR /&gt;i=server_name&lt;BR /&gt;group=sysadmin&lt;BR /&gt;&lt;BR /&gt;ssh $i 'useradd  -g $group  -d /opt/home/x32810 -f 30 -s /bin/sh -c test  -m x32810'&lt;BR /&gt;&lt;BR /&gt;This is result i get.&lt;BR /&gt;Group -d specified with -g does not exist&lt;BR /&gt;&lt;BR /&gt;pls. help&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2005 05:57:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906213#M405115</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-06-08T05:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906214#M405116</link>
      <description>You need to make sure that group 'sysadmin' exists in machine 'server_name'&lt;BR /&gt;&lt;BR /&gt;ssh $i 'cat /etc/group|cut -f 1 -d :|grep sysadmin'&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 08 Jun 2005 06:07:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906214#M405116</guid>
      <dc:creator>Suraj Singh_1</dc:creator>
      <dc:date>2005-06-08T06:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906215#M405117</link>
      <description>Is sysadmin group existing in server_name machine? check with /etc/group file.&lt;BR /&gt;&lt;BR /&gt;Is group name getting effect in remote machine? Try to check it as,&lt;BR /&gt;ssh $i 'echo $group'&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 08 Jun 2005 06:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906215#M405117</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-08T06:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906216#M405118</link>
      <description>Thanks friends for replying, &lt;BR /&gt;Actually the problem is with the passing of  variable.&lt;BR /&gt;i need to know if the single quote is enough to pass $grp variable.&lt;BR /&gt;ssh $i 'useradd -g $group -d /opt/home/x32810 -f 30 -s /bin/sh -c test -m x32810'&lt;BR /&gt;Group -d specified with -g does not exist&lt;BR /&gt;&lt;BR /&gt;Its is not takin the $group variable&lt;BR /&gt;&lt;BR /&gt;waitin &lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Wed, 08 Jun 2005 06:27:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906216#M405118</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-06-08T06:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906217#M405119</link>
      <description>Yes. It won't. Bcas local varibles will not be identified by remote machine. Even though if you try locally, that shell will not identify this.&lt;BR /&gt;&lt;BR /&gt;You can do one thing as, &lt;BR /&gt;&lt;BR /&gt;put group=sysamin in /etc/sshrc remote machine or $HOME/.ssh/rc file.&lt;BR /&gt;&lt;BR /&gt;It will work.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 08 Jun 2005 06:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906217#M405119</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-08T06:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906218#M405120</link>
      <description>hi ,&lt;BR /&gt; &lt;BR /&gt;i m doin this to create users and groups remotely from one server to another.&lt;BR /&gt;So need to use variables for groups and users.&lt;BR /&gt;&lt;BR /&gt;rgd&lt;BR /&gt;Ankur</description>
      <pubDate>Wed, 08 Jun 2005 07:02:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906218#M405120</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-06-08T07:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906219#M405121</link>
      <description>Oh my god, people, this is simple shell expansion!&lt;BR /&gt;&lt;BR /&gt;The reason $group isn't getting sent is because  you have single quotes around the command line.  In this case, you actually don't even need quotes but if you want them, use double quotes. The shell will then expand all variables and send the command to ${i}...&lt;BR /&gt;&lt;BR /&gt;You don't have to do any of the things the previous posts were mentioning...&lt;BR /&gt;&lt;BR /&gt;To script this whole thing, create a text file with contents like:&lt;BR /&gt;&lt;BR /&gt;host1 user1 group1&lt;BR /&gt;host1 user2 group1&lt;BR /&gt;host2 user3 group2&lt;BR /&gt;host2 user4 group2&lt;BR /&gt;host2 user5 group3&lt;BR /&gt;...&lt;BR /&gt;host# user# group#&lt;BR /&gt;&lt;BR /&gt;cat ${file} | while read host user group&lt;BR /&gt;do&lt;BR /&gt;ssh -l root ${host} /usr/sbin/useradd -g ${group} -d /opt/home/${user} -f 30 -s /bin/ksh -c test -m ${user}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH;&lt;BR /&gt;&lt;BR /&gt;Doug</description>
      <pubDate>Wed, 08 Jun 2005 07:32:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906219#M405121</guid>
      <dc:creator>Doug O'Leary</dc:creator>
      <dc:date>2005-06-08T07:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906220#M405122</link>
      <description>&lt;BR /&gt;you need to double quote the command line:&lt;BR /&gt;&lt;BR /&gt;ssh $i "useradd -g $group -d /opt/home/x32810 -f 30 -s /bin/sh -c test -m x32810"&lt;BR /&gt;&lt;BR /&gt;shell does not expand any variables if it is surrounded by single quote('). you should use double quote to expand them&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Gopi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2005 07:57:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906220#M405122</guid>
      <dc:creator>Gopi Sekar</dc:creator>
      <dc:date>2005-06-08T07:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906221#M405123</link>
      <description>Oh yes,&lt;BR /&gt;&lt;BR /&gt;You must use double quotes (") and not single quotes.&lt;BR /&gt;&lt;BR /&gt;Tested in one of my machines, and it works!!&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 08 Jun 2005 08:30:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906221#M405123</guid>
      <dc:creator>Suraj Singh_1</dc:creator>
      <dc:date>2005-06-08T08:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906222#M405124</link>
      <description>Ankur,&lt;BR /&gt;according to what I tested on my servers you can get rid of the single quotes and you are all set.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;Devesh&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2005 23:39:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906222#M405124</guid>
      <dc:creator>Devesh Pant_1</dc:creator>
      <dc:date>2005-06-08T23:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906223#M405125</link>
      <description>That worked friends.&lt;BR /&gt;Actually the double quotes of comment was also creating problems.&lt;BR /&gt;I m proud to be associated with this forum.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Thu, 09 Jun 2005 00:11:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906223#M405125</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-06-09T00:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable for remote ssh connection.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906224#M405126</link>
      <description>This is what works&lt;BR /&gt;ssh $i " useradd -u 400 -g ${grp}  -d /opt/home/x32810 -f 30 -s /bin/sh -c 'test user'  -m xtest "&lt;BR /&gt;&lt;BR /&gt;bye&lt;BR /&gt;Rgds&lt;BR /&gt;Ankur</description>
      <pubDate>Thu, 09 Jun 2005 00:12:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setting-variable-for-remote-ssh-connection/m-p/4906224#M405126</guid>
      <dc:creator>ankurp</dc:creator>
      <dc:date>2005-06-09T00:12:38Z</dc:date>
    </item>
  </channel>
</rss>

