ssh tunnel VNC server connection closed unexpectedly - ssh

I have to tunnel the VNC server(tightvnc-server) running on my local machine to a remote server, so at remote server can access my local machine without port forwarding on router(at local machine network).
Right now I am using the following command
ssh -R 5950:localhost:5900 user#remote.ddns.net
Where 5900 the vnc server port on my local machine. And I have to access the machine from remote server using the command localhost:5950. And when I try to connect using vnc viewer I am getting the error connection closed unexpectedly. Normally if no connection exist I was getting connection refused error. But here something is missing in tunneling. Can any please tell me what could be the reason.

You need to activate the remote desktop, running:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \ -activate -configure -access -on \ -restart -agent -privs -all
Then you can connected using VNC Viewer

Related

SSH remote port forwarding through bastion server

I'm trying to establish a remote port forwarding to my Mac (target 4004) via a bastion host and Server-A to a Port (1555) on Server B.
So the whole connection is:
Mac:4004 => Bastion:22 => A:22 => B:1555
And the target is my Mac should have a Port 4004 forwarded from B:1555.
What is working so far?
I can connect to Server A with the command ssh user-bastion#user-A#server-A#server-bastion
On Server A I can establish a connection e.g. telnet to B:1555
On my windows client I can remote forward the port B:1555 to my local machine via Putty.
I'm now looking for the ssh command to establish this connection on my Mac.
Commands I tried:
Of course I have already searched for it and I've already tried different versions.
e.g.
ssh -fNT -R 1555:localhost:4004 -J user-bastion#user-A#server-A#server-bastion server-B
ssh -N user-bastion#user-A#server-A#server-bastion -R server-B:1555:localhost:4004
I always receive message like "Warning: remote port forwarding failed for listen port 1555"

SCP times out, but ssh connection works fine. Am I doing something wrong?

I'm trying to copy task1.zip from my desktop /Users/myname/desktop if I pwd, to a remote server. I'm connected to the remote server via ssh. I would like to copy the file to /its/home/jt463/task1(pwd path from the directory) on the remote server.
I have used the command below in the terminal when I'm connected to the server via ssh and tried it on the terminal on my machine:
scp Users/myname/desktop/task1.zip username#inf900179.inf.susx.ac.uk:its/home/username/task1
Error that I get when I try to use the terminal that's connected to the remote server:
Users/jonatantibarovsky/desktop/task1.zip: No such file or directory
Error that I get when I try to use my local terminal:
ssh: connect to host inf900179.inf.susx.ac.uk port 22: Operation timed out lost connection
First scp to the intermediate server, using your credentials. Then, you should be able to scp from that server to the target.

Connect from local PC to remote server with Docker web server

my Docker-Container is on my server.
Via SSH I can connect to the server from my local PC.
ssh user#RemoteServerIP -p 3360
From there I can connect to the Docker container via SSH
ssh userRemoteServer#DockerContainerOnServerIP -p 22
A Apache Webserver is running on the Docker-Container.
How can I access the Webserver on my local computer?
from you server try to figure out which port the apache container is using.. you can use netstat command sudo netstat -ntlp usually in the PID/Program name docker port is PID/docker-proxy .
after you know which port apache container is using, then u can access it using yourServerIP:ApacheContainerPort from you local computer
assuming of course the way you exposing apache port inside container is correct.

Reverse SSH connection refused

I'm running a raspberry pi in a remote location, so I setup a reverse ssh tunnel to one of my servers (CentOS 7) using autossh. All works fine, I can use this reverse ssh to login to the Raspberry from the server, but I can't get the server to forward the ssh, so I can not connect to the Raspberry via the server from the laptop, I always get Connection Refused.
Firewall on the server has been shut down the GatewayPorts yes has been added to the sshd_config and sshd restarted.
Details:
On the Raspberry I'm opening the reverse SSh tunnel:
autossh -fNC -g -M 0 -R 2223:localhost:22 [serveruser]#[server] -p2002
From the server I can ssh into the Raspberry with no problem:
ssh [raspberryuser]#localhost -p2223
I have added the next to /etc/ssh/sshd_config and restarted sshd service after:
GatewayPorts yes
I can successfully ssh into the Raspberry from the server:
ssh [raspberryuser]#localhost -p2223
But when I'm trying to connect from my laptop to the Raspberry through this server:
ssh [raspberryuser]#[server] -p2223
ssh: connect to host [server] port 2223: Connection refused
The firewall on the server has been stopped
SELinux is disabled on the server
I ran out of ideas, so I'm open to suggestions
This isn't really an answer, but after restarting the server (CentOS 7), now I can connect to the Raspberry from my laptop via the server, don't receive "connection refused" anymore.
The only explanation what I have that the SSHD did not restart when I tried to restart it, although the 'messages' logs clearly shows that it was restarted repeatedly:
Dec 4 08:54:54 xxx systemd: Stopping OpenSSH server daemon...
Dec 4 08:54:54 xxx systemd: Starting OpenSSH server daemon...
In any way, the full reboot of the server has resolved it.

Dropbear SSH Tunnel disconnected if upload a file

i am newbie here.
I want to create ssh tunnel application,
but i have a problem with my application.
If I trying to upload a file (>500kb) trough that SSH Tunnel, my internet connection getting not responding and after that I'm disconnected from server.
what is the problem? do ssh server have a limit to upload connection?
*I use dropbear for ssh server