I need to check if the ssh status is active for metasploitable2
I need to "ssh msfadmin#x.x.x.x ls / " but im getting "unable to negotiate with x.x.. port 22".
any help would be greatly appreciated.
I searched online but the only things ive found had to do with hacking it metasplotable using ssh exploits. some literature on nmap and other things that're tangentially related.
Related
stuck from a couple of days. In ubuntu i'm creating vncserver with command line [tigervnc]
vncserver -localhost yes
to secure connection from only localhost.
vnc is successfully created with port - 5901.
Im using putty to establish SSH tunnelling,
SSH tunnel
in realVNC viewer in using
localhost:9091
But it gives error saying connection refused.
I want to establish a SSH tunnel with only localhost in order to avoid the brute force attack, getting too many authentication failure errors.
What am i doing wrong. Please guide me.
Note : connection works fine if i use vncserver -localhost no. But for security reasons i dont want this
to allow connection from localhost only and to avoid brute-force attack in these any settings need to change in vnc-config or something.
Did a hell of research, couldn't resolve. StackOverflow is the last hope.
Localhost is 127.0.0.1
You have to create SSH TCP FORWARD to localhost (or 127.0.0.1), not 103.16.26.144
There is how I use this on my linux desktop, from a shell terminal.
ssh -fL 9091:localhost:5900 user#103.16.26.144 sleep 2 &&
xvncviewer localhost:9091
When I'm teleworking, I need to access some internal web servers. I use ssh -f -N -D 4000 someserver.mywork.com on my home computer to setup local dynamic port forwarding. Then, I configure my web browser to use localhost port 4000 as a SOCKS host, and everything works great, even with HTTPS.
The problem is that the proxy stops working every couple of days. When this happens, the ssh process prints messages like the following:
accept: Too many open files
In this scenario, I have to kill the ssh process and restart it in order to get it working again. Based on my research into this error message, I could increase the limit on the number of open files, but that doesn't seem like a permanent or an ideal solution.
I was hoping autossh might be able to monitor the connection and restart it automatically. Is that possible?
I have tried the following command:
autossh -f -M 0 -N -D 4000 someserver.mywork.com
But it didn't work. The proxy stopped working, and autossh did not restart it. Any suggestions or alternative solutions to automatically restarting my ssh proxy?
I'm a beginner in this sort of thing so I could use a bit of help.
I'm usually able to ssh into my school's local cluster using the following command in Ubuntu 18.05 LTS
ssh username#hostname.com
Now this only works when I'm connected to my school's wifi. Whenever I'm off of it, I receive the following error.
ssh: connect to host hostname.com port 22: Resource temporarily unavailable
After some online digging, I figured I needed to port forward into the server, so I tried putting -L 22:localhost:22 after ssh, but it gave me the following error:
Privileged ports can only be forwarded by root.
If I put sudo before everything, it gives me the same port 22 error from before. I'm terribly lost and any help would be appreciated.
SSH has been working fine for the last few weeks since I got my new PC. I've had no problems but today I started getting:
ssh: connect to host github.com port 22: resource temporarily unavailable
I did some googling and found that there is a common issue with WSL which sometimes causes this, but I'm unable to SSH from my bash shell, or from cmd/powershell.
This is the part that confuses me, if I do: ssh -T git#192.30.253.113 I am prompted for the password to my key, it successfully authenticates and responds with "Hi alexmk92! You've successfully authenticated".
Great, that at least proves that my firewall isn't blocking SSH on port 22. But why does git#github.com throw the resource failed error? My initial thought is that this could be a DNS problem.
So I tried to configure my network adapter to use Google's DNS server (8.8.8.8 and 8.8.4.4) I even configured the IPV6 DNS servers just in case. Following this I did an ipconfig /flushdns, attempted to connect via git#github.com again and BAM the same result, however git#192.30.253.113 still works.
I'm guessing another potential cause is that github.com is behind a load balancer and one of the IP's on the cluster could be black-listed somewhere on my machine? I'm just pulling guesses out of thin air now, any help would be greatly appreciated, this is driving me insane.
After some further Googling it turned out that my machine did not have a hosts entry for github.com and it was unable to automatically resolve it.
In Windows Subsystem for Linux I created a ssh config file
touch ~/.ssh/config
(for some reason the base distro of Ubuntu 18.04 on the windows marketplace didn't have one) I then had to make sure the file permissions were correct:
chmod 755 ~/.ssh/config
Once the file was created, I edited it with
sudo nano ~/.ssh/config
and added github.com as a Host.
Host github.com
Hostname ssh.github.com
Port 22
Upon saving, I ran
sudo /etc/init.d/ssh restart
and attempted
ssh -T git#github.com
Everything now seems to be working.
In my case my ISP did not allow ssh, so it was not working from cmd and wsl both. Got around it using vpn
To have successful SSH connection to Github, SSH key has to be import into Github
Open Git bash or Terminal
Run the command ssh-keygen
Choose all default option
A private and a public key gets generated in the folder * < user_home>/.ssh/*
Login to Github.com
Navigate to account settings
Choose item "SSH and GPG Keys" from the side navigation bar
click added new SSh key
Copy and save public key content from * < user_home>/.ssh/id_rsa.pub *
Sorry in advance if the question is not clear and/or if i am not askin where i should.
I have issues with connecting to hosts with ansible via SSH. It worked few days ago but i have been having the same message error for several days :
camille#ubuntu:~$ ansible all -m ping -u remote
192.xxx.xxx.xxx | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange\r\n",
"unreachable": true
}
SSH connection (without ansible) with working nicely so i don't really understand the issue. I'm running Ansible on a Ubuntu 16.04 VM and the host i want to reach is a CentOS 7 VM.
My hosts file is the following :
[test]
192.xxx.xxx.xxx ansible_ssh_user=remote ansible_ssh_pass=password ansible_sudo_pass='password' #VM CentOS
I tried the solution explained here but it didn't fix the problem.
Edit 1: After trying Ripper Tops solution and testing some other things, my inventory now looks like this :
[test]
192.xxx.xxx.xxx ansible_connection=ssh ansible_user=remote ansible_password='password'
[test:vars]
proxy=my_proxy:8080
I also tried increasing timeout to 25, i still have the same issue.
Edit 2 :
After changing my ansible.cfg file, the error message has changed :
192.xxx.xxx.xxx | UNREACHABLE! => {
"changed": false,
"msg": "SSH Error: data could not be sent to remote host \"192.xxx.xxx.xxx\". Make sure this host can be reached over ssh",
"unreachable": true }
I test ssh connection again, it is still working nicely.
My config file is now :
[defaults]
timeout = 25
host_key_checking = False
roles_path = roles/
gathering = smart
[ssh_connection]
ssh_args = -o
ControlMaster=auto -o
ControlPersist=600s
control_path = %(directory)s/%%h-%%r
pipelining = True
Do you have any clue about this ?
Try to use ansible_user instead ansible_ssh_user and ansible_password instead ansible_ssh_pass. It depends of your ansible version.
Also you may need to place [group:vars] after [group] section in the inventory file.
There is simple way to check difference
ansible 192.168.15.29 -i your_hosts_file -m ping -e "ansible_ssh_user=remote ansible_ssh_pass=password"
or
ansible 192.168.15.29 -i your_hosts_file -m ping -e "ansible_user=remote ansible_password=password"
I finally fixed my issue ! :D
I apply the suggestions of Ripper Tops (thanks again) : change the ansible.cfg (see the 1st message)
I changed my hosts file to the following :
[test]
192.xxx.xxx.xxx ansible_user=remote ansible_password=remote_password ansible_ssh_user=remote ansible_ssh_pass=remote_password
[test:vars]
proxy=my_proxy:8080
I pinged my hosts using the -c paramiko option
Thanks again Ripper Tops for your time & help :)
Just want to add my two cents to this problem resolution:
Had the same issue and tried everything above, but that didn't work as my case wasn't exactly the same:
When i tried to do some playbooks towards multiple dozens of hosts, i received this error randomly on various hosts.
To fix this, i had to reduce the concurrency level from "serial: no" to "serial: 4". The number of concurrent executions depends on the network throughput and should be figured out experimentally or thorough digging and calculating your OS and hardware specifics.
It also definitely involves network and possible fork number on your bastion host if you use one.
I hope this might help someone with the situation like mine.