forked from shaba/openuds
Fixed X2go authorize script for vapp
This commit is contained in:
parent
cf88eb4c4b
commit
9560ee0699
@ -42,17 +42,17 @@ def updateAuthorizedKeys(user, pubKey):
|
|||||||
|
|
||||||
authorizedKeys = '{}/authorized_keys'.format(sshFolder)
|
authorizedKeys = '{}/authorized_keys'.format(sshFolder)
|
||||||
try:
|
try:
|
||||||
with open(authorizedKeys, 'rb') as f:
|
with open(authorizedKeys, 'r') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
except Exception:
|
except Exception:
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
with open(authorizedKeys, 'wb') as f:
|
with open(authorizedKeys, 'w') as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if 'UDS@X2GOCLIENT' not in line and line.strip():
|
if 'UDS@X2GOCLIENT' not in line and line.strip():
|
||||||
f.write(line)
|
f.write(line)
|
||||||
# Append pubkey
|
# Append pubkey
|
||||||
f.write('ssh-rsa {} UDS@X2GOCLIENT\n'.format(pubKey).encode())
|
f.write('ssh-rsa {} UDS@X2GOCLIENT\n'.format(pubKey))
|
||||||
|
|
||||||
# Ensure access is correct
|
# Ensure access is correct
|
||||||
os.chown(authorizedKeys, uid, -1)
|
os.chown(authorizedKeys, uid, -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user