Mac connect to ubuntu vps ovh - macos

How can i connect to my ovh vps server from Osx ?
I've tried to connect using Chicken of the VNC, but connection failed.
Does any ovh vps servers have remote desktop connection available ?
Thank you for your help !

first you can detach your script from your terminal : run them in background (&) with nohup from a bash term launched into your initial session when you close your session your scripts will be attached to init
$ bash
$ nohup my_command &
$ exit
second part of the question
Chicken is not a term ???
What do you want to do ?
If you want to launch GUI programs use ssh -X and setup X11 both on your mac and your server (there are many posts about this)

Related

Downloading large file on remote host. Then close ssh connection

I am trying to download a stackoverlfow dump of all posts to a remote server (actually a container on a remote host). Now as you can image the dump is large (11G). I want to start a download and then be able to exit my SSH connection to the remote host.
I have looked at tmux but it's confusing.
I know wget https://archive.org/download/stackexchange/stackoverflow.com-Posts.7z will work but I will have to stay connected for the duration of the download.
Does anyone know how I can use tmux to solve this problem?
If I've correctly understood you situation, using nohup to launch the command will do the trick.
nohup wget https://archive.org/download/stackexchange/stackoverflow.com-Posts.7z
This will prevent the killing of the wget process when the shell terminates.
You can connect via SSH, execute the above command and exit. It will keed downloading by itself.
By the way: Tmux stands for Terminal Multiplexer and it's not related to the life cycle of a process.

SSH into Windows 10 Bash only gets into DOS shell not Bash

I'm trying to ssh into windows 10 bash on my local machine.
When I do
ssh localhost I am prompted for my windows password and can then ssh into a DOS shell. How do I access bash from there?
The same occurs when I try to ssh from a cygwin terminal on another laptop on my home network. I am able to ssh into linux machines fine (from windows 10 bash)
Thank you!
When you enable Developer Mode you can see 2 new services are loaded on startup, SSHBroker and SSHProxy and they are bound to port 22. You can try disabling them and you should can do ssh localhost again.

Detach program from SSH connection on a windows

I need to log in to a Windows server via SSH through a local Python (2.7) script, start a script on the server and then disconnect the SSH connection, so that the local script can continue to run.
As of now, I am using fabric, and the local script will not continue before the remote script is done and the SSH connection is closed.
I have read on a range of forums, but it seems to my (admittedly inexperienced) eyes that most replys use unix commands. I need to be able to log onto a windows machine however.
What can I do?
Thank you very much in advance!
Does this help you? You can write a batch script that'll start in the background:
Running Windows batch file commands asynchronously

Execute Command after VM Booted

I've gotten sick of how many steps it takes me to get started in the morning. Yes it only takes me a few minutes to start up my whole environment, but I'd really rather just run a single command on boot-up and be ready to go immediately.
I'm writing an app on Rails connected to SqlServer. To develop for it I have a local version of the DB I use on a VM. My manual process goes like this:
Run VirtualBox.
Start the VM.
When the VM is done booting:
Open terminal
Run `rails s`
When rails is done starting:
open browser
navigate to localhost:3000 and start developing
Run Sublime
I'd love to do this in one script:
VirtualBox Windows7 &
sublime &
google-chrome &
But I can't figure out how to run this command only once the VM is done booting:
gnome-terminal --working-directory=git/my_project --tab -e 'rails s' --tab -e 'git status'
Also, it'd be nice (but not necessary) to have chrome start after rails s has succeeded.
Is this even possible?
I'm not opposed to polling, but it feels like this is something VirtualBox should be able to do a bit more naturally.
EDIT
From Comment:
I'm using Host-Only network with two Bridged Interfaces (one for wireless and one for wired) available. (It allows me to use the VM whether or not I'm connected to a network, and lets me freely switch between wired and wireless without noticing the difference).
Here is how I would do:
In the VM, create a script which will find the default gateway, & keep pinging to it. & add it to user's startup. (needs parsing of ipconfig /all which can be done with vbscript/python.)
In host, look at the network interface between host & VM. Find the default gateway on host (parse route -n output in bash script). Since both use same physical interface, the gateway would be same (assuming NAT & ONE physical interface). Use tcpdump, to wait for the ping packets to the gateway.
"Default gateway" was chosen because that was something host & VM can find out independent of each other. Other alternative was to hard-code host's address.
After the host tcpdump on host exits, it means that the VM is alive & booted upto windows desktop.
I looked into this line of inquiry before, and I think Devil's Pie is the closest you can get to setting that up:
http://burtonini.com/blog/computers/devilspie
You could try starting with this (VBoxManager startvm):
How to automatically start and shut down VirtualBox machines?
and then look at some working scripts to add to your init.d and/or rc.local once your VM is up to finish the rest of the job in order:
Get To Know Linux: The /etc/init.d Directory
I needed to orchestrate something similar. I'm using a Windows VM (guest) as a proxy (it runs a Windows-only corporate VPN client) for my Linux laptop (host). The approach is to fully automate the guest and wait until it's ready:
The host must have no funky routes (yet)
The VM starts and runs a powershell script (via Windows Task Scheduler, run-on-startup) that connects the VPN client and sets up ICS (Internet Connection Sharing, basically routing).
The host now adds funky routes that send some traffic via the VM's host-only interface. If it added these routes too soon, step 2 would not work.
The VM also runs squid (http proxy) and its port is NAT port forwarded from the host, so localhost:3128 actually goes to the guest. So a curl using this proxy goes to the corporate network and indicates whether the guest is fully up and connected.
(Squid is also useful as a backup to this complicated but very convenient mechanism, I can still ssh via corkscrew, etc)
So, I run this script on the host (simplified version shown):
#!/bin/bash
VM=vm #Name of the Virtual Machine
SCRIPT_DIR=/some/dir
PROXY_ADDRESS=localhost:3128
REMOTE_CURL_HOST=any.corporate.hostname
function waitloop() {
echo -n "Waiting to hear from $REMOTE_CURL_HOST "
while ! curl -s -m 5 --proxy $PROXY_ADDRESS $REMOTE_CURL_HOST > /dev/null ; do
echo -n .
sleep 10
done
echo "!"
}
# a separate script that takes down my routes, you may not need this.
bash $SCRIPT_DIR/network-config-vboxnet0.sh down
# error is OK if it's already running
vboxmanage startvm $VM
waitloop && bash $SCRIPT_DIR/network-config-vboxnet0.sh up && echo "Completed"
Essentially, the script waits until curl works through the VM.

VNC Bash Problem

I'm having a curious problem with a little script to make a VNC connection to a remote host. The script just makes an SSH tunnel for the VNC session and then opens the viewer. It's only two lines, and when copied into the shell manually, it works fine. However, invoking the script causes the VNC viewer to fail with this error:
main: unable to connect to host: Connection refused (111)
Here's the script:
#!/bin/bash
ssh -N -L5903:localhost:5903 username#example.com &
vncviewer :3
The tunnel lives throughout the process, so that isn't the problem. Neither is permissions -- the same error occurs when the script is run as root. I've got public key authentication set up, so it's not that ssh is requesting a password.
What am I missing? The commands work when typed in the shell!
Thanks in advance.
Most likely the vncviewer command is being executed too quickly after the ssh command. Try putting
sleep 3
between those two commands to allow time for the port forwarding to be set up.

Resources