Getting "imish" error when executing command on ssh connection.
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Getting "imish" error when executing command on ssh connection.
I need to connect to a cisco switch and execute the command:
show vlan 100
METHOD A:
If I do this manually, it works:
1) I connect with: ssh USER@192.0.0.1
2) When the connection has been established, I type:
show vlan 100
3) The correct information is shown on the screen.
METHOD B:
If I try to do this on a single line to automate the process:
ssh USER@192.0.0.1 "show vlan 100"
The only thing that is shown is this error:
imish: invalid option --'c'
Try 'imish -help' for more information.
But I think that this should work fine. If in a similar way I connect to other PC on the network and I execute "ls -la" this work fine:
ssh USER@192.0.0.20 "ls -la"
So, I think the problem is not in the "ssh" command, but in the "Cisco switch", although I do not know much about this.
I don't know about imish, but it sounds like it's some kind of shell. When you use ssh the way you do, a command like this is executed on the cisco switch:
/bin/sh -c "show vlan 100"
It fails because imish has no -c option. You can add -v to the ssh command to get more info, and even more with -vvv.
You could try piping the command to the shell, for example this:
echo "show vlan 100" | ssh USER@192.0.0.1
And if it doesn't work, you could use expect. People sometimes use expect for login/password, which is usually not a good idea. But it can also be used to get more control when things are complicated.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
This is the third time you ask something about communication with your switch. In the previous cases you have received ample feedback. The only person not providing feedback was yourself.
Maybe you don't realize it, but we are not a human Google, but instead human volunteers contributing to a community. It is not more than decent if you provide your feedback on the proceedings of your other question and the solutions and recommendations provided.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.