Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:24:41+00:00 2026-06-11T10:24:41+00:00

I’m trying to use a Fabric python script to log into the production server

  • 0

I’m trying to use a Fabric python script to log into the production server then run the ‘ls’ command remotely. Well I actually have lots of other commands to run, but I’m starting off with a simple list to get it working. My production server uses SSH and is locked down so it needs a private key file and password.

Now I’ve been reading up on some sites about how to get this to work, but can’t get it to log in for some reason. I think it connects ok but a message comes up saying:

Login password for ‘root’:

So I enter my password (same as the one in env.password) and it just keeps popping up the message.

Here’s my fabfile.py:

from fabric.api import *

env.use_ssh_config = True
env.hosts = ["myserver.net"]
env.user = "root"
env.key_filename = "/home/myusername/.ssh/id_rsa.ppk"
env.password = "mypassword"
env.port = 22

def testlive():
  run("ls")

Here’s my SSH config in /home/myusername/.ssh/config:

Host myserver
  hostname myserver.net
  port 22
  IdentityFile ~/.ssh/id_rsa.ppk

Any ideas on how to get this working?

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:24:42+00:00Added an answer on June 11, 2026 at 10:24 am

    I ended up testing the SSH config separately from the command line first to get that part working. I think there was a problem with the SSH keys as I had used PuTTY to generate them and that format may have been incompatible with the OpenSSH ones that Linux uses.

    So first I made new SSH keys on my linux machine without a password for the private key which made two files for me id_rsa and id_rsa.pub. Then I copied the public key string from id_rsa.pub into the authorized_keys file on the production server. Then I tested from the command line. Once that was working I tested with Fabric.

    So config changed to look like:

    from fabric.api import *
    
    env.use_ssh_config = True
    env.hosts = ["myserver"]
    env.user = "root"
    env.key_filename = "/home/myusername/.ssh/id_rsa"
    env.password = ""
    env.port = 22
    
    def testlive():
      run("ls")
    

    Here’s my SSH config in /home/myusername/.ssh/config:

    Host myserver
      hostname myserver.net
      port 22
      IdentityFile ~/.ssh/id_rsa
    

    Now works fine when I run fab testlive from the commandline.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.