Discussion:
[Fab-user] First Fabric connected but got 'Permission denied' error
Peter Bee
2010-08-14 08:04:31 UTC
Permalink
Hi,

I eventually setup Fabric on my Windows box.
 
When I try with my first fabric deployment (code pasted below - just want to push a test file to the remote Linux box), then I got the error at the end. Code has  been slightly modified such as usr/paswd, host id. mytest.py file is in the same folder as fabfile.
 
I hope this is a basic and common question so a solution exists.
 

Thanks,
Peter
 
fabfile.py code
--------------------
 from fabric.api import *
REMOTE_HG_PATH = '/home'

def test():
    """Set the target to test."""
    env.hosts = ['10.000.000.00']
    env.user = 'usr_name'
    env.password = 'password'
    env.remote_app_dir = '/apps'
    env.local_settings_file = 'mytest.py'
    env.remote_push_dest = '/home'
    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])
    put("%s" % env.local_settings_file, "%s/" % env.remote_app_dir)
 
Here is the output on Windows side:
 
E:fabric\test>fab test deploy
[10.000.000.00] put: mytest.py -> /apps/mytest.py
 
Fatal error: put() encountered an exception while uploading 'mytest.py'
 
Underlying exception message:
    Permission denied
 
Aborting.
Disconnecting from 10.122.212.80... done.
Jeff Forcier
2010-08-14 12:44:15 UTC
Permalink
Hi Peter,
Post by Peter Bee
    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
Peter Bee
2010-08-15 04:48:26 UTC
Permalink
Thank you for your reply, Jeff.
 
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'. 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'?
 
 
 
Thanks,
Peter

--- On Sat, 8/14/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Saturday, August 14, 2010, 5:44 AM


Hi Peter,
Post by Peter Bee
    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
2010-08-15 12:42:56 UTC
Permalink
Post by Peter Bee
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.
Post by Peter Bee
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
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
Peter Bee
2010-08-16 17:15:21 UTC
Permalink
Hi Jeff,
 
I only see the IP address of the remote system with 'env.host_string' print. I need to seek Linux admin help, but can you elaborate more on the issue? I am not a Linux person, so the more details the better. I think I need to know what permissions my current account has and what permissions I need in order to executte Fabric.
 
 
Thanks,
Peter

--- On Sun, 8/15/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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.
Post by Peter Bee
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
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
Peter Bee
2010-08-16 17:21:43 UTC
Permalink
I also tried to use 'upload_template()', but got errors as following.
 
-- Code ---
from fabric.api import *
from fabric.contrib import *
 
...
 
upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, None, True)
 
-- error ----
Traceback (most recent call last):
  File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li
ne 435, in main
    commands[name](*args, **kwargs)
  File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy
    upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, Non
e, True)
NameError: global name 'upload_template' is not defined
 
 
 
If I used 'fabric.contrib.files.upload_template()', I got NameError on 'fabric' as below.
 
Traceback (most recent call last):
  File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li
ne 435, in main
    commands[name](*args, **kwargs)
  File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy
    fabric.contrib.files.upload_template('put_test.txt', "%s/" % env.remote_app_
dir, None, False, None, True)
NameError: global name 'fabric' is not defined

 
Can you see what's wrong with the code?


Thanks

--- On Sun, 8/15/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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.
Post by Peter Bee
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
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
2010-08-16 17:37:39 UTC
Permalink
Post by Peter Bee
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 = ['***@10.0.0.1']

(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
ssteiner@idc
2010-08-16 17:39:38 UTC
Permalink
Sorry for the top-post, but your post is all HTML-y and i can't edit it very well.

These are all basic Python import problems and don't have anything to do with Fabric, particularly.

S
Post by Peter Bee
I also tried to use 'upload_template()', but got errors as following.
-- Code ---
from fabric.api import *
from fabric.contrib import *
...
upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, None, True)
-- error ----
File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li
ne 435, in main
commands[name](*args, **kwargs)
File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy
upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, Non
e, True)
NameError: global name 'upload_template' is not defined
If I used 'fabric.contrib.files.upload_template()', I got NameError on 'fabric' as below.
File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li
ne 435, in main
commands[name](*args, **kwargs)
File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy
fabric.contrib.files.upload_template('put_test.txt', "%s/" % env.remote_app_
dir, None, False, None, True)
NameError: global name 'fabric' is not defined
Can you see what's wrong with the code?
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
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
_______________________________________________
Fab-user mailing list
http://lists.nongnu.org/mailman/listinfo/fab-user
Stephen F. Steiner
Integrated Development Corporation
***@integrateddevcorp.com
www.integrateddevcorp.com
(603)433-1232
Peter Bee
2010-08-16 23:25:57 UTC
Permalink
Hi Jeff and All,
 
Thanks for the NameError, you right that I am new to Python - I am learning
 
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? I can see the objections that we should have different account names on Windows and Linux no matter which one has Fabric.
 
Then I found another interesting thing, 'cd' seems eat up the last layer of the directory from input. For example,
 
...
env.remote_push_dest = '/home/test1/test2/'
...
run("cd %s/" % env.remote_push_dest)
output = run('pwd')
print output
 
