On my windows machine, I connect with Putty over SSH to an ec2 Linux instance and perform a download through the command line from a public web resource. When my internet connection has a hick-up the connection of my Putty terminal to the server gets lost.
My question relates to why the download operation does not continue to run on the ec2-server independent of me having a terminal window open. How can I make sure that the operation continues to run on the instance when I close my connection to it ?
There are already couple similar questions, but the answers seem not applicable to my situation.
Related
I have a f1-micro gcloud vm instance running Ubuntu 20.04.
It has 0,2 vcpus and 600mb memory.
I write freezing/crashing which stands for just not responding to anything anymore.
From my monitoring i can see that the cpu is at its peak at 40% usage (usually steady under 1%), while the memory is always arround 60% (both stats with my (nodejs) server running).
When i open a ssh connection to my instance and run my (nodejs) server in background everything works fine as long as i keep the ssh connection alive. As soon as i close the connection it takes a few more minutes until the instance freezes/crashes. Without closing the ssh connection i can keep it running for hours without any problem.
I dont get any crash or freeze information from gcloud itself. The instance has a green checkmark and is kind of still running. I just cant open a new ssh connection and also the only way to do something again with this instance is by restarting it.
I have cloud logging active and there are also no messages in there.
So with this knowledge my question is if gcloud somehow boosts ssh connected vms to keep them alive?
Cause i dont know what else could cause this behaviour.
My (nodejs) server uses arround 120mb, another service uses 80mb and the gcp monitoring agent uses 30mb. The linux free command on the instance shows memory available between 60mb and 100mb.
In addition to John Hanley and Mike, You can edit your Machine Type based on you needs.
In the Google Cloud Console, Go to VM Instance under Compute Engine.
Select Instance name to open its Overview page.
Make sure to Stop the Instance before editing Instance.
Select Machine Type that match your application needs.
Save.
For more info and guides you may refer on link below:
Edit Instance
Machine Family Categories
Since there were no answers that explained the strange behaviour i encountered.
I also haven't figured it out but at least my servers wont crash/freeze anymore.
I somehow fixxed it by running my node.js application in an actual background job using forever instead of running it like node main.js &.
Let's state a situation:
I have the possibility to run arbitrary commands on a server as an unprivileged user, through "unconventional means".
I do not have the possibility to login using ssh to that server, either as my unprivileged user or anything else. So I do not have currently a CLI allowing me to run any commands I would like in a "normal" way.
I can ping that server and nothing prevents me to connect to arbitrary ports.
I still would like to have a command line to allow me to run arbitrary command as i wish on that server.
Theoretically nothing would prevent me to launch any program as my unprivileged user, including one that would open a port, allow some remote user to connect to it and just forward any commands to bash, returning the result. I just don't know any good program to do that.
So, does any one know? I looked at ways to launch ssh_server as an unprivileged user but some users reported that recent versions of ssh_server do not allow that anymore. Actually I don't even need ssh specifically, any way to get a working CLI would do the trick. Even a crappy node.js program launching an http server would work, as long as I have a CLI (... and it's not excessively crappy, the goal is to have a clean CLI, not something that bugs every two characters).
In case you would ask why I would like to do that, it's not related to anything illegal ^^. I just have to work with a very crappy Jenkins server for which I'm not allowed to have direct access to its agents. Whoever is responsible for that server doesn't give a sh** about its users' needs so we have to use hacky solutions just to have some diagnostic data about that server (like ram, cpu and disk usage, installed programs, etc...). Having a CLI that I can launch some time instead of altering a build configuration and waiting 20 minutes to have an answer about what's going on would really help.
Thanks in advance for any answer.
So do you have shell access to the server at least once? E.g., during the single day of the month when you are physically present at the site of your client or the outsourcing contractor?
And if you have shell access then, can you or your sysmin install Cockpit?
It listens on port 9090.
You can then use the credentials of your local user and open a terminal window in your browser. See sidebar item "Terminal" on the screenshots of the cockpit homepage.
According to the documentation
Cockpit has no special privileges and doesn’t run as root. It creates a session as the logged in user and has the same permissions as that user.
This question already has answers here:
How to prevent a background process from being stopped after closing SSH client in Linux [closed]
(20 answers)
Closed 5 years ago.
It's a time cost heavily job when compile something on server. But, my VPS ssh connection is unstable. Connection will be lost in about 10 minutes. How can I let my command continue run when ssh connection lost ?
If you have an unstable connection, the screen(1) command is your best solution. This keeps the terminal session alive when you get disconnected and allows you to log back in a reconnect with it, preserving the screen state and whatever else you had running. It may not be installed by default on your linux distribution (its not on Ubuntu), but is available in any package system.
There are useful tutorials in various places -- a web search for linux screen command gives many pointers.
A quick Google search pulled up the following 3 SO posts that should help:
Linux: Prevent a background process from being stopped after closing SSH client
Getting ssh to execute a command in the background on target machine
Use SSH to start a background process on a remote server, and exit session
TL;DR - use nohup
I am not able to connect to my ec2 instance using ubuntu terminal by ssh.
I was able to connect to my instance before using same .pem file and following the same process. but now it shows Connection closed by 52.76.178.207 every time.
Also i am able to connect to my instance using putty for linux and using the .ppk file generated by same .pem used in above process.
Also I am able to connect to my instance using ssh for first time if I reboot my instance. But second time I get connection refused.
Same thing happens with filezilla I am able to upload files first time after rebooting the instance but not after that.
One more weird thing is happening i.e i am able to see my directory structure in filezilla but not able to upload any file using filezilla.
Thanks for the help
Thanks for the help #John Ankanna.
I still don't know what the problem is but below line fixes the problem.
echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing
I accidentally shorted out the power to my PC while programming Cassandra via cqlsh within Windows Command Prompt. After restoring power, I tried to re-run Cassandra via cqlsh:
C:\Program Files\....\apache-cassandra\bin>cqlsh
and received the following error message;
Connection error: (Unable to connect to any server’ {‘127.0.0.1’: error (10061,
“Tried connecting to [(‘127.0.0.1’, 9042)]. Last error: No connection
could be made because the target machine actively refused it”)}).
I’m using Cassandra version 3.0 on a single PC with a window 7 operating system and am using cqlsh via Command Prompt. This PC does not have any connections to any external clusters.
From similar questions relating to the same error message, there was the comment ‘”Actively refused it” means that the host sent a reset instead of an ack when you tried to connect. ….Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port. This may be because it is not running at all or because it is listening on a different port. Once you start the process hosting your service, try netstat –anb to verify that it is running and listening on the expected port.”
Based on the above, I have looked at Windows Firewall Inbound and Outbound rules and cannot find any Local Port 9042. Unfortuntely, I don’t know the pathway in order to run netstat –anb.
Could someone provide steps to follow to re-establish the connection to port 9042, if this will fix the problem, or how to re-establish access to run cqlsh in Command Prompt again.
It's likely that the cassandra daemon/service is not running - I'm not familiar with Cassandra on windows (whether it runs as a service, or if you have to start it via command line), but however you started it previously, you should start it again in the same manner. On Linux, that would be /etc/init.d/cassandra start or ./bin/cassandra - on Windows, you'll either want to start the service, or ./bin/cassandra.bat or ./bin/cassandra.ps1 or similar.
For my case, I hadn't started the Cassandra server but was trying to connect to it directly. Here are the steps for what I did on Windows:
Start the Cassandra server via cmd
\bin> cassandra
Try to connect to its node
\bin> cqlsh
I think your answer no this
https://phoenixnap.com/kb/install-cassandra-on-windows
these are a steps for , from installation to start Cassandra server Everything is explained step by steps. I hope its helpful for you.