tcsetattr ~ICANON: Invalid argument

DOWNLOAD THE LATEST FIRMWARE HERE
User avatar
MichaelBrandl
Member
 
Posts: 29
Joined: Mon Sep 21, 2015 11:15 am
Location: Hampshire, UK
Has thanked: 4 times
Been thanked: 2 times

tcsetattr ~ICANON: Invalid argument

Fri May 19, 2017 6:43 am

Hi,

I'm writing a backup program which SSH's into the Device, pulls of the config, and then stores this where we want it to, the TFTP Backup isnt practical for us.

This works fine if I do it for a Cisco, Juniper, Mikrotik Etc.

However when I run a quick test using the below command it does show the data, but seems to error in a loop:


sshpass -p 'password' ssh -p 22 -o StrictHostKeyChecking=no admin@'ip' < netonix-commands.txt
The netonix-commands.txt file looks like this:


cmdline
cat config.json
exit
tcsetattr ICANON: Invalid argument
tcsetattr ~ICANON: Invalid argument
tcsetattr(): Invalid argument
tcsetattr ICANON: Invalid argument
tcsetattr ~ICANON: Invalid argument
tcsetattr(): Invalid argument
tcsetattr ICANON: Invalid argument
tcsetattr ~ICANON: Invalid argument
tcsetattr(): Invalid argument
tcsetattr ICANON: Invalid argument
tcsetattr ~ICANON: Invalid argument
Thanks


Mike

User avatar
sirhc
Employee
Employee
 
Posts: 7416
Joined: Tue Apr 08, 2014 3:48 pm
Location: Lancaster, PA
Has thanked: 1608 times
Been thanked: 1325 times

Re: tcsetattr ~ICANON: Invalid argument

Fri May 19, 2017 8:01 am

Curious what the TFTP backup lacks that you need?
Support is handled on the Forums not in Emails and PMs.
Before you ask a question use the Search function to see it has been answered before.
To do an Advanced Search click the magnifying glass in the Search Box.
To upload pictures click the Upload attachment link below the BLUE SUBMIT BUTTON.

User avatar
MichaelBrandl
Member
 
Posts: 29
Joined: Mon Sep 21, 2015 11:15 am
Location: Hampshire, UK
Has thanked: 4 times
Been thanked: 2 times

Re: tcsetattr ~ICANON: Invalid argument

Fri May 19, 2017 5:00 pm

I'd really like security, centralised management of what I can back up, and the way I'm doing it I can have a separate file showing what changes were made.

User avatar
jakematic
Experienced Member
 
Posts: 168
Joined: Thu Jul 14, 2016 8:15 am
Location: NC USA
Has thanked: 362 times
Been thanked: 87 times

Re: tcsetattr ~ICANON: Invalid argument

Fri May 19, 2017 6:13 pm

I use scp to pull the configs, but you need to setup a key pair and put it in /etc/dropbear/authorized_keys

Code: Select all
 scp admin@ws12:/www/config.json config.json

User avatar
sirhc
Employee
Employee
 
Posts: 7416
Joined: Tue Apr 08, 2014 3:48 pm
Location: Lancaster, PA
Has thanked: 1608 times
Been thanked: 1325 times

Re: tcsetattr ~ICANON: Invalid argument

Fri May 19, 2017 11:22 pm

MichaelBrandl wrote:I'd really like security, centralised management of what I can back up, and the way I'm doing it I can have a separate file showing what changes were made.


Then setup a log server and it records the save and what was changed
Support is handled on the Forums not in Emails and PMs.
Before you ask a question use the Search function to see it has been answered before.
To do an Advanced Search click the magnifying glass in the Search Box.
To upload pictures click the Upload attachment link below the BLUE SUBMIT BUTTON.

User avatar
mike99
Associate
Associate
 
Posts: 837
Joined: Tue Nov 25, 2014 10:53 am
Location: Quebec, Canada
Has thanked: 95 times
Been thanked: 245 times

Re: tcsetattr ~ICANON: Invalid argument

Sat May 20, 2017 11:52 am

MichaelBrandl wrote:sshpass -p 'password' ssh -p 22 -o StrictHostKeyChecking=no admin@'ip' < netonix-commands.txt
...
I'd really like security


sshpass is not considered secure since you keep in clear text the password of a device in your script. A simple error and everybody can access it. Kind of error I saw, stocking the scripts under the www folder. You switch should not change much so the method describe by jakematic is the secure way to do automatic remote ssh connection.

User avatar
MichaelBrandl
Member
 
Posts: 29
Joined: Mon Sep 21, 2015 11:15 am
Location: Hampshire, UK
Has thanked: 4 times
Been thanked: 2 times

Re: tcsetattr ~ICANON: Invalid argument

Mon May 22, 2017 2:33 pm

It's all in PHP, and the files are ssl encrypted so the password isn't in plain text. However if someone could get onto the server they may be a problem.

Thanks for the advice and I'll try using a keypair and SCP.

Thanks

Mike

Return to Hardware and software issues

Who is online

Users browsing this forum: No registered users and 75 guests