0

I am trying to create a launcher for the left bar on ubuntu 11.10, I followed this answer, and it works, but I want to auto login into the SSH servers, so I tried using a command I have used before, something like:

expect -c 'spawn ssh root@111.222.333.444 ; expect assword ; send "password123\n" ; expect root@; send "unset HISTFILE\n" ; interact'

That works fine when typed on a console directly, but when I put it on my shortcut Exec= section, then I click the launcher icon and nothing happens, there's no terminal with ssh opened or anything else.

This is how the shortcut file loos like:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Name=Remote Servers
Comment=Login to my servers
Exec=notify-send "Select a server" "You have to select a server to SSH into" -i /usr/share/icons/gnome/256x256/status/messagebox_warning.png -t 5000
Terminal=false
X-MultipleArgs=false
Type=Application
Icon[en_US]=/home/username/.icons/ssh.png
StartupNotify=true
StartupWMClass=RemoteServers
X-Ayatana-Desktop-Shortcuts=Server1;Server2;

[Server1 Shortcut Group]
Name=SSH into 111.222.333.444
Exec=expect -c 'spawn ssh root@111.222.333.444 ; expect assword ; send "password123\n" ; expect root@; send "unset HISTFILE\n" ; interact'
TargetEnvironment=Unity

[Server2 Shortcut Group]
Name=SSH into 111.222.333.444
Exec=expect -c 'spawn ssh root@111.222.333.444 ; expect assword ; send "password123\n" ; expect root@; send "unset HISTFILE\n" ; interact'
TargetEnvironment=Unity

I though this would work because I've created another shortcut to launch a virtual machine, I created it using gnome-desktop-item-edit --create-new, and the command in "Exec=" is just the same as when typed on the console.

Anyone knows how could I get this working?

rlihn
  • 23

1 Answers1

0

put the entire expect command in a separate script , say ~/bin/server1 and change your Exec to

Exec="gnome-terminal -e /home/your_user/bin/server1"

I assume you do not want others to view/use the script as it contains a password, so chmod 700 ~/bin/server1 and consider using an encrypted home directory ;)

Panther
  • 102,067
  • Exec=gnome-terminal -e "expect..." worked, but I had to use double \" to en code quotes. – rlihn Jan 08 '12 at 06:54