Skip to content

Commit b42759a

Browse files
Stop the sshd service and close connections before moving the default user home
1 parent c21eec7 commit b42759a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cookbooks/aws-parallelcluster-environment/recipes/init/config_default_user_home.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414

1515
return if node['cluster']['default_user_home'] == 'shared'
1616

17+
# Stop sshd and close all connections
18+
service 'sshd' do
19+
action :stop
20+
sensitive true
21+
end
22+
bash "Close ssh connections to perform a default user move" do
23+
user 'root'
24+
group 'root'
25+
returns [0,1]
26+
code <<-EOH
27+
pkill --signal HUP sshd
28+
EOH
29+
end
30+
1731
# Backup the cluster user's default home directory
1832
bash "Backup #{node['cluster']['cluster_user_home']}" do
1933
user 'root'
@@ -46,3 +60,9 @@
4660
end
4761

4862
node.override['cluster']['cluster_user_home'] = node['cluster']['cluster_user_local_home']
63+
64+
# Start the sshd service again once the move is complete
65+
service 'sshd' do
66+
action :start
67+
sensitive true
68+
end

0 commit comments

Comments
 (0)