[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webmin-l
Subject:    Re: [webmin-l] Problems with passing $REMOTE_USER
From:       "Johnson, James A" <J1Johnson () unum ! com>
Date:       2013-06-14 16:19:11
Message-ID: C5EDBA0CCEC63845846E5B669FE51486B89FC1F413 () MERCURY ! up ! corp ! upc
[Download RAW message or body]

[Attachment #2 (text/plain)]

That was it. As soon as I unchecked that it worked fine.

Thank you!

- Jim

From: Jamie Cameron [mailto:jcameron@webmin.com]
Sent: Friday, June 14, 2013 12:13 PM
To: Webmin users list
Subject: Re: [webmin-l] Problems with passing $REMOTE_USER


How about the "Use user's environment?" box .. do you have that checked?

On 14/Jun/2013 04:17 Johnson, James A <J1Johnson@unum.com<mailto:J1Johnson@unum.com>> \
wrote .. That command does not work either and the option you mention is not set. \
                I've tried it in firefox as well as IE and it just comes back blank.
- Jim
From: Jamie Cameron [mailto:jcameron@webmin.com]
Sent: Thursday, June 13, 2013 5:57 PM
To: Webmin users list
Subject: Re: [webmin-l] Problems with passing $REMOTE_USER

If you create a trivial command that just runs :

echo $REMOTE_USER

does that work? Also, do you have the "Clear environment variables?" option set for \
the command?

On 13/Jun/2013 09:12 Johnson, James A \
<J1Johnson@unum.com<reply_mail.cgi?new=1&to=J1Johnson%40unum%2Ecom>> wrote .. Hi \
Jamie, This is in the custom commands module.
- Jim
From: Jamie Cameron [mailto:jcameron@webmin.com<reply_mail.cgi?new=1&to=jcameron%40webmin%2Ecom>]
                
Sent: Thursday, June 13, 2013 11:37 AM
To: Webmin users list
Subject: Re: [webmin-l] Problems with passing $REMOTE_USER
Are you using the Custom Commands module to execute this script, or something else \
like the Command Shell module?

On Jun 12, 2013, at 7:36 PM, Brian Bouchard <bbouchard@llbean.com<_unsafe_link_>> \
wrote: James –
You should be able to use $REMOTE_USER in the command that is being executed in \
Webmin  I've done this in USermin. I assume it's the same in Webmin. So, in the the \
                webmin command configuration for the command I you would put:
/home/user/scripts/id-test.sh $REMOTE_USER
Then, in your script, you would have USER=$1  (or whatever the syntax is in bash to \
get the first argument) Like I said, I've done this in Usermin, but it should work \
                similarly in Webmin.
-LLBrian
From: Johnson, James A [mailto:J1Johnson@unum.com<_unsafe_link_>]
Sent: Wednesday, June 12, 2013 9:55 PM
To: webadmin-list@lists.sourceforge.net<_unsafe_link_>
Subject: [webmin-l] Problems with passing $REMOTE_USER
I'm trying to execute a bash script through webmin and have the current webmin users \
login name be passed to the script. I've googled a bit and found that $REMOTE_USER is \
the environmental variable that should pass that information to the script but it's \
not working. Here's the script:
#!/bin/bash
USER=$REMOTE_USER
echo ""
echo "The user executing this script is $USER"
echo ""
exit 0;
The result when I execute the script is:
Output from ssh -l user linuxserver /home/user/scripts/id-test.sh ..
Authentication successful.
The user executing this script is
I feel pretty stupid that I can't make this work. I've also tried running the script \
like this: ssh -l user linuxserver /home/user/scripts/id-test.sh $REMOTE_USER
And having the script read in $1 but it's still not passing.
Any assistance would be appreciated … thanks!
- Jim
------------------------------------------------------------------------------
This SF.net<http://SF.net> email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
-
Forwarded by the Webmin mailing list at \
webadmin-list@lists.sourceforge.net<_unsafe_link_> To remove yourself from this list, \
go to http://lists.sourceforge.net/lists/listinfo/webadmin-list


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
span.EmailStyle19
	{mso-style-type:personal-reply;
	font-family:"Verdana","sans-serif";
	color:#1F497D;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>That was \
it. As soon as I unchecked that it worked fine.<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Thank \
you!<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>- \
Jim<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div \
style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal><b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jamie Cameron \
[mailto:jcameron@webmin.com] <br><b>Sent:</b> Friday, June 14, 2013 12:13 \
PM<br><b>To:</b> Webmin users list<br><b>Subject:</b> Re: [webmin-l] Problems with \
passing $REMOTE_USER<o:p></o:p></span></p></div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p>How about the &quot;<span \
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#393939;background:whitesmoke'>Use \
user's environment?&quot; box .. do you have that checked?</span> \
<o:p></o:p></p><p>On 14/Jun/2013 04:17 Johnson, James A &lt;<a \
href="mailto:J1Johnson@unum.com">J1Johnson@unum.com</a>&gt; wrote .. \
<o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>That \
command does not work either and the option you mention is not set. I've tried it in \
firefox as well as IE and it just comes back blank.</span><o:p></o:p></p><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>- \
Jim</span><o:p></o:p></p><div style='border:none;border-top:solid #B5C4DF \
1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jamie Cameron [<a \
href="mailto:jcameron@webmin.com">mailto:jcameron@webmin.com</a>] <br><strong><span \
style='font-family:"Tahoma","sans-serif"'>Sent:</span></strong> Thursday, June 13, \
2013 5:57 PM<br><strong><span \
style='font-family:"Tahoma","sans-serif"'>To:</span></strong> Webmin users \
list<br><strong><span \
style='font-family:"Tahoma","sans-serif"'>Subject:</span></strong> Re: [webmin-l] \
Problems with passing $REMOTE_USER</span><o:p></o:p></p></div><p>If you create a \
trivial command that just runs :<br><br>echo $REMOTE_USER<br><br>does that work? \
Also, do you have the &quot;Clear environment variables?&quot; option set for the \
command?<o:p></o:p></p><p>On 13/Jun/2013 09:12 Johnson, James A &lt;<a \
href="reply_mail.cgi?new=1&amp;to=J1Johnson%40unum%2Ecom">J1Johnson@unum.com</a>&gt; \
wrote .. <o:p></o:p></p><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Hi \
Jamie,</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>This is in \
the custom commands module.</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>- \
Jim</span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF \
1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jamie Cameron [<a \
href="reply_mail.cgi?new=1&amp;to=jcameron%40webmin%2Ecom">mailto:jcameron@webmin.com</a>] \
<br><strong><span style='font-family:"Tahoma","sans-serif"'>Sent:</span></strong> \
Thursday, June 13, 2013 11:37 AM<br><strong><span \
style='font-family:"Tahoma","sans-serif"'>To:</span></strong> Webmin users \
list<br><strong><span \
style='font-family:"Tahoma","sans-serif"'>Subject:</span></strong> Re: [webmin-l] \
Problems with passing $REMOTE_USER</span><o:p></o:p></p></div></div><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Are you using \
the Custom Commands module to execute this script, or something else like the Command \
Shell module?<br><br>On Jun 12, 2013, at 7:36 PM, Brian Bouchard &lt;<a \
href="_unsafe_link_">bbouchard@llbean.com</a>&gt; \
wrote:<o:p></o:p></p></div><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>James – \
</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>You should \
be able to use $REMOTE_USER in the command that is being executed in Webmin&nbsp; \
I've done this in USermin. I assume it's the same in Webmin.&nbsp; \
</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So, in the \
the webmin command configuration for the command I you would \
put:</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Courier \
New";color:#943634'>/home/user/scripts/id-test.sh \
$REMOTE_USER</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Then, in \
your script, you would have USER=$1&nbsp; (or whatever the syntax is in bash to get \
the first argument)</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Like I \
said, I've done this in Usermin, but it should work similarly in \
Webmin.</span><o:p></o:p></p><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>-LLBrian</span><o:p></o:p></p><div><div \
style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></strong><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Johnson, James A [<a \
href="_unsafe_link_">mailto:J1Johnson@unum.com</a>] <br><strong><span \
style='font-family:"Tahoma","sans-serif"'>Sent:</span></strong> Wednesday, June 12, \
2013 9:55 PM<br><strong><span \
style='font-family:"Tahoma","sans-serif"'>To:</span></strong> <a \
href="_unsafe_link_">webadmin-list@lists.sourceforge.net</a><br><strong><span \
style='font-family:"Tahoma","sans-serif"'>Subject:</span></strong> [webmin-l] \
Problems with passing $REMOTE_USER</span><o:p></o:p></p></div></div><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>I'm trying to execute a \
bash script through webmin and have the current webmin users login name be passed to \
the script. I've googled a bit and found that $REMOTE_USER is the environmental \
variable that should pass that information to the script but it's not \
working.</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Here's the \
script:</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>#!/bin/bash</span><o:p></o:p></p></div><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>USER=$REMOTE_USER</span><o:p></o:p></p></div><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>echo \
&quot;&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>echo \
&quot;The user executing this script is \
$USER&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>echo \
&quot;&quot;</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#7030A0'>exit \
0;</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>The result when I execute \
the script is:</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='color:#943634'>Output from </span><span \
style='font-size:10.0pt;font-family:"Courier New";color:#943634'>ssh -l user \
linuxserver /home/user/scripts/id-test.sh</span><span style='color:#943634'> .. \
</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Courier New";color:#943634'>Authentication \
successful.</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Courier New";color:#943634'>The user executing \
this script is </span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>I feel pretty stupid that \
I can't make this work. I've also tried running the script like \
this:</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Courier New";color:#943634'>ssh -l user \
linuxserver /home/user/scripts/id-test.sh \
$REMOTE_USER</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>And having the script \
read in $1 but it's still not passing.</span><o:p></o:p></p></div><div><p \
class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Any assistance would be \
appreciated … thanks!</span><o:p></o:p></p></div><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span \
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>- \
Jim</span><o:p></o:p></p></div></div></blockquote><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>------------------------------------------------------------------------------<br>This \
<a href="http://SF.net">SF.net</a> email is sponsored by Windows:<br><br>Build for \
Windows Store.<br><br><a \
href="http://p.sf.net/sfu/windows-dev2dev">http://p.sf.net/sfu/windows-dev2dev</a><o:p></o:p></p></div></blockquote><blockquote \
style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal \
style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-<br>Forwarded by the \
Webmin mailing list at <a \
href="_unsafe_link_">webadmin-list@lists.sourceforge.net</a><br>To remove yourself \
from this list, go to<br><a \
href="http://lists.sourceforge.net/lists/listinfo/webadmin-list">http://lists.sourcefo \
rge.net/lists/listinfo/webadmin-list</a><o:p></o:p></p></div></blockquote></div></blockquote></div></blockquote><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>


[Attachment #4 (--===============3606814038597074949==)]
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

-
Forwarded by the Webmin mailing list at webadmin-list@lists.sourceforge.net
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic