Manage SSH connections with Python for Secure Remote Login

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 41

  • @ricksegalCanada
    @ricksegalCanada 3 года назад +1

    Thanks for this short but high signal video. After wandering the internet, looking at all kinds of this or that to simply open a tunnel, I landed here. Super super helpful and I very much appreciate you putting this together.

  • @purplemonkeydishwasher5269
    @purplemonkeydishwasher5269 3 года назад +1

    really clean code. Love the additional info on generating SSH keys for W01 and Linux! That's really helpful

  • @itpugil
    @itpugil 3 года назад +1

    Thank you for this, I will use this as a base for what I was trying to do with my Proxmox hypervisor.

  • @ozzman530
    @ozzman530 27 дней назад

    Was exploring a paramiko authentication issue, do you happen to know how to debug authentication with Paramiko?

  • @SanMan7
    @SanMan7 4 года назад

    Great examples Paul nice to hear you still working on the channel.

  • @WorldDstroyer
    @WorldDstroyer 4 года назад +2

    Great stuff as usual! It's always fun to learn more from these videos.

  • @Rey_Psico
    @Rey_Psico 2 года назад

    Can I able to run multiple commands with this code? I have a python file inside a jetson nano in desktop, so I need to make an application with tkinter to open that file from another system which has windows os through ssh.. Is it possible?

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  2 года назад

      you should be able to execute multiple commands . you would need to save the ouput of each command separately

  • @fenylmecc6347
    @fenylmecc6347 2 года назад

    thanks so much, but I tried same thing with a command that runs a python script on my remote server, but the script is not running? is there anything else needed to run a python script on my remote server

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  2 года назад

      What’s the command?

    • @fenylmecc6347
      @fenylmecc6347 2 года назад

      @@practicalpythonsolutions-b4478 thanks for the reply. I tried a command that excutes python script in exec_command. exactly this client.exec_command("python3 script.py"), but it is not being excuted. also tried to create a bash script that excutes the python script and tried client.exec_command("./script.sh"), still not working. I've logged in to my remote server with putty and tried to run both the python script and bash script from there, both works fine

    • @fenylmecc6347
      @fenylmecc6347 2 года назад

      @@practicalpythonsolutions-b4478 okay I found out the script is actually being excuted. I printed out the stderr, and it prints error message "no module named numpy", but I definitely have numpy, I don't know why this error is ocurring

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  2 года назад

      @@fenylmecc6347 can you run locally on the remote local machine?
      That's a pretty specific error and it's obviously not happy with the state of the numpy module

    • @fenylmecc6347
      @fenylmecc6347 2 года назад

      @@practicalpythonsolutions-b4478 the problem was when going through ssh it somehow won't find the proper environment. when I run the script specifying the path to the python environment on the remote server, it worked. just putting it here incase some one faced same problem. thanks for the video

  • @creonte38
    @creonte38 4 года назад +1

    Amazing video! Thank you for sharing your knowledge

  • @rohithap322
    @rohithap322 2 года назад

    Hey, Everything is so well explained, thank you so much!!!; but i have got an error saying: "failed to add the host to the list of known hosts windows", how do i resolve this?
    Thanks in advance!!!!

  • @sunilveerendravattikuti3848
    @sunilveerendravattikuti3848 4 года назад

    Once login, I'm switching to admin user using sudo su - user then it is asking for password. How to give that password from python paramiko?

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  4 года назад

      can you try "sudo -i" instead? shouldn't ask you for a password

    • @sunilveerendravattikuti3848
      @sunilveerendravattikuti3848 4 года назад

      @@practicalpythonsolutions-b4478 Actually i don't want to become root, i have to switch to fssoadmin user and do file editing using sftp. Please help me out
      Below is my sample code:
      Client.connect(host,creds)
      Channel=client.invoke_shell()
      Now i'm switching to admin
      How to sftp now...?
      ftp=client.open_sftp()
      These files are being updated in first login, not switched user

  • @James-no2oc
    @James-no2oc 2 года назад

    How would you do this for multiple clients?

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  2 года назад +1

      Multiple clients for the one server? You may need ssh listening on multiple ports. I have not tried this tho

  • @shadow_self8564
    @shadow_self8564 2 года назад

    How to save the result and send it to mail

  • @kenhgaming8552
    @kenhgaming8552 3 года назад

    interpreter '/usr/bin/python' doesn't exist on remote server help me @@

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  3 года назад

      Hi - Python is not required on the remote server. What is the code you are trying to execute?

    • @kenhgaming8552
      @kenhgaming8552 3 года назад

      @@practicalpythonsolutions-b4478 i want to connect to remove server but it is show this problem found

    • @kenhgaming8552
      @kenhgaming8552 3 года назад

      @@practicalpythonsolutions-b4478 i not want to excuse code

  • @FirstHandExplore
    @FirstHandExplore 3 года назад

    Thank you.

  • @automaticasa_matteosulis
    @automaticasa_matteosulis 4 года назад

    At 3.03 I'm lost. This is too fast for a tutorial.

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  4 года назад

      Where r you lost so I can clarify

    • @automaticasa_matteosulis
      @automaticasa_matteosulis 4 года назад

      @@practicalpythonsolutions-b4478 thanks
      Many thanks
      At 2:38 , I installed paramiko, but my terminal does not recognize the ssh comand. What you mean by "on windows you can enable it in the services"?
      Is that sintax ok for a Windows terminal as well? I'm using Visual Studio Code.
      If I don't have the IP of the server, but a URL, does it work anyway?

    • @automaticasa_matteosulis
      @automaticasa_matteosulis 4 года назад

      @@practicalpythonsolutions-b4478 I also did not understand what file is needed on the client, where to put it, which format to use.

    • @automaticasa_matteosulis
      @automaticasa_matteosulis 4 года назад

      @@practicalpythonsolutions-b4478 I have an OpneSSH directori but I can't find any .ssh directory after the installation

    • @practicalpythonsolutions-b4478
      @practicalpythonsolutions-b4478  4 года назад

      @@automaticasa_matteosulis if you are connecting to a windows box you will need to enable ssh on it. google "how to enable ssh on windows" and follwo along. Make sure that the dns name is working as well by pinging the name to see if you get a response. this will also give you the IP of the server, I suggest that you try to manually connect with ssh before running the script. for example. type "ssh IP of server" first to make sure that it's working correctly. Once that is done, then work with the python script