慕森王
//实现远程连接Connectionconn=newConnection(scpAddr,Integer.parseInt(scpPort));conn.connect();//连接logger.debug("登陆远程服务器:"+scpUserName+","+scpPassword);//登陆远程服务器的用户名密码booleanisAuthed=conn.authenticateWithPassword(scpUserName,scpPassword);//登陆失败if(!isAuthed){logger.debug("登陆远程服务器失败");returnfalse;}SessionsshSession=conn.openSession();logger.debug("cd/&&rm-f"+file+"&&pwd");//linux命令sshSession.execCommand("cd/&&rm-f"+file+"&&pwd");//执行sshSession.close();conn.close();