Connect to Linux Server from Powershell of windows server - linux

I am trying to connect to a Linux server with sftp type in power shell but it's not getting connected. Tried many ways but couldn't figure out anyway as the power shell I have is restricted for using ssh, posh-ssh, and OpenSSH. But it gets connect via cmd prompt. one way to connect to it. Which is: Start-Process cmd - ArgumentList "/K sftp username#servername"
This opens cmd and runs the command but as it connects to Linux server it won't allow me to append another command to execute it. Like Start-Process cmd - ArgumentList "/K sftp username#servername & bye". The "bye" is command we use to come out Linux server but this is not letting to use it.
If anyone has any idea how we do it or any other way to connect please let me know.

Related

Is there a library to connect my Terminal using Robot Frmaework?

I want to run jobs in terminal connecting SSH tunnels. Is there any way that I can do it?
I should connect to Terminal
Access SSH tunnels
Access pentaho. sudo us - pentaho
Run my jobs
There is a SSHLibrary - https://github.com/robotframework/SSHLibrary & http://robotframework.org/SSHLibrary/SSHLibrary.html

How to execute linux commands on a remote ubuntu server using symfony4?

I want to execute some linux commands like docker run nginx on a remote Ubuntu server. Let's say host A using my client interface on another host B developed in symfony4 and then the server (host A) will send some info after executing the command to the client interface on host B to be displayed on it.
How to achieve this?
at first you need to log in:
ssh username#ip_address_of_server_with_symfony4
Then
cd /path/to/symfony4
Then
docker exec symfony_container_php php bin/console command:name --arguments
If you need to run single command from your local computer, you also can use ssh -t
ssh -t user#ip full;command;separated with;-es

Ubuntu : Turn on and login into a remote computer

I want to run some application on a remote computer. I am able to turn it on using wakeonlan but how can I log into it and start the application using terminal?
ssh yourusername#computernameorip
ProgramNameToExecute

Call Powershell Script from Unix Shell Script

I have a powershell script on my Windows server which does some active directory operations. I wish to call that script from another Linux machine using a shell script.
I have installed powershell server on my Windows server and can communicate with my linux machine using key based ssh authentication.
Since Windows does not support SSH connections on its own, I have installed a software called Powershell server (http://www.powershellserver.com/) on my Windows server.
The issue is that my script just stops once the command for ssh to Windows server is executed.
My shell script below:
#!/bin/bash
echo "script run"
GROUP=$1
ACCOUNT=$2
ssh Administrator#<Windowshostname>
sleep 10
echo "<pathtoscript>\scriptname.ps1 -group $GROUP -account $ACCOUNT"
sleep 5
echo "exit"
exit
I have tried without the echo command as well and it still hangs. Any idea what I must be doing wrong here? How can I make it work please?
You cannot ssh into a Windows box unless you install a SSH daemon.
You have two options:
1- You need to connect via Remote PowerShell (WINRM).
2- Install SSH daemon and connect via SSH (Check here)
3- You can also use PowerShell Web Access (Windows Servers.)
UPDATE: If you are using PowerShellServer.com then there are some things you can do to try to understand more.
Test scriptname.ps1 locally in Windows Server
Edit your scriptname.ps1 in the first line to create a file somewhere and after execution check if that file exists. This way you will know if script is being executed or not.
Execute Get-ExecutionPolicy and check you can run scripts. Remove constraints by temporary Set-ExecutionPolicy unrestricted
Tried the operation using an "expect" script and it all works well now.

How to make command run after exit the window in linux

I am establishing a connection between the linux machine and the another machine to run my scripts.but once i close the window the connection got disconnected.What should i do to make this connection contiue after closing the window.since multiple users execute the scripts in the other machine so its difficult to establish the connection each time..Any suggestions welcome.
the command i wrote in command line to establish connection is
java -jar /home/**/workspace/cli.jar -s https://******
-i /home/**/.ssh/id_rsa -description TESTS
-fsroot /home/**/Jenkins -labels test -name TESTS
Use "&" after the command to run it in background without need of open windows
If I've understood correctly screen will do. Try 'man screen' in google.

Resources