fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] First Fabric connected but got 'Permission denied' error


From: Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Tue, 17 Aug 2010 12:13:22 -0700 (PDT)

I still don't get it, sorry for my dumminess ...
 
Today I setup a Windows box (installed 32-bit CopSSH) as a remote system to test Fabric on Windows - both are Win 2008 Server R2, and both have the same account ('Administrator' with same password).
 
Now when I tried the simple code, it (Fabric I guess) kept asking for the password, even though I had it set in the program AND I also input it in the  prompt.
 
Again, here is the code snip and the output
 
-- Code --
from fabric.api import *
from fabric.contrib.files import upload_template

REMOTE_HG_PATH = 'E:\test'

def test():
    """Set the target to test."""
    env.hosts = ['address@hidden']
    env.password = 'password'
    env.remote_app_dir = 'E:\apps'
    env.local_settings_file = 'mytest.py'
    env.remote_push_dest = 'E:\test'
    env.tag = 'test'
    env.venv_name = 'SAMPLE_test'
def deploy():
    require('hosts', provided_by=[test])
    require('remote_app_dir', provided_by=[test])
    require('local_settings_file', provided_by=[test])
    require('remote_push_dest', provided_by=[test])
    require('tag', provided_by=[test])
    require('venv_name', provided_by=[test])
    
    print env.hosts
    print env.user
    print env.password
    print env.host_string
   
    upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, None, True)   
    upload_template('mytest.py', "%s/" % env.remote_app_dir, None, False, None, True)    
    put("%s" % env.local_settings_file, "%s/" % env.remote_app_dir)

-- Output --
['address@hidden']
Administrator
password
address@hidden
Password for address@hidden [Enter for previous]:
Password for address@hidden [Enter for previous]:
 
 
What exactly account/permission do I need here? I am really lost :-(
 
Thanks,
Peter

--- On Mon, 8/16/10, Jeff Forcier <address@hidden> wrote:

From: Jeff Forcier <address@hidden>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <address@hidden>
Cc: address@hidden
Date: Monday, August 16, 2010, 5:56 PM

On Mon, Aug 16, 2010 at 7:25 PM, Peter Bee <address@hidden> wrote:
>
>
> As to the permission issue, I am using a workaround - I created an account with the same name on my Windows (where Fabric sits) as that in Linux (remote box). My question is, is this required?

It shouldn't be, no, and that's actually what I was trying to figure
out -- if you actually *didn't* have a <yourlocalusername> account on
both computers, then it was definitely connecting as the desired user,
so I'm not sure what's up with the permissions error.

> Then I found another interesting thing, 'cd' seems eat up the last layer of the directory from input.

This gets asked frequently -- so I just made an FAQ entry for it, and
wonder why I didn't before :) Please let me know if it doesn't answer
the question clearly enough. It's the first item here:

    http://github.com/bitprophet/fabric/blob/c92765e/docs/faq.rst

-Jeff

>
> Thanks,
> Peter
> --- On Mon, 8/16/10, Jeff Forcier <address@hidden> wrote:
>
> From: Jeff Forcier <address@hidden>
> Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
> To: "Peter Bee" <address@hidden>
> Cc: address@hidden
> Date: Monday, August 16, 2010, 10:37 AM
>
> On Mon, Aug 16, 2010 at 1:21 PM, Peter Bee <address@hidden> wrote:
> >
> > I also tried to use 'upload_template()', but got errors as following.
>
> > If I used 'fabric.contrib.files.upload_template()', I got NameError on 'fabric' as below.
>
> You must be new to Python :D What you want to do is:
>
>     from fabric.contrib.files import upload_template
>
>     # then, elsewhere...
>
>     upload_template(arguments here)
>
> Regarding the permissions issue, what is your local computer's login
> username? I.e. what you've logged in as. Does that username also exist
> on the remote server? I'm guessing that Fab may not be properly using
> your env.user value. You might want to try sticking it into the hosts
> declaration, as that's a bit more solid.
>
> So instead of:
>
>     env.user = "foo"
>     env.hosts = ['10.0.0.1']
>
> You would do:
>
>     env.hosts = ['address@hidden']
>
> (See http://docs.fabfile.org/0.9.1/usage/execution.html#hosts [as well
> as the rest of that page] for details.)
>
> That should eliminate any possibility of the username being the problem.
>
> -Jeff
>
> >
> > Thanks
> >
> > --- On Sun, 8/15/10, Jeff Forcier <address@hidden> wrote:
> >
> > From: Jeff Forcier <address@hidden>
> > Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
> > To: "Peter Bee" <address@hidden>
> > Cc: address@hidden
> > Date: Sunday, August 15, 2010, 5:42 AM
> >
> > On Sun, Aug 15, 2010 at 12:48 AM, Peter Bee <address@hidden> wrote:
> > >
> > > I used my account credentials in the fabric file. Using the credentials, I can log on and do almost all the operations (wget, mkdir, create file, cp, and so on) without 'sudo'.
> >
> > Try printing out env.host_string immediately before your put() call,
> > and see what its value is. If your env.user isn't the same as your
> > local account name, then you should see "<the value you put in
> > env.user>@<the IP address in your hosts list>".
> >
> > If you only see the IP address, then it may be that it's connecting
> > with your local user's username, which (if it exists on the remote end
> > as a legit user) might not have the right permissions. This is a long
> > shot but something to check anyways.
> >
> > > What special rights does 'put' require? Also, how can I use 'sudo' on the remote system in the fabric file? For example, what's the code for 'put' with a 'sudo'?
> >
> > Right now put() can't do sudo things, but there's a contrib method
> > that can be used as a workaround until we upgrade put():
> > fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
> > kwarg. Check the API docs for details.
> >
> > -Jeff
> >
> > >
> > > --- On Sat, 8/14/10, Jeff Forcier <address@hidden> wrote:
> > >
> > > From: Jeff Forcier <address@hidden>
> > > Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
> > > To: "Peter Bee" <address@hidden>
> > > Cc: address@hidden
> > > Date: Saturday, August 14, 2010, 5:44 AM
> > >
> > > Hi Peter,
> > >
> > > On Sat, Aug 14, 2010 at 4:04 AM, Peter Bee <address@hidden> wrote:
> > >
> > > > Underlying exception message:
> > > >     Permission denied
> > >
> > > This usually means exactly what it says: the user you're connecting as
> > > does not have permission to write files to the destination directory
> > > you specified. You'll want to double check that on the remote server
> > > to see what's up.
> > >
> > > Best,
> > > Jeff
> > >
> > >
> > > --
> > > Jeff Forcier
> > > Unix sysadmin; Python/Ruby developer
> > > http://bitprophet.org
> > >
> >
> >
> >
> > --
> > Jeff Forcier
> > Unix sysadmin; Python/Ruby developer
> > http://bitprophet.org
> >
>
>
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby developer
> http://bitprophet.org
>



--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]