in reply to Re: Problem using Net::OpenSSH->capture to su to another user
in thread Problem using Net::OpenSSH->capture to su to another user
Hi Salva,
Thanks for your response.
Unfortunately when I try your code I get:
sudo: sorry, you must have a tty to run sudo
When I add:
tty => 1,
I get my original error back again:
muxserver_accept_control: tcgetattr: Invalid argument tcgetattr: Invalid argument
If I ssh to the remote server and manually issue some 'sudo su' commands I get output like the below:
loguser@enfcdb01 ~$ sudo su imail We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. sudo password for loguser: imail@enfcdb01 loguser$
So this works and I'm now able to operate as the imail user.
Using the '-c' option to su I get:
loguser@enfcdb01 ~$ sudo su -c "ls" imail ls: cannot open directory .: Permission denied
Trying the same using the 'pwd' command:
loguser@enfcdb01 ~$ sudo su -c "pwd" imail /home/loguser
This seems to just report the current working directory of the loguser user, i.e. it has not changed to the imail home directory (which is perhaps expected with the '-c' option to su?)
Any additional ideas on how I can get this to work?
Thanks,
Tim
|
|---|