import config, store, os
standalone_py = os.path.join(os.path.dirname(__file__), 'standalone.py')
c = config.Config("config.ini")
s = store.Store(c)
cursor = s.get_cursor()
cursor.execute("lock table sshkeys in exclusive mode") # to prevent simultaneous updates
cursor.execute("select u.name,s.key from users u, sshkeys s where u.name=s.name")
lines = []
for name, key in cursor.fetchall():
    lines.append('command="%s -r %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n' %
                 (standalone_py, name, key))
f = open('.ssh/authorized_keys', 'wb')
f.write(''.join(lines))
f.close()
s.rollback()


import config, store, os
standalone_py = os.path.join(os.path.dirname(__file__), 'standalone.py')
c = config.Config("config.ini")
s = store.Store(c)
cursor = s.get_cursor()
cursor.execute("lock table sshkeys in exclusive mode") # to prevent simultaneous updates
cursor.execute("select u.name,s.key from users u, sshkeys s where u.name=s.name")
lines = []
for name, key in cursor.fetchall():
    lines.append('command="%s -r %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n' %
                 (standalone_py, name, key))
f = open(os.path.expanduser('~submit/.ssh/authorized_keys'), 'wb')
f.write(''.join(lines))
f.close()
s.rollback()


Make sure to write in ~submit's authorized_keys.
Make sure to write in ~submit's authorized_keys.

  import config, store, os
  standalone_py = os.path.join(os.path.dirname(__file__), 'standalone.py')
  c = config.Config("config.ini")
  s = store.Store(c)
  cursor = s.get_cursor()
  cursor.execute("lock table sshkeys in exclusive mode") # to prevent simultaneous updates
  cursor.execute("select u.name,s.key from users u, sshkeys s where u.name=s.name")
  lines = []
  for name, key in cursor.fetchall():
      lines.append('command="%s -r %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n' %
                   (standalone_py, name, key))
- f = open('.ssh/authorized_keys', 'wb')
+ f = open(os.path.expanduser('~submit/.ssh/authorized_keys'), 'wb')
  f.write(''.join(lines))
  f.close()
  s.rollback()
  
  
Make sure to write in ~submit's authorized_keys.
## Code Before:
import config, store, os
standalone_py = os.path.join(os.path.dirname(__file__), 'standalone.py')
c = config.Config("config.ini")
s = store.Store(c)
cursor = s.get_cursor()
cursor.execute("lock table sshkeys in exclusive mode") # to prevent simultaneous updates
cursor.execute("select u.name,s.key from users u, sshkeys s where u.name=s.name")
lines = []
for name, key in cursor.fetchall():
    lines.append('command="%s -r %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n' %
                 (standalone_py, name, key))
f = open('.ssh/authorized_keys', 'wb')
f.write(''.join(lines))
f.close()
s.rollback()


## Instruction:
Make sure to write in ~submit's authorized_keys.
## Code After:
import config, store, os
standalone_py = os.path.join(os.path.dirname(__file__), 'standalone.py')
c = config.Config("config.ini")
s = store.Store(c)
cursor = s.get_cursor()
cursor.execute("lock table sshkeys in exclusive mode") # to prevent simultaneous updates
cursor.execute("select u.name,s.key from users u, sshkeys s where u.name=s.name")
lines = []
for name, key in cursor.fetchall():
    lines.append('command="%s -r %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n' %
                 (standalone_py, name, key))
f = open(os.path.expanduser('~submit/.ssh/authorized_keys'), 'wb')
f.write(''.join(lines))
f.close()
s.rollback()

