View Full Version : [ubuntu] Issues with bash script over ssh

December 9th, 2010, 04:08 AM
Hello there,

I've been trying to set up guake to automatically open 2 programs in two different tabs via ssh on my remote server. I have succeeded in doing this, however whenever the last command is run the terminal tab locks up and i can't enter any input, the only command that works is ctrl+c to kill (in this case) iptraf.

I think it might be something to do with how i'm sending my ssh password using echo and pipe... can anyone help? this is my script:

#! /bin/bash
# script to launch multiple guake windows on Network21 local server
guake --rename-tab=Htop21 --execute-command="ssh -t 'htop'" &
sleep 5 &&
guake --new-tab=2 --rename-tab=Iptraf21 --execute-command="ssh -t 'echo password | sudo -S iptraf'" &

the first and second commands always work, whilst the last one loads iptraf then the cpu maxes out and i can't enter anything unless i kill the program. I've also tried nload and a couple of others, with the same results.


December 9th, 2010, 03:46 PM
I've changed the echo line to

echo -e password\n

still not working properly :S

December 9th, 2010, 03:50 PM
That's not the way to tell sudo what yer password is. It's "hung" cuz it's prompting for yer password in the background.

See here (https://help.ubuntu.com/community/RootSudo#Remove%20Password%20Prompt%20For%20sudo).

December 9th, 2010, 05:51 PM
Well it passes the password to sudo anyway because iptraf launches... however iptraf and any other program appear like its receiving many many key strokes and the cpu hits 100... this is the only way I can think of to pass my sudo password on the remote server

December 9th, 2010, 06:13 PM
Never mind, I've disabled sudo for my user...

December 9th, 2010, 06:18 PM
Never mind, I've disabled sudo for my user...

You can set it so that one program doesn't prompt for yer password if you use sudo with it.

Is that what you did?

December 9th, 2010, 08:39 PM
Yes, i set the following

%doyle ALL=(ALL) NOPASSWD: /bin/sh -c /usr/sbin/iptraf ""

Thanks for the help