Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using expect to auto login on SSH from an Unity launcher, the command looks something like this:

gnome-terminal -t SSH1 -e "expect -c 'spawn ssh root@111.222.333.255 ; expect assword ; send \\"password123\\n\\" ; interact'"

That works fine for logging in automatically, but if I maximize the gnome-terminal window, the ssh shell contents remain smaller as if the window had the default size, like this:


At first I thought it was because the gnome-terminal was being launched with the default size and when maximized for some reason the ssh stuff didn't resize, but then I added gnome-terminal --window --maximize to the command, and the same problem remains, the window starts maximized but the ssh shell text still is the size of the default terminal.

Also if I just open a terminal and type that command on the top, I have the same problem as if I start it from the Unity launcher.

Any ideas what could cause this and how to fix it?

share|improve this question
Not an answer: using ssh with ssh-keys works great, you can resize, and it is more secure than writing the pain password in a command (probably put in a script or an alias). So, why don't you use ssh-keys? (Also, I cannot get your command, opportunely modified, to run, so I cannot try). – enzotib Jan 8 '12 at 17:12
@enzotib I will take a look at ssh-keys but I never used them, Im not sure how to set them up. And its weird the commands doesn't work for you, I just copy paste the cmd on my question into a terminal, and it works. – nirgxx Jan 8 '12 at 17:46

a better way to get the effect you want is to use ssh keys like enzotib suggested.


$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ ssh-keygen -t rsa

press enter at each prompt leaving the fields blank will create a default key with no password. This is what you want.

Next push the public key to the server.

$ ssh-copy-id root@111.222.333.255

Finally create a launcher with the command:

gnome-terminal -t SSH1 -x ssh root@111.222.333.255
share|improve this answer

Use following on the top of your expect script:

#trap sigwinch and pass it to the child we spawned
trap {
 set rows [stty rows]
 set cols [stty columns]
 stty rows $rows columns $cols < $spawn_out(slave,name)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.