@@ -76,6 +76,9 @@ public override void Initialize()
7676 {
7777 sshClient = new SshClient ( Connection ) ;
7878 sshClient . Connect ( ) ;
79+
80+ //method call below necessary to check edge condition where password for user id has expired. SCP (and possibly SFTP) download hangs in that scenario
81+ CheckConnection ( ) ;
7982 }
8083 catch ( Exception ex )
8184 {
@@ -146,7 +149,7 @@ public override string RunCommand(string commandText, object[] arguments, bool w
146149 catch ( Exception ex )
147150 {
148151 _logger . LogError ( $ "Exception during RunCommand...{ RemoteFileException . FlattenExceptionMessages ( ex , ex . Message ) } ") ;
149- throw ex ;
152+ throw ;
150153 }
151154 }
152155
@@ -328,18 +331,18 @@ public override void CreateEmptyStoreFile(string path, string linuxFilePermissio
328331 {
329332 _logger . MethodEntry ( LogLevel . Debug ) ;
330333 string [ ] linuxGroupOwner = linuxFileOwner . Split ( ":" ) ;
331- string linuxFileGroup = linuxFileOwner ;
334+ string linuxFileGroup = String . Empty ;
332335
333336 if ( linuxGroupOwner . Length == 2 )
334337 {
335338 linuxFileOwner = linuxGroupOwner [ 0 ] ;
336- linuxFileGroup = linuxGroupOwner [ 1 ] ;
339+ linuxFileGroup = $ "-g { linuxGroupOwner [ 1 ] } " ;
337340 }
338341
339342 if ( IsStoreServerLinux )
340343 {
341344 AreLinuxPermissionsValid ( linuxFilePermissions ) ;
342- RunCommand ( $ "install -m { linuxFilePermissions } -o { linuxFileOwner } -g { linuxFileGroup } /dev/null { path } ", null , ApplicationSettings . UseSudo , null ) ;
345+ RunCommand ( $ "install -m { linuxFilePermissions } -o { linuxFileOwner } { linuxFileGroup } /dev/null { path } ", null , ApplicationSettings . UseSudo , null ) ;
343346 }
344347 else
345348 RunCommand ( $@ "Out-File -FilePath ""{ path } """, null, false, null);
@@ -431,5 +434,18 @@ private string FormatFTPPath(string path, bool addLeadingSlashForWindows)
431434
432435 return rtnPath;
433436 }
437+
438+ private void CheckConnection( )
439+ {
440+ try
441+ {
442+ RunCommand( "echo" , null , ApplicationSettings . UseSudo , null ) ;
443+ }
444+ catch ( Exception ex )
445+ {
446+ _logger. LogError ( RemoteFileException . FlattenExceptionMessages ( ex , "Error validating server connection." ) ) ;
447+ throw ;
448+ }
449+ }
434450 }
435451}
0 commit comments