aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2018-11-07 14:26:11 +0100
committerHans Nilsson <[email protected]>2018-11-09 16:03:00 +0100
commitca8b287e0d46c4db053cce661e9800185b04c8ca (patch)
tree821ec866921b2843e19344f5ef5a513bb3ff6d8b /lib/ssh
parentcf17c5bc0444daf76de08df12a8c7b87e1805ba6 (diff)
downloadotp-ca8b287e0d46c4db053cce661e9800185b04c8ca.tar.gz
otp-ca8b287e0d46c4db053cce661e9800185b04c8ca.tar.bz2
otp-ca8b287e0d46c4db053cce661e9800185b04c8ca.zip
ssh: Clear remote user_dir in ssh_compat_SUITE
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/test/ssh_compat_SUITE.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_compat_SUITE.erl b/lib/ssh/test/ssh_compat_SUITE.erl
index 1c607bebe8..af85ef7aee 100644
--- a/lib/ssh/test/ssh_compat_SUITE.erl
+++ b/lib/ssh/test/ssh_compat_SUITE.erl
@@ -648,6 +648,7 @@ setup_remote_priv_and_local_auth_keys(KeyAlg, IP, Port, UserDir, Config) ->
{silently_accept_hosts,true},
{user_interaction,false}
]),
+ rm_id_in_remote_dir(Ch, ".ssh"),
_ = ssh_sftp:make_dir(Ch, ".ssh"),
DstFile = filename:join(".ssh", dst_filename(user,KeyAlg)),
ok = ssh_sftp:write_file(Ch, DstFile, Priv),
@@ -658,6 +659,18 @@ setup_remote_priv_and_local_auth_keys(KeyAlg, IP, Port, UserDir, Config) ->
ok = ssh:close(Cc),
UserDir.
+rm_id_in_remote_dir(Ch, Dir) ->
+ case ssh_sftp:list_dir(Ch, Dir) of
+ {error,_Error} ->
+ ok;
+ {ok,FileNames} ->
+ lists:foreach(fun("id_"++_ = F) ->
+ ok = ssh_sftp:delete(Ch, filename:join(Dir,F));
+ (_) ->
+ leave
+ end, FileNames)
+ end.
+
user_priv_pub_keys(Config, KeyAlg) -> priv_pub_keys("users_keys", user, Config, KeyAlg).
host_priv_pub_keys(Config, KeyAlg) -> priv_pub_keys("host_keys", host, Config, KeyAlg).