Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
92517099
Commit
92517099
authored
Oct 30, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1490 from sfromm/issue1484
Make sure ownership is set correctly for user's new ssh keys
parents
ef4ca112
4619e994
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
library/user
+6
-0
No files found.
library/user
View file @
92517099
...
@@ -373,6 +373,7 @@ def ssh_key_gen(module, user, ssh):
...
@@ -373,6 +373,7 @@ def ssh_key_gen(module, user, ssh):
if
not
os
.
path
.
exists
(
ssh_dir
):
if
not
os
.
path
.
exists
(
ssh_dir
):
try
:
try
:
os
.
mkdir
(
ssh_dir
,
0700
)
os
.
mkdir
(
ssh_dir
,
0700
)
os
.
chown
(
ssh_dir
,
info
[
2
],
info
[
3
])
except
OSError
,
e
:
except
OSError
,
e
:
return
(
1
,
''
,
'Failed to create
%
s:
%
s'
%
(
ssh_dir
,
str
(
e
)))
return
(
1
,
''
,
'Failed to create
%
s:
%
s'
%
(
ssh_dir
,
str
(
e
)))
if
os
.
path
.
exists
(
ssh_key_file
):
if
os
.
path
.
exists
(
ssh_key_file
):
...
@@ -400,6 +401,11 @@ def ssh_key_gen(module, user, ssh):
...
@@ -400,6 +401,11 @@ def ssh_key_gen(module, user, ssh):
p
=
subprocess
.
Popen
(
cmd
,
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
(
out
,
err
)
=
p
.
communicate
()
(
out
,
err
)
=
p
.
communicate
()
rc
=
p
.
returncode
rc
=
p
.
returncode
if
rc
==
0
:
# If the keys were successfully created, we should be able
# to tweak ownership.
os
.
chown
(
ssh_key_file
,
info
[
2
],
info
[
3
])
os
.
chown
(
'
%
s.pub'
%
ssh_key_file
,
info
[
2
],
info
[
3
])
return
(
rc
,
out
,
err
)
return
(
rc
,
out
,
err
)
def
ssh_key_fingerprint
(
module
,
user
,
ssh
):
def
ssh_key_fingerprint
(
module
,
user
,
ssh
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment