Cannot SSH into Azure Windows Server VM - windows

I created a new Virtual Machine in Azure. (Windows Server 2016 Datacenter Server Core)
The VM creation process allowed me to enable SSH access (and I did):
Image of VM Creation Wizard
However I find myself unable to establish a SSH connection to the Windows Server.
I learned that in situations like this, it is sometimes necessary to reset the "configuration password":
"Reset Password" for VM
This action allowed me to successfully use the "troubleshoot the connection" tool (built into Azure) to "stage" a SSH connection (from my IP to the Azure VM). However I still find myself unable to establish a SSH connection. (The connection continues to "time out".)
Image of Inbound Network Rules
Image of Azure "Connection troubleshooter"
Any ideas?

I had to follow these instructions to manually install the sshd service:
https://365adviser.com/powershell/install-use-openssh-windows-powershell-core-remoting-via-ssh/
It's worth noting that Step #2 refers to a depreciated GitHub project. As such I needed to tweak the URI. I also needed to append the the -UseBasicParsing option. Here is the final result:
Invoke-WebRequest -Uri http://mengelsen.000webhostapp.com/shared-items/OpenSSH-Win64.zip -UseBasicParsing -OutFile openssh.zip

Related

Can't connect remotely to WAS 8.5 full profile installed on Ubuntu 14.04 from RAD 9.5 installed on OSX

