Ho to send bulk commands to cisco ASA with ssh - ssh

I don't have a lab ASA version, so I have to be 200% sure before I spoil a firewall.
How can I send 5-10 commands in bulk to cisco ASA with ssh?
I would consider something like this:
ssh admin#my_asa < list_of_commands.txt
Best would be to not to hardcode password in txt file but it is not crucial.

you can save a configuration file and then upload it via SSH to the router .

Related

How to programmatically download a file from a remote desktop if I have the data required to configure a Jump Desktop (remote desktop) connection?

I want to programmatically download a file from a remote machine.
So, I know the host's IP and port:
Login data:
I also know that it creates an SSH tunnel.
Any suggestions? Is it even possible knowing just that data?
My knowledge on that topic is very scarce.
My answer focuses on SSH usage. In order to download a file via SSH, you need to run the scp command, like
scp yourusername#server.url:/the/path/to/the/file.extension ./
That's enough in order to download the file. However, it is possible that this will not work by itself. First, you need the other machine to know about your ssh, so you will need to
vim ~/.ssh/authorized_keys
hit insert and paste your public SSH key to its end. Don't remove anything. If it is still not working, then ssh might be disallowed on the server and you will need to enable it. Example for Ubuntu: https://linuxize.com/post/how-to-enable-ssh-on-ubuntu-18-04/
Your user needs access to the file you want to download, otherwise this won't work.
Alternatively you could set up an SFTP connection as well and use that.

How to avoid ssh connection overheads in scp?

I am testing the performance of scp command. I want to minimize the overheads for making TCP connection of ssh protocol inside scp.
How can I open the first ssh connection and reuse it over time?
thanks for your help.
// I should have said that one way to achieve it is to zip the files and send it at once, which only works when the files are available all the time. Let's assume then the files are generated in stream fashion in the source side, and I want to send those as early as possible after they are generated.
// Pleaser refer to the link for the answer I found: (How To Reuse SSH Connection To Speed Up Remote Login Process) http://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/
If you are copying so many tiny files that the connection overhead comes into play, you could try tar'ing everything up on the fly and sending that instead.
Try something like this:
tar zcvf - data | ssh user#server "cat > data.tar.gz"
You can drop the z if compression isn't desired/helpful too.

execute a shell script on a remote device, wait that it will be over and copy data from it

I have a question regarding the execution of scripts on remote machines.
I have a computer used to do perf testing, and I would like to connect to it remotely, run a script on this remote machine, which does the perf testing and build a text file with the result, and then grab the resulting file.
Example:
local script:
remotescript="/thescript.sh"
ssh user#remotebox -p 2222 $remotescript
scp user#remotebox:results.txt /DATE/perf_results/
I can run the script using SSH, but my local script will wait that the remote script will be over? is this the correct way to execute activity on a remote host, and grab data from it?
Should I use exec on the remote machine, instead of passing the remote script via SSH?
It is the first time that I run commands on a remote host, so I would like to do it in the correct way. Some suggested me to use SSH and some to use exec. Thanks
It seems like SSH is just fine; problem solved.

how to use ssh transport file in phpstorm

in my project , I only have ssh ,no ftp sftp and rsync, I write php script in phpstorm
but I have not found any plug about ssh in it.
I want develop on windows, so anyone know is there anyway to transport file to linux,
thank you everyone
Try using the scp command.
scp your_username#remotehost.edu:foobar.txt /some/local/directory

Script to ssh to remote server and overwrite file

Been toying around with my Raspberry Pi running raspbian.
I'd like to update a webpage with a shell script that requires no input, such as password.
I just tried creating the keys and putting them in the .ssh file on the remote server, but when I run my simple shell script of ssh user#domain.net 'ls' and it still prompts me for a password.
I also looked into paramiko slightly, but didn't get very far with it.
All I need is to update/replace an html file with text/information that I have.
Thanks
I think your Public/Private Keys for Authentication is not configured correctly in your server.
Can you check this link which explains the authentication step:SSH Authentication