Remote-Session | Remote Session is a small collection | SSH Utils library
kandi X-RAY | Remote-Session Summary
kandi X-RAY | Remote-Session Summary
Remote Session is a small collection of utility classes for interacting with remote systems via Secure Shell (SSH) protocol. Built around the JSch library from JCraft, available functions include:. Remote Session wraps the capabilities of JSch in a simplified API that handles many of the details related to setting up and managing remote sessions. Originated by Mykhaylo Adamovych, the implementation was copied verbatim from a post on Stack Overflow. JavaDoc has been added for completeness and comprehensibility.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Performs a SSH file transfer
- Download a single SSH file
- Perform a ssh file upload
- Gets the SSH key file path
- Returns the remote configuration object
- Gets ssh folder path
- Executes a batch command on the remote host
- Executes a command via the remote channel
- Returns a message for the session exit status
Remote-Session Key Features
Remote-Session Examples and Code Snippets
InputStream is = System.in;
OutputStream os = System.out;
SshUtils.shell("ssh://user:pass@host", is, os);
PrintStream ps = new PrintStream(is, true);
ps.println("ls -la");
ps.println("exit");
System.out.println(IOUtils.toS
String userName = "user";
String password = "password";
String hostName = "host";
String sudoCmd = "sudo su - admin";
String batchDir = "/work/dir/path";
String batchCmd = "./script.ksh parm1 parm2";
String output = SshUti
System.out.println(SshUtils.exec("ssh://user:pass@host/work/dir/path", "ls -t | head -n1"));
String connectUri = "ssh://user:pass@host/work/dir/path";
String command = "ls -t | head -n1";
try (SessionHolder session = new SessionHolde
Community Discussions
Trending Discussions on Remote-Session
QUESTION
I need to copy file from one remote server to other using powershell script.
What I have tried :-
While i use following powershell commands it's work fine.(means file copied from one server to other)
But while i use following script it gives error "cannot find path..." as follows
Actually, file is exist at that path.
I have tried to refer following stack-overflow already question-answer
- Error with PowerShell command for copying file to remote server with credential
- 'Session' Parameter is null or empty in PowerShell script
- powershell remote
- Invoke-Command with remote session: Cannot validate argument on parameter
- Unable to copy a binary to a remote Azure VM
- PowerShell Command to Copy File on Remote Machine
I have also tried to get help using
...ANSWER
Answered 2020-Sep-03 at 12:58Invoke-Command
has the parameter -ArgumentList
wich can be used to supply the values of local variables in the remote session. The Problem is: it's just the VALUE of the variable. No file!
What you can do:
Use Get-Content -Raw
on small files to save the contant in a variable. On the target system create a New-Item
with the -Value
of that file. However thats not very efficent.
Example:
QUESTION
Yet another works-fine-locally-but-looses-its-mind-in-a-remote-session problem.
I have a PS script that runs standard Windows command line ftp.exe
to get a file. Works a treat when ran directly, however when ran remotely via Invoke-Command it suddenly leaves the files with the encrypted bit set.
If I then, in the same PS session (in the same script), run cipher /d
on the file, I get Access Denied. However if I log onto the remote machine using the same account, I can decrypt it.
So, question the first, is this a "feature" of ftp.exe? I can't find anything suggesting as such, but no other method of creating a file seems to result in it being encrypted, so I'm left thinking it is an intentional act by the application, like it checks the logon type and encrypts if it a network logon.
Second, why can I not immediately decrypt it? Same account, same session.
The essential bits of the script in question:
...ANSWER
Answered 2020-Mar-27 at 17:16I realize this is probably a pretty obscure edge case, but I'll leave an answer just in case anyone runs into anything similar.
As usual, ProcMon has all the answers...
At my company %HOMESHARE%
is set to a network file server (by some GPO I believe).
As ftp.exe is retrieving a file, it writes to a temp file and then once finished, copies it over to the specified location. Even after knowing this, one might expect %TEMP%
to be used for such a purpose, but no.
I'm not quite sure exactly how ftp.exe goes about determining the temp file location, but when I'm in a PSsession, it chooses my Documents folder (%USERPROFILE%
I suppose), but when I'm in an RDP session it uses %HOMEPATH%
. So of course my Documents folder is set to encrypt new files and so the temp file is encrypted and gets copied over, but the file share is not so it copies over clean.
Also, while I have found nothing official stating this, it does seem that cipher.exe is completely ineffective for a network logon. If after entering a PSSession I create a new file with Set-Content
and attempt to encrypt using cipher /e
it gives the same access denied. Same account over RDP encrypts no problem;
QUESTION
I am trying to implement Project Rome functionality into my UWP App by making the device(s) discoverable and remote session(s) joined from different remote systems/devices.
Overview on Project Rome can be found here: Project Rome
What I am trying to achieve in a broad sense is described here: Connect devices through remote sessions
I have followed the code and downloaded the Quiz sample App provided on GitHub here: Remote System session - Quiz game App
My code is below. I am using simplified code to get the basic functionality working:
...ANSWER
Answered 2018-May-08 at 09:24For anyone with similar issue and wanting an answer:
I was trying to host a Remote Session and discover other sessions - within the same UWP App to facilitate App-to-App messaging. For Host-client sessions, the Quiz App example works just fine (see link provided in my question). But, for many-to-many Session hosting, discovery and sending messaging to a single Participant, it was difficult to achieve (at least for me). In other words, my App hosts a Remote Sessions and joins others.
This is my understanding of the flow and how I resolved it:
- Create a Remote Session
- Discover Remote session
- Create a Message Channel for it
- Watch remote session participants (RemoteSystemSessionParticipantWatcher)
- Then send the message to a participant on corresponding Message Channel (created in step 3).
When a Message Channel is created by a device, it also adds itself as a Participant. So, I save a reference to this (Host) Participant (in step 4) and then send the message to it when required.
The crux of the matter is to save reference to the remote session message channel and the specific Participant of it - then send the message to that. It is a bit complex to understand at first as I found out. Documentation is available but unfortunately not for the scenario I wanted. Nonetheless, I got there eventually. Sorry, can't post the code as it is quite large now, but I am hoping that interested reader would find the working logic above to be useful.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Remote-Session
You can use Remote-Session like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Remote-Session component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page