WAS 8.5 full profile isn't officially supported on OSX by IBM so the only option to perform development from OSX is to install stub runtime and connect to WAS installed remotely. I'm trying to install such scenario but something done wrong and can't connect to my WAS.
There's my installation:
On OSX El Capitan Installed:
RAD 9.5 with WAS 8.5 stub runtime (WebSphere Application Server traditional V8.5 stub)
Installed Virtual Box with Ubuntu Desktop edition 14.04
Ubuntu's hostname: anatoly-ubuntu-vm and it's accessible from host, i.e. ping anatoly-ubuntu-vm works fine
On Ubuntu installed:
WAS 8.5 full profile at /opt/IBM/WebSphere
Created AppSrv01 profile at /opt/IBM/WebSphere/AppServer/profiles
WAS installed with root user, IBM Installation Manager required root permission when was started
My connection settings in RAD:
server name: WebSphere Application Server traditional V8.5 stub at anatoly-ubuntu-vm
hostname: anatoly-ubuntu-vm
Runtime environment: WebSphere Application Server traditional V8.5 stub
Connection type:
I've tried RMI 2809 and SOAP 8880 both options didn't work
Enable the server to start remotely is checked and Select the operating system running the remote server: checked Linux option with my username and password. I've tried my regular Ubuntu account and root, both option didn't work.
Server profile path defined as /opt/IBM/WebSphere/AppServer/profiles/AppSrv01
When I try to start server I get the following exception:
The following problems has occurred when starting the server.
CTGRI0001E The application could not establish a connection to
anatoly-ubuntu-vm .
What am I doing wrong?
UPDATE 1:
After I've written this post I've figured out that SSH server isn't installed and configured at all as described here: Requirements for using Remote Execution and Access (RXA) Now, I've installed and it seems like connecting but stuck at 23% at stage Preparing launch delegate, after a while it throw the following error:
The following problems has occurred when starting the server. The
server may not be started in the correct mode. You can restart the
server to desired mode if it is started. CTGRI0075E A file transfer to
or from the system named [anatoly-ubuntu-vm] timed out before the
transfer could complete. The current timeout interval is set to 240000
milliseconds, and might need to be increased.
UPDATE 2:
As I can see despite error message server is started and I even can connect to web console anatoly-ubuntu-vm:9060/console/ibm but it looks that not SOAP connection, neither RMI connection don't work. When I run Test Connection from Settings overview page in RAD, I get the following error:
The connection failed after trying to use all the available connection
types.
Verify the port values are correct and the server has been started. If
the security of the server is enabled, verify the "Security is enabled
on this server" check box is selected, and the user ID and password
are provided. You can specify this in the server editor or when
creating a new server.
For a Technote with details on the most common server connection
problem, see http://www.ibm.com/support/docview.wss?uid=swg21266028.
The last connection attempt failed with the following exception:
ADMC0016E: The system cannot create a SOAP connector to connect to
host anatoly-ubuntu-vm at port 8880.
UPDATE 3
As #DanielBarbarian guessed I tried to run ./wsadmin.sh -port 8880 and it worked and returned
Connected to process "server1" on node anatoly-ubuntu-vmNode01 using SOAP connector; The type of process is: UnManagedProcess`
This is settings of my ports:
UPDATE 4
When I trying to run telnet anatoly-ubuntu-vm 8880 from OSX host I get the following response (ip address changed to non real due to privacy issue):
anatoly-mac:~ anatoly$ telnet anatoly-ubuntu-vm 8880
Trying 192.168.10.10...
Connected to anatoly-ubuntu-vm
Escape character is '^]'.
HTTP/1.1 408 Request Timeout
Content-Type: text/html
Content-Length: 117
Connection: close
<HTML><TITLE>408 - Request Timeout</TITLE><BODY>
<h1>408 Connection timed out while reading request</h1></BODY>
</HTML>Connection closed by foreign host

hyper-v rollback with login error: The trust relationship between this workstation and the primary domain failed

Today I try to rollback one hyperV vm which is domain joined.
When it is rolled back and started, it displays following error:
The trust relationship between this workstation and the primary domain
failed.
I tried solution to log off domain and rejoin domain. It throws following error:
"computer name is already existing in domain"
I also tried solution from following post:
http://implbits.com/About/Blog/tabid/78/post/don-t-rejoin-to-fix-the-trust-relationship-between-this-workstation-and-the-primary-domain-failed/Default.aspx
http://support.microsoft.com/kb/325850
with command to sync account password:
netdom resetpwd /s:server /ud:domain\User /pd:*
Throws following mesage:
The machine account password for the local machine could not be reset.
Access is denied.
At last the issue is fixed by:
1.Export target vm snapshot
2.Import exported snapshot
3.Log in to new vm and unregister from domain
4.Rename vm computer name
5.Rejoin to domain
But I do not think it is a good solution
I was seeing this issue running a windows 10 guest on a Windows 10 HyperV. The following fixed it.
Logon to the VM using a local admin account and run powershell and execute
Reset-ComputerMachinePassword -Server [MyDomainController] -Credential
[MyDomain\administrator]

Re-enable Remote Desktop Windows Firewall Rule on Windows Azure

I have disabled the remote desktop firewall rule in a Windows Azure virtual machine.As you would expect, I can no longer remote desktop in to the server.
Does anyone know if it is possible to re-enable the Remote Desktop Windows firewall rule?
What I have tried
As a long shot, I have downloaded the Windows Azure CLI but can't see anything in there that would do it but have not found anything.
I have also tried to execute the following command against the MSSQL server:
EXEC xp_cmdshell 'netsh advfirewall firewall set rule group="remote desktop" new enable=Yes';
GO
I am getting the following message from the query:
The requested operation requires elevation (Run as administrator).
Please tell me I don't have to re-create the site (which is backed up).
If you're using a VM inside a resource group with the new azure portal, you can do this:
Click reset password
Change mode to "Reset configuration only"
Click update and wipe your sweat off :)
It turns out that all I needed to do was to PowerShell into the Azure VM.
Steps:
Make sure PowerShell is enabled in the Endpoints section of the Azure portal.
Get the server's certificate (PowerShell needs this for remote commands). You can get the server certificate by going to your domains' URL: https://yourdomaing.cloudapp.net:12345 (where :12345 is the port that PowerShell uses).
Export the SSL certificate of the site as a .CER file and install it on your local machine.
Save it to the "Trusted Root Certification Authorities" store on your machine.
Open PowerShell with administrative privileges on your local machine and type:
Enter-PSSession -ComputerName yourdomain.cloudapp.net -Port 5986 -Credential YourUserName -UseSSL
A login popup will appear, enter your VM's login credentials here.
You will now be able to execute commands against the Azure VM. In my case, I ran netsh advfirewall firewall set rule group="remote desktop" new enable=Yes and exited the PowerShell session and was able to remotely connect to my machine.

Postgresql is not allowed to be connected remotely

Could someone help take a look this weird problem? I'm still not able to connect remotely to my Postgresql.
My Steps:
Download and install the latest Postgresql to my local machine
Setup postgresql
Create a DB
Modify "pg_hba", add row "host all all 0.0.0.0/0 md5"
Modify "postgresql.conf", make sure "listen_addresses = '*'"
Restart postgresql service
Open local PgAdmin, and connect to DB <-- Success!
From Remote desktop, do the same thing as #7 <-- Failed!
Error Message:
"Server doesn't listen"
"Could not connect to server......accepting TCP/IP connections on port 5432?"
I found "TCP 0.0.0.0:5432 Listening" when I type "netstat -a"
I checked firewall, it's not enabled
......
Can someone please help? Does anyone encounter this situation?
P.S, my os is Winserver 2008
Thanks in advance~
If you're connecting to the local machine via RDP then you'll be connecting via localhost and no firewall or LAN/WAN/NAT settings should affect pgadmin.
When you edit the pg_hba and postgresql.conf files Server 2008 doesn't usually let you edit them directly where they are. I usually copy them out edit them and then paste them back in. You'll need to authorise the paste from an Admin account.
I usually have a separate rule in "pg_hba" with "host all all 127.0.0.1/32 md5" for local connections. Also ensure when you restart the service that it is running under the user "postgres" and not as some other user.

windbg, cdb unable to query for remote debugging server

I have no trouble running dbgsrv on one machine, and then from another machine using cbb to attach to the remote session with
cdb -premote tcp:server=ipaddress,port=port process
However for some reason I can't make
cdb -QR ipaddress
work to show the server. Even with the server running on the same machine, firewall off, running
cdb -QR 127.0.0.1
returns
Unable to query 127.0.0.1
Similarly windbg > Connect To Remote Stub > Browse also fails to return anything.
Also, while I can connect to the remote session using
windbg -premote tcp:server=ipaddress,port=port process
I can't use windbgs "Connect to remote stub" to connect to the very same session using connection string
tcp:server=ipaddress,port=port process
Any idea what is causing me to not be able to query for server sessions? Also why can I connect from the command line, but not from within windbg using Connect To Remote Stub?
P.S. This should probably also be tagged dbgsrv, but there is no such tag.
P.P.S. The reason I want to use dbgsrv rather than .server command is that I want to resolve symbols and source on my local machine.
The correct syntax is cdb -QR \\127.0.0.1
When using windbg > Connect To Remote Stub > Browse, Enter the IP address of the computer you want to browse in the Machine field before clicking on Refresh

Resources