Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

default install broken due to missing folder #98

Closed
pythonanywhere opened this Issue Mar 27, 2012 · 7 comments

Comments

Projects
None yet
3 participants

repro:
do a git checkout
cd into GateOne/gateone
python gateone.py

will lead to:

Got Exception: [Errno 2] No such file or directory: '/root/GateOne/gateone/users/ANONYMOUS/ssh/config'                                                                          
Traceback (most recent call last):                                                                                                                                              
  File "/root/GateOne/gateone/plugins/ssh/scripts/ssh_connect.py", line 762, in <module>                                                                                        
    socket=options.socket                                                                                                                                                       
  File "/root/GateOne/gateone/plugins/ssh/scripts/ssh_connect.py", line 252, in openssh_connect                                                                                 
    with open(ssh_config_path, 'w') as f:                                                                                                                                       
IOError: [Errno 2] No such file or directory: '/root/GateOne/gateone/users/ANONYMOUS/ssh/config'  

Looks like the ssh folder is missing inside ANONYMOUS?

Owner

liftoff commented Mar 27, 2012

I just tried this and I'm not seeing the issue. What OS are you running this on? Also, does this problem still occur if you install Gate One via "python setup.py install" and run /opt/gateone/gateone.py?

For reference the SSH plugin creates the 'ssh' directory inside the user's directory via the 'Auth' hook. You can see the function that does this at the bottom of ssh.py:

def create_user_ssh_dir(current_user, settings):
    """
    To be called by the 'Auth' hook that gets called after the user is done
    authenticating, ensures that the <user's dir>/ssh directory exists.
    """
    user = current_user['upn']
    users_dir = os.path.join(settings['user_dir'], user) # "User's dir"
    ssh_dir = os.path.join(users_dir, 'ssh')
    try:
        mkdir_p(ssh_dir)
    except OSError as e:
        logging.error(_("Error creating user's ssh directory: %s\n" % e))

It gets attached to the 'Auth' hook just a few lines below that...

'Auth': create_user_ssh_dir

I'm baffled as to what could be causing this issue for you. Do you see that, "Error creating user's ssh directory:" error in the logs above the "Got Exception:" line?

this is without running the python setup.py -- just running gateone from
inside its checked-out source tree...

On 27/03/12 17:15, Dan McDougall wrote:

I just tried this and I'm not seeing the issue. What OS are you running this on? Also, does this problem still occur if you install Gate One via "python setup.py install" and run /opt/gateone/gateone.py?

For reference the SSH plugin creates the 'ssh' directory inside the user's directory via the 'Auth' hook. You can see the function that does this at the bottom of ssh.py:

def create_user_ssh_dir(current_user, settings):
    """
    To be called by the 'Auth' hook that gets called after the user is done
    authenticating, ensures that the <user's dir>/ssh directory exists.
    """
    user = current_user['upn']
    users_dir = os.path.join(settings['user_dir'], user) # "User's dir"
    ssh_dir = os.path.join(users_dir, 'ssh')
    try:
        mkdir_p(ssh_dir)
    except OSError as e:
        logging.error(_("Error creating user's ssh directory: %s\n" % e))

It gets attached to the 'Auth' hook just a few lines below that...

'Auth': create_user_ssh_dir

I'm baffled as to what could be causing this issue for you. Do you see that, "Error creating user's ssh directory:" error in the logs above the "Got Exception:" line?


Reply to this email directly or view it on GitHub:
#98 (comment)

Harry Percival
Developer
harry@resolversystems.com
+44 (0) 20 3051 2751

PythonAnywhere - full python dev & hosting, in your browser
http://www.pythonanywhere.com/

17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79
Registered in England and Wales as company number 5467329.
Registered address: 843 Finchley Road, London NW11 8NA, UK

Owner

liftoff commented Apr 4, 2012

Are you still having this issue?

I just hit this on Ubuntu 11.10 running GateOne from /opt/gateone after a git clone and python setup.py install.

Manually creating /opt/gateone/users/ANONYMOUS/ssh fixed the issue for me.

Owner

liftoff commented Apr 5, 2012

I just pushed a commit that should fix this issue. Let me know if this problem continues.

Looks like that fixed it, I verified by removing all of my user directories and then re-authing. :)

Owner

liftoff commented Apr 6, 2012

Excellent. I'm going to close this one out then.

@liftoff liftoff closed this Apr 6, 2012

@amir-s amir-s pushed a commit to amir-s/GateOne that referenced this issue Jan 21, 2015

@liftoff liftoff gateone.js: Fixed the issue where you'd get double input when using m…
…iddle-click-to-paste in Linux when text was highlighted (sounds obscure but is quite a common practice).

ssh_connect.py:  Added a check to make sure that the user's 'ssh' directory is created before it starts trying to use it.  Should fix the issue reported in liftoff#98
5ae5338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment