in reply to Testing the creation of new files over SSH connection

Two basic approaches -

  1. Upload a cleanup script, say cleanup_tests.pl to reside on the target, and call it through ssh -2 user@target sudo cleanup.pl.
  2. Look at Expect, which can stand in for you in emulating a terminal session.

After Compline,
Zaxo

  • Comment on Re: Testing the creation of new files over SSH connection

Replies are listed 'Best First'.
Re^2: Testing the creation of new files over SSH connection
by idsfa (Vicar) on Jun 19, 2006 at 02:55 UTC

    With the caveat that option 1 will not work unless the remote sudoers file allows NOPASSWD on random uploaded scripts (definitely not recommended). Mildly less offensive is that your cleanup script contains the allowed sudo lines (again w/o a password). Of course, option two requires hard-coding passwords (equally icky).

    IMHO, the best option is to set up an ssh key for the user you need to log in as which can only execute a specific script. man sshd for details (link)


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon