Connect to remote host from Aptana Studio 3 terminal - ssh

How to connect to remote host from Aptana Studio 3 terminal view, and use commands on that server?
I'm using symfony framework, the project is in my host 192.168.0.100, so I want to run symfony commands like: $ symfony propel:build-schema

To connect to a remote host run the following command in your console:
$ ssh -l <username> 192.168.0.100
Enter your password and you're golden. Unfortunately you have to do this every time you open Aptana, but it's better than nothing.

Another alternative if you need to specify a port number(or dont need to).
ssh <username>#<server> -p <portnumber>
i know its a old question but hope it helps someone.
first post as well!

You can install Target Management (http://www.eclipse.org/tm/) to create a remote project in aptana.

Related

How to use the libssh connection plugin on ansible

I'm working on a playbook to create/delete users on different storage devices.
The problem is that ansible is not able to create the temp directory and execute the module code.
I was thinking to use shell to create the connection and then to run the command.
Something like this:
- name: Create user
shell: |
sshpass "password" ssh user#storage_device
command_to_create_user
exit
Obviously this approach is risky, if you are not able to connect to the server, you can run the command on the local ansible server.
I have been told that network plugins exist to create a similar connection (ansible.netcommon.network_cli).
But I wasn't able to find much information.
https://www.ansible.com/blog/new-libssh-connection-plugin-for-ansible-network
How can use the libssh connection plugin to run a command?
Thanks

VS code can't ssh to server: failed to create hard link

SETUP
I have a windows 10 PC connecting to my linux server (ubuntu 18.04.2). I run/edit code on my powerful server by remotely accessing the server through VS code's ssh ability. It is super convenient to edit my code on the server with VS code...
THE ISSUE
Visual Studio code won't connect to my Linux server. What is weird is that I am able to ssh into the server from the terminal within VScode by just literally typing ssh <username>#<server-hostname>
However, when I do the Remote-SSH option within VScode then it does not want to connect to the server...strange...
Here is how I remotely SSH into server with VScode built in functionality (marked with red rectangle). Also part of this screenshot is my config file, which I have triple checked as correct (IP address and .ssh/id_rsa_gpu_1_solarpv_ssh location)
HERE IS THE ERROR OUTPUT
MY ATTEMPTS
I have made sure that the config file is setup correctly and that the IP address is correct.
I have ensured that the server's IP address is also in the 'known_hosts' file located at /Users/.ssh/
I even generated my own private key for SSH connection as advised by the great documentation here: https://code.visualstudio.com/docs/remote/troubleshooting#_quick-start-using-ssh-keys
Still getting the error of failed to create hard link...
With all of my back-end stuff done right, I am absolutely clueless regarding why this is an issue.
After spending literally 9 hours on this issue...here is the answer:
When you launch VScode and remotely access the linux server, the linux server is instructed to download and install a vscode server so that you (on the other side) can remotely connect to the server.
If the server does not have internet just make sure the following setting is ticked
This allows the remote server (without or with internet connection) to get the vscode server running.
To eliminate the "failed to create hard link error" go to the directory mentioned by the error, which in this case on linux server is
navigate to /home/<username>/.vscode-server/bin/0ba0ca.../
then remove/delete the hardlink file and target file which also has
the same name as the directory.
Then just attempt to remotely access your server again through
vscode and all should be fine
Here is also a discussion regarding the issue...if you still have problems https://github.com/microsoft/vscode-remote-release/issues/2507
I solved this by enabling the option Lockfiles in Tmp:
i just deleted the whole library and it works, i don't see anything wrong with doing that.
rm -r /path_to_project/.vscode-server/
if i'm wrong feel free to correct me :)
Try this
Just in case others need to try the same here is the detail
ctrl-shift-p and choose:
Remote-SSH: kill VS Code Server on Host...
Chose the host name
Selected the platform type (linux)
https://github.com/microsoft/vscode-remote-release/issues/4307#issuecomment-762882247
worked for me.

Desired port for google cloudSQL connection is not able to be used

I am following the steps here, to setup a CloudSQL DB in Google Cloud Platform. I'm stuck at the step with:
./cloud_sql_proxy -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:3306
I get the message below:
2018/02/07 19:44:10 listen tcp 127.0.0.1:3306: bind: address already in use
I've tried: lsof -i tcp:3306 but nothing shows up. Alternatively, I am able to start a connection to tcp:3307, but that's not what's required in the tutorial, and may prevent the rest of the tutorial from working. When I do lsof -i tcp:3307 however, I am able to see the PID, and kill the SQL connection.
How is the port address 3306 already in use?? Even rebooted my computer.
My Steps I took to fix
I stop Mysql on my local machine
brew services stop mysql
But I had a problem of giving a directory for
Directory to use for placing Unix sockets representing database instances as seen by the console error
Then I did
sudo mkdir /cloudsql; sudo chmod 777 /cloudsql
My Final Script
./cloud_sql_proxy -instances=MyInstanceConnName=tcp:3306 -projects=myproject -dir=/cloudsql/
UPDATE: After trying to dig through many methods to kill the sql process, find out whats actually running on it, joining the gcloud slack group to ask around, etc etc, I ended up uninstalling mysql, and reinstalling it. Fixed it. :shrug:

I am trying to ssh to a windows machine from ansible, the program gets stuck

tasks:
name: Connect to Windows hpst machine through an ssh script
script : windows_connect.ssh
name: Run the bat file
script : C:\OV\sentenv.bat
name: To exit from the remote machine
shell: exit
This is what my playbook looks like.
Windows_connect.sh contains a script to connect to a windows machine via ssh.
ssh root#host
So ideally shouldnt ansible prompt me for a password?
Instead it gets stuck.
Please help me with the same
Ansible opens at least one new ssh connection for every task in the play.
So the idea to open a ssh connection with the first task and then reuse the connection in the later tasks will not work. Actually Ansible won't be able to execute the first task because the script module you are trying to use will already need a working connection to the remote host.
I have found little information on how many ssh connection Ansible will use to execute a task so I might be wrong here.
You should consult the Ansible documentation for Window support and implement a solution based on the winrm Python module.

why ssh-copy-id still need password when using fabric

I have set env.user and env.password,but when I use:
run('ssh-copy-id -i $HOME/.ssh/id_rsa.pub server1')
it still asks me for the password,why?
env.user and env.password are used to ssh to remote server and then run the command inside run () at the remote server.
They are not used for the remote command itself (running in the remote server).
So ssh-copy-id doesn't know anything about the user or password.
If this is not what you mean, I would advice you to edit the question and make things more clear, like providing more context of what you are trying to accomplish: pasting the function that contains this 'run' for example.