How to connect VS Code to server without RDP - ssh

How to connect VS Code to linux server by not login to remote desktop
Current way I login:
open Personal Computer >> Establish VPN connection >> open RDP and login >> open putty/VS code and open SSH connection (linux) write code
Is there a way I can connect VS Code/Putty (Locally installed in PC) to SSH development box without RDP?
example - Local Personal Computer >> Establish VPN connection >> open putty/VS code (locally installed) to establish/connect SSH development server(linux)
When I try SSH from local machine, it always give - time out error.. but with same connection setting (ssh username#servername.companyname.com) if try from remote desktop (work computer) it works fine

Related

Connecting Oracle guest on VirtualBox to a macOS Host

I use oracle DB Developer on VirtualBox to create databases using SQLDeveloper. I use VirtualBox since I can't download SQL Developer on MacBook. I'm writing a Java code on eclipse with an SQL connection on the host machine. How can I connect establish a connection between the guest machine and the host machine?
I've tried to do the port forward option through VB's network adapter setting. When I tried localhost:8000, the page wasn't accessible. I'm honestly not sure if this is even a valid solution for my problem.
Anyone has a suggestion on how to connect my host machine to the database on the guest machine?

ssh tunnel between Visual Studio 2017 and Remote Debugger Msvsmon

I want to debug an application running on machine2 from a Visual Studio 2017 running on machine1. I can only connect to machine2 via ssh. The ssh connection from machine1 to machine2 works fine.
On machine2, I run Visual Studio 2017 Remote Debugger, port number 4022, "No authentication" and "Allow any user to debug".
Port number might be 4023, since machine2 is a 64 bit windows running a 32 bit application: https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugger-port-assignments?view=vs-2017
But I'm not sure because I don't know how to check if the remote debugger is 32 or 64.
I created an ssh tunnel by running this command on machine1:
ssh -L 4022:localhost:4022 machine2user#machine2IP
(How to create more than one tunnel? is the tunnel both ways?)
On machine1 Visual Studio project settings I set remote debugger to "Remote (no authentication)" and target to localhost:4022.
I can see that in machine2 remote debugger, the machine1user connects. In machine1 visual studio I can see the processes running on machine2.
But when I try to attach to my exe process, I get:
Firewall rules on machine1 allow any ssh traffic and 4022,4023 traffic. Firewall rules on machine2 were automatically set by remote debugger installation.
How can I make Visual Studio on machine1 listen to remote debugger traffic coming from machine2? (I'm guessing that might be the problem).
I already checked similar questions here and none were of help.
I solved it by creating the tunnel with port 4023:
ssh -L 4023:localhost:4023 machine2user#machine2IP

TFS SSH task in Windows Machine failed

I tried to connect a Windows machine that exist in another domain than our TFS 2018.3 exist.
I added "SSH" task, and I created new SSH endpoint with the remote machine IP, username and password, without a private key. I configured in the remote machine access of SSH for this username & password.
In the SSH task, I configure a simple shell command: ls.
The TFS agent succeeded to connect the machine but failed with this error:
Unable to execute command or shell on remote system: Failed to Execute process.
Full log:
2019-08-15T13:22:54.1491966Z Trying to setup SSH connection to ********#myserverinanotherdomain:22
2019-08-15T13:22:54.4085564Z Successfully connected.
2019-08-15T13:22:54.8120684Z tr -d '\015' <"./sshscript_1565875374136" > "./sshscript_1565875374136._unix"
2019-08-15T13:22:54.8121422Z Unable to execute command or shell on remote system: Failed to Execute process.
2019-08-15T13:22:54.8121745Z
2019-08-15T13:22:54.8180230Z ##[error]Command tr -d '\015' <"./sshscript_1565875374136" > "./sshscript_1565875374136._unix" exited with code 4294967295.
I think because it's a Windows machine and I try to execute a shell script. If I will install Git bash, for example, it can help?
Does the SSh task support only Linux machines? if yes, how can I connect a machine that exists in another domain?
SSH being a communication protocol is agnostic of OS. It is not Linux specific. But there seems to be a limitation for using SSH task on windows machine/build agent. Take a look at this similar question here: Not able to run bash script from windows using vsts.
I haven't found a documentation that clearly declare the SSh task not support on Windows machine. But I have found a task which also uses SSH--Copy Files Over SSH task. And according to the Q&A in official link:
Is this task supported for target machines running operating systems
other than Linux?
This task is intended for target machines running Linux.
For copying files to a macOS machine, this task may be used, but authenticating with a password is not supported.
For copying files to a Windows machine, consider using Windows Machine File Copy.
Instead of SSH. You should be able to use a local account on the build server and when entering the credentials. The account must have the same password as the account in the other domain. In other works make sure build account which run on the build agent are able to connect another domain.
Also make sure there is a trust relationship between the domains.

Jstatd Remote profiler with jvisualvm

I am trying to profile my web application on my local windows 7 PC visualVM.
I created a jstatd.all.policy file with below code under java's bin directory on my CENTOS 6.8 x86_64 server
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
and tried starting jstatd` with below command
jstatd -J-Djava.security.policy=jstatd.all.policy -p 1099
but when I try profiling on my local PC, I didn't see any process under jvisualvm remote host but just node
i also tried for a test purpose by starting jstatd with same approach on my window server R2 2008 PC and tried to profile with Windows 7 visualVM but still no result just a node with no process but i tried on same windows server pc by adding the remote host for same pc than it shows running processes.
Any suggestions.
Start jstatd by this command:
jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname={Your Ip address}

remotely run a script sitting in a windows server from a unix box or from another desktop (Say windowS)

I have to run a batch job which sits in the windows server from my unix box.
Or from my local machine.
The win server has a userName/Pwd .
How do i programmatically connect to the windows machine and run the batch?
(The batch will change some file permissions in that machine)
Please let me know if there is a better way of handling this situation
A lot of this depends on how you authenticate on the windows machine, the network relation you have to it from your local and unix machine and what level of permission you will need to run the task ons the remote batch file.
I can say that in Windows, you could start by possibly creating a script that stores the username and password needed to connect to the remote machine in a variable, and in that script have it connect to the machine over a network and run the batch as that user.
How woudl you connect to the remote windows server? is it on a LAN or VPN type environment, do you connect with ssh or do you normally map it over the network?>