in reply to Re: Testing the creation of new files over SSH connection
in thread Testing the creation of new files over SSH connection
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