<div><div class="gmail_quote">On Wed, Mar 3, 2010 at 3:36 PM, James Hogarth <span dir="ltr"><<a href="mailto:james.hogarth@gmail.com">james.hogarth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 3 March 2010 21:20, Tim Nelson <<a href="mailto:tnelson@rockbochs.com">tnelson@rockbochs.com</a>> wrote:<br>
> Greetings All-<br>
><br>
> I'm about to embark on some remote management testing and need a way to login to a remote system running CentOS 4.x/5.x via SSH, su to root (using a password), then execute a command.<br>
><br>
> I currently login to the boxes using key based SSH like this:<br>
><br>
> ssh -i ~/remote_key admin@$REMOTEIP<br>
><br>
> Then, I SU to root. However, if I try to do this automatically like this:<br>
><br>
> ssh -i ~/remote_key admin@$REMOTEIP 'su -l'<br>
><br>
> I'm getting:<br>
><br>
> "standard in must be a tty"<br>
><br>
> So, how am I able to remote login using SSH, su to root, then execute a command as root?<br>
><br>
> All comments and suggestions welcome. Thanks!<br>
><br>
> --Tim<br>
> _______________________________________________<br>
> CentOS mailing list<br>
> <a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>
> <a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
><br>
<br>
</div></div>Best off configuring sudo for that user (with no password) and make<br>
sure that user has !requiretty in the sudoers configuration.<br>
<font color="#888888"><br>
James<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a></div></div></blockquote><div><br></div><div>Does "ssh -t" help?</div><div><br></div>
<div>-- j </div></div><br></div>