in reply to Re: Net::SSH::Perl and su
in thread Net::SSH::Perl and su

FWIW, I'm still getting STDIN/tty errors to $err, but it is running interactively and asking for my password. It appears to be a limitation of su, requiring local tty control(?). There are others here who would be better qualified to answer that one. I have no problem running non-su commands, though. Good Luck!

 

I think the best solution for mikfire with this problem would be to investigate the use of sudo - This command allows administrators to grant permissions to users to execute priviledged commands without having to su to root. The advantage with this command offers in this scenario however is that, when configured as such, it allows priviledged commands to be executed by users without prompting for a password.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Replies are listed 'Best First'.
Re: Re: Re: Net::SSH::Perl and su
by hossman (Prior) on Mar 08, 2002 at 23:52 UTC
    something I really don't get is:
    "Why ssh to a remote machine (as a regular user), THEN su to root?"
    Assuming the user is "hossman" on both machines, you're doing this...
        hossman@client =ssh=> hossman@server =su=> root@server
    

    Why not do this instead...

        hossman@client =ssh=> root@server
    

    (sudo is nice because it eliminates the need for hossman to know the root password on server, but the same thing could be accomplished using ssh keys.)

      "Why ssh to a remote machine (as a regular user), THEN su to root?"

      Because many ssh servers block direct root logins, so you need at least two passwords to get a root shell. (in general)

      44696420796F7520732F2F2F65206F
      7220756E7061636B3F202F6D736720
      6D6521203A29202D2D204A75657264
      

      Root user not allowed to log in directly. You only log in as regular user then su to root.
Re: Re: Re: Net::SSH::Perl and su
by mikfire (Deacon) on Mar 09, 2002 at 01:42 UTC
    Alas, if only it were that easy. I can't use sudo for two main reason. First, the command I want to run is going to change. Second, due to some serious security concerns, there is no way I could convince them to allow me to use the NOPASSWD option in sudo.

    mikfire

      ... due to some serious security concerns, there is no way I could convince them to allow me to use the NOPASSWD option in sudo.

       

      To my mind, it is of greater concern that fact that you are looking to store the root and a user password into a remote script. All one would have to to is view the source of your script and they would have both a login and the root account on the remote system - A restricted shell with sudo access rights to a small selection of administrative commands would be a better choice to my mind by far.

       

      perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'