Hi there. Thanks for the video. One quick suggestion: Do not connect to host machines as root. Connecting as root (or allowing root over ssh) is a gigantic security flaw. We (as in the IT community) should promote the use of connecting to a remote host as a specific user, rather than root. Thanks again! This is really cool stuff.
Very useful and easy to understand. I had to use the passphrase instead of password to make it works, but in general, everything was the same, THANKS A LOT!
Paramiko makes it really easy to connect to Linux servers and Cisco devices. I used to do this with Perl years ago but it was very frustrating. You had to tell the library the different prompts, etc. IOS and CatOS devices worked differently.
I'm not sure what I'm doing wrong.... when I try to run the snippet at 1:30, I keep getting an error. "PermissionError: [Errno 13] Permission denied: 'C:/Users/seans/.ssh/known_hosts' I've launched python from an elevated command prompt, but no joy.
Interesting that the presence of a ssh certificate in the Known_hosts file instantly breaks paramiko when you get to the load keys step. Was hoping to get a tip on connecting paramiko to an adva networking device but I encounter a Authentication failed error from python. If you have idea on how to debug paramiko authentication I'd love to get your thoughts.
Server fingerprints. That prompt that comes up when you ssh into a new server asking about if you trust the finger print - when you do it's saved to the known hosts file. If you try to connect to a server with the same IP but the fingerprint has changed, ssh will warn you that something has changed
How do you keep the The shell to persist with these commands. Like your pulling the hostname, if you go ahead and navigate to a particular directory. And then in the next command You want to touch file .txt you will notice that the exec closed out and that you are not in the directory that You Navigate to do but are in the home directory again. You have to change the commands inside a single exec Is there any way around that
how do you run more then 1 command on 1 host for example a switch that needs password>cli>configure>hostname its been hell searching for a solution online
Great Content. Could you please help me for SFTP using paramiko only the current data-1 files from Lan to remote server. I guess exec_command will work on remote server only. What if we want to run the command on out Local i.e. LAN files? please help.
How to keep ssh alive for long running cmd on a remote server? I am getting socket timeout and buffed.timeout while running long running shell command on remote host.
@@DevOpsJourney thanks for the reply , but do you know anything which could ease up or does have the same kind of functionality, i am working on a project which involves multiple ssh to get some of the system metrics from the os , but i cant use any of monitoring tools , i can only use ssh any help i would really appreciate thanks
I have a problem. It seems that the fingerprint of the server I was connecting to changed, but I can't get it to work again. It gives me this error: Traceback (most recent call last): File "C:\Users\user\Documents\update_automation\main3.py", line 12, in stdin, stdout, stderr = client.exec_command('hostname') File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\client.py", line 514, in exec_command chan.exec_command(command) File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 72, in _check return func(self, *args, **kwds) File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 257, in exec_command self._wait_for_event() File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 1226, in _wait_for_event raise e File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\transport.py", line 2055, in run ptype, m = self.packetizer.read_message() File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\packet.py", line 459, in read_message header = self.read_all(self.__block_size_in, check_rekey=True) File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\packet.py", line 303, in read_all raise EOFError() EOFError
Hi, When I run the command same you given i am getting this error "Could not chdir to home directory /home/kyndrylssh: Permission denied" , can you think is that SSH connected ??? how can we confirm that...
Hi there. Thanks for the video. One quick suggestion: Do not connect to host machines as root.
Connecting as root (or allowing root over ssh) is a gigantic security flaw. We (as in the IT community) should promote the use of connecting to a remote host as a specific user, rather than root.
Thanks again! This is really cool stuff.
Request: ssh basics/fundamentals. And it's use cases
Would be great.
Very useful and easy to understand. I had to use the passphrase instead of password to make it works, but in general, everything was the same, THANKS A LOT!
Thanks!
Paramiko makes it really easy to connect to Linux servers and Cisco devices. I used to do this with Perl years ago but it was very frustrating. You had to tell the library the different prompts, etc. IOS and CatOS devices worked differently.
great job, perfect example very clear, concise easy to learn. well explained
I'm not sure what I'm doing wrong.... when I try to run the snippet at 1:30, I keep getting an error.
"PermissionError: [Errno 13] Permission denied: 'C:/Users/seans/.ssh/known_hosts'
I've launched python from an elevated command prompt, but no joy.
Very well done, great explanation! Thank you.
Have you done much with the stdin? When is it useful within paramiko?
thx! you video my problem with Piramiko
Interesting that the presence of a ssh certificate in the Known_hosts file instantly breaks paramiko when you get to the load keys step. Was hoping to get a tip on connecting paramiko to an adva networking device but I encounter a Authentication failed error from python. If you have idea on how to debug paramiko authentication I'd love to get your thoughts.
3:53 As a robot, I got offended
🤣 🤖🤖🤖
Any idea how you would then connect to a mysql database in that server? I cant find anything about this
You would connect to it the same way as if you were SSH'd into another server. Should just be able to run your sqlclient command to connect
what is in the "known_hosts" file ?
Server fingerprints. That prompt that comes up when you ssh into a new server asking about if you trust the finger print - when you do it's saved to the known hosts file. If you try to connect to a server with the same IP but the fingerprint has changed, ssh will warn you that something has changed
@@DevOpsJourney in what format ?
Ip, type, pkey?
How do I save command output to variables? I am not able to manipulate variables when assigning variables to output
It was so helpfull for me thank u very much
Hi Sir,
Can you please specify how may I use this inspect() function to get knowledge about object?
Hi, could you share the coding again ? Cus the link for Code Available is not available now🤕
Apologies, the website is back up now!
Sick content
Hello, how can I make an paramiko SSH connection to a SSH host, through remote desktop (RDP)?
thank you.
I did same as you said but when I replace hostname with directory command 'ls -lrt' Its giving total 0 why its happening
How do you keep the The shell to persist with these commands. Like your pulling the hostname, if you go ahead and navigate to a particular directory. And then in the next command You want to touch file .txt you will notice that the exec closed out and that you are not in the directory that You Navigate to do but are in the home directory again. You have to change the commands inside a single exec Is there any way around that
Will this code work for connecting host with IPv6 address as well?
If not what changes might be required.
Sorry but how do you tell your program where the private key is stored on ur pc?
Hey Simone. Use the below function and specify the path:
load_system_host_keys(filename='path/to/hostkeys')
I hope that helps!
@@DevOpsJourney Thanks a lot!!!!
how do you run more then 1 command on 1 host for example a switch that needs password>cli>configure>hostname its been hell searching for a solution online
Great Content. Could you please help me for SFTP using paramiko only the current data-1 files from Lan to remote server. I guess exec_command will work on remote server only. What if we want to run the command on out Local i.e. LAN files? please help.
can you help me with a code that actually download a file already uploaded in a remote server?
But how you get authenticated, you haven't supply password for root anywhere, have you already copied your public key to all nodes?
Hello I have a duubt if I want send more command how I can do it?
Can I use the paramiko to run a script in the vm that the ssh server is installed?
Yup!
@@DevOpsJourney the machine that the ssh server installed can be windows? Everything Will work fine on windows?
@@davipires2999 yes you can use paramiko to ssh into a windows box
@@DevOpsJourney thanks mate, i'll try this tomorrow in my internship!!!
isnt the autoaddPolicy vulnerable for Man in the middle attacks?
If you are in a more secure environment you could add to known hosts manually
How to keep ssh alive for long running cmd on a remote server?
I am getting socket timeout and buffed.timeout while running long running shell command on remote host.
Timeouts would be on the serverside. Check the settings on the remote host ssh server service.
but does paramiko support ssh multiplexing ? if number of sessions are running , just like ssh natively supports , please help
hey there, as of my knowledge, it does not support SSH multiplexing... but I could be wrong
@@DevOpsJourney thanks for the reply , but do you know anything which could ease up or does have the same kind of functionality, i am working on a project which involves multiple ssh to get some of the system metrics from the os , but i cant use any of monitoring tools , i can only use ssh any help i would really appreciate thanks
Thanks for the video. I have a question - How to change directory after SSHing the server?
cd
I have a problem. It seems that the fingerprint of the server I was connecting to changed, but I can't get it to work again. It gives me this error:
Traceback (most recent call last):
File "C:\Users\user\Documents\update_automation\main3.py", line 12, in
stdin, stdout, stderr = client.exec_command('hostname')
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\client.py", line 514, in exec_command
chan.exec_command(command)
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 72, in _check
return func(self, *args, **kwds)
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 257, in exec_command
self._wait_for_event()
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\channel.py", line 1226, in _wait_for_event
raise e
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\transport.py", line 2055, in run
ptype, m = self.packetizer.read_message()
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\packet.py", line 459, in read_message
header = self.read_all(self.__block_size_in, check_rekey=True)
File "C:\Users\user\Documents\update_automation\venv\lib\site-packages\paramiko\packet.py", line 303, in read_all
raise EOFError()
EOFError
Hi, When I run the command same you given i am getting this error "Could not chdir to home directory /home/kyndrylssh: Permission denied" , can you think is that SSH connected ??? how can we confirm that...
Try a 'hostname'. That's how I confirm
@@DevOpsJourney u mean command 'hostname'? I am getting something for that also
please how long and big is this code?
How to open shell using this and see what's going on
How to get the known hosts file created
should be in ~/.ssh/known_hosts, or c:\users\\.ssh\known_hosts
Is possible to do a sudo to another user? , ssh with brad and then sudo to tomcat?
maybe try 'su tomcat'
@@DevOpsJourney and the password?
How to stay on server in comand-line?
use while and instead of 'hostname' enter 'input()'
This is great
thanks man
Sent thanks