ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language 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.
I am trying to interact with the Terminal server via bash. I wrote a small script to be executed on terminal server, but i have the below error. If I remove EOF, then it atleast the ssh connection estlablished, but doesnot run any commands (enable,config)after that
For that you'll need a key, and for bonus points you can lock it down in the server's ~/.ssh/authorized_keys by prepending command="config; enable" to the line with the key.
If the two programs on the server, config and enbale, are interactive, then you will need -t instead of -T and -N there.
For that you'll need a key, and for bonus points you can lock it down in the server's ~/.ssh/authorized_keys by prepending command="config; enable" to the line with the key.
If the two programs on the server, config and enbale, are interactive, then you will need -t instead of -T and -N there.
The problem is I wanted to check for multiple terminal servers and for each terminal server the public key is different.
The problem is I wanted to check for multiple terminal servers and for each terminal server the public key is different.
The public key only needs to go into ${HOME}/.ssh/known_hosts once and then you are good.
But if you are connecting to multiple remote servers:
Then you can make a bunch of keys and give them predictable names so that they can be globbed:
Code:
for key in ${HOME}/.ssh/server_*_ed25519; do
ssh -i ${HOME}/.ssh/${key} -NT username@ip 'enable; config;'
done
It would be safer (and probably more convenient) with keys than leaving the passsword lying around and, again, the keys can be locked down on the server end using the command="..." option in ~/.ssh/authorized_keys on the server. See "man sshd" for more details.
Last edited by Turbocapitalist; 03-21-2024 at 07:47 AM.
yes, it is most probably a server side issue, need to check the configuration. And the server side logs. Probably you need to start sshd in debug mode.
yes, it is most probably a server side issue, need to check the configuration. And the server side logs. Probably you need to start sshd in debug mode.
Just being curious. With a prompt like ">" and commands like enable or config it does not appear you are logging into a linux server but some type of managed device like a Cisco switch or router which runs its own embedded firmware. Since there isn't a shell it isn't possible to run commands as desired.
some type of managed device like a Cisco switch or router which runs its own embedded firmware
Yes, it was mentioned that it's a terminal server. In the past, I have sent remote commands to execute on a Cisco switch over a TELNET circuit. For example to backup the configuration:
Of course this is a terrible idea nowadays. The enable-secret goes over the wire as plaintext, and somebody is always listening (or that is what you should assume). OP quite understandably wants to do it over an ssh-encrypted circuit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.