The print out is "/home/test1", what's wrong with it?
 
Next I will try to setup a Windows remote machine and install SSH2 server on it. I posted to ask a good (free and easy to setup and use) candidate for that, and Kevin replied with CopSSH: http://www.itefix.no/i2/node/27, are there any other suggestions?
 

Thanks,
Peter
--- On Mon, 8/16/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Monday, August 16, 2010, 10:37 AM
Post by Peter Bee
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 = ['***@10.0.0.1']

(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
2010-08-17 00:56:07 UTC
Permalink
Post by Peter Bee
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.
Post by Peter Bee
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
Post by Peter Bee
Thanks,
Peter
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Monday, August 16, 2010, 10:37 AM
Post by Peter Bee
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.
    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.
    env.user = "foo"
    env.hosts = ['10.0.0.1']
(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
Christian Vest Hansen
2010-08-17 08:28:59 UTC
Permalink
Post by Jeff Forcier
Post by Peter Bee
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
   http://github.com/bitprophet/fabric/blob/c92765e/docs/faq.rst
-Jeff
Maybe showing how to use the context manager makes a better
alternative example than the absolute paths.
Post by Jeff Forcier
Post by Peter Bee
Thanks,
Peter
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Monday, August 16, 2010, 10:37 AM
Post by Peter Bee
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.
    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.
    env.user = "foo"
    env.hosts = ['10.0.0.1']
(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
_______________________________________________
Fab-user mailing list
http://lists.nongnu.org/mailman/listinfo/fab-user
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
Jeff Forcier
2010-08-17 12:23:48 UTC
Permalink
On Tue, Aug 17, 2010 at 4:28 AM, Christian Vest Hansen
Post by Christian Vest Hansen
Maybe showing how to use the context manager makes a better
alternative example than the absolute paths.
Well, in the actually-compiled Sphinx docs (GitHub appears to parse
the source as regular RST) the "cd" is a link to the API docs for the
context manager:

http://docs.fabfile.org/0.9.1/api/core/context_managers.html#fabric.context_managers.cd

which has a handful of usage examples. I could make that more obvious,
I suppose (i.e. "See cd's docs for examples of its use").

-Jeff
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org
Peter Bee
2010-08-17 04:54:34 UTC
Permalink
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.
***
I was also surprised when I see the workaround worked. But your previous reply implied that (both system should have same local account name) to me. Anyways, I need to play more ...
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
***
Yes, the link does explain and make sense to me. Thanks!

 

--- On Mon, 8/16/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Monday, August 16, 2010, 5:56 PM
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
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Monday, August 16, 2010, 10:37 AM
Post by Peter Bee
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.
    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.
    env.user = "foo"
    env.hosts = ['10.0.0.1']
(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
Peter Bee
2010-08-17 19:13:22 UTC
Permalink
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 = ['***@10.100.100.100']
    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 --
['***@10.100.100.10']
Administrator
password
***@10.100.100.10
Password for ***@10.100.100.10 [Enter for previous]:
Password for ***@10.100.100.10 [Enter for previous]:
 
 
What exactly account/permission do I need here? I am really lost :-(
 
Thanks,
Peter

--- On Mon, 8/16/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Monday, August 16, 2010, 5:56 PM
Post by Peter Bee
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.
Post by Peter Bee
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
Post by Peter Bee
Thanks,
Peter
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Monday, August 16, 2010, 10:37 AM
Post by Peter Bee
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.
    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.
    env.user = "foo"
    env.hosts = ['10.0.0.1']
(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
Post by Peter Bee
Thanks
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Sunday, August 15, 2010, 5:42 AM
Post by Peter Bee
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
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.
Post by Peter Bee
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
fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean
kwarg. Check the API docs for details.
-Jeff
Post by Peter Bee
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
Date: Saturday, August 14, 2010, 5:44 AM
Hi Peter,
Post by Peter Bee
    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
Jeff Forcier
2010-08-17 19:29:01 UTC
Permalink
Hey Peter,
Post by Peter Bee
What exactly account/permission do I need here? I am really lost :-(
I'm afraid I don't know! :(
Peter Bee
2010-08-17 22:21:51 UTC
Permalink
Jeff, thanks for your reply. I think you are right that the remote (SSH server) system doesn
t have SSH set properly. I tried with putty (specifically 'pscp' command) and got the same result - it kept asking for password.
 
I am afraid that CopSSH is not the right one for my system (Win 2008 Server R2, 64-bit). I would like to get some inputs from the experienced users here on which SSH2 server should I try with on the remote system.
 
Did anybody here use SSH2 Spider 4.0? It said it's a freeware for Windows7 though.
 

Thanks,
Peter

--- On Tue, 8/17/10, Jeff Forcier <***@bitprophet.org> wrote:


From: Jeff Forcier <***@bitprophet.org>
Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error
To: "Peter Bee" <***@yahoo.com>
Cc: fab-***@nongnu.org
Date: Tuesday, August 17, 2010, 12:29 PM


Hey Peter,
Post by Peter Bee
What exactly account/permission do I need here? I am really lost :-(
Loading...