I feel like a complete dunce - but I cannot seem to connect with Terminal.app and SSH to a non-standard SSH port. I'm on Mountain Lion.
I've tried all of the following:
$ ssh myuser#mysite.com -p 42586
$ ssh myuser#mysite.com -p42586
$ ssh -p 42586 myuser#mysite.com
$ ssh -p42586 myuser#mysite.com
I cannot seem to get the syntax right, all of the above produce an error. What is the correct order of flags? I have checked the man page and it shows it as preceding the [user]#[domain] section, however, this throws an error as well.
Edit:
More information and raw terminal output:
$ ssh mysite.com -p42586
--hangs--
$ ssh mysite.com -p 42586
--hangs--
$ ssh -p42586 mysite.com
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user#]hostname [command]
$ ssh -p 42586 mysite.com
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
/usr/bin/ssh: option requires an argument -- p
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user#]hostname [command]
Examples 1 and 2 hang until timeout. 3 and 4 produce a grep usage echo as well as an ssh usage echo.
Edit 2:
Thanks for the suggestion #topguncoder my original attempt was the colon notation - but that produces a different error:
$ ssh myuser#mysite.com:42586
ssh: Could not resolve hostname mysite:42586: nodename nor servname provided, or not known
Try
"ssh" -p 42586 mysite.com
to ignore your alias settings. It looks like you might have ssh aliased to something else. If this works, you should check your .profile for any ssh aliases.
I believe that on your system, the ssh command somehow was redefined as the grep command. Try this:
alias | /usr/bin/grep ssh
What do you see? Also, try this:
/usr/bin/ssh -p 42586 myuser#mysite.com
Do you have a success connection? If ssh was aliased into something else. Check the following files:
~/.bash_profile
~/.bashrc
~/.profile
You can then remove the alias, or use the absolute path (e.g /usr/bin/ssh)
Related
So lately I have been trying to learn hydra from tryhackme, and tried to use this simple command
hydra -l molly -P /Users/root/Desktop/ctf/rockyou.txt 10.10.161.247 http-form-post "/:username=^USER^&password=^PASS^:F=incorrect" -V
But it does not work and shows
Syntax: hydra [[[-l LOGIN|-L FILE] [-p PASS|-P FILE]] | [-C FILE]] [-e nsr] [-o FILE] [-t TASKS]
[-M FILE [-T TASKS]] [-w TIME] [-W TIME] [-f] [-s PORT] [-x MIN:MAX:CHARSET] [-c TIME]
[ISOuvVd46] [service://server[:PORT][/OPT]]
What am i doing wrong?
I am using Hydra V9.0 on MacOS Mojave.
This is the writeup I am talking about.
You have to specify the directory for the login form.
Try this instead:
hydra -l molly -P [wordlist directory] [IP] http-form-post "login/:username=^USER^&password=^PASS^:F=incorrect" -V
This shall work.
I'm trying to copy file from server to server by running scp command on ec2.
**My command:**
[ec2-user#ip-xx-xx-xx-xxx ~]$ scp -P 51865 user#207.154.xx.xx:/home/yakir/tr/tracker-2019-12-12.tar.gz ec2-user#ec2-3-xxx-xxx-xxx.compute-1.amazonaws.com:/home/ec2-user/tracker-2019-12-12.tar.gz
The error is:
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user#]host1:]file1 ... [[user#]host2:]file2
What should i do to get it works?
Thanks!
ssh to server and run scp
ssh -P 51865 user#207.154.xx.xx "scp /home/yakir/tr/tracker-2019-12-12.tar.gz ec2-user#ec2-3-xxx-xxx-xxx.compute-1.amazonaws.com:/home/ec2-user/tracker-2019-12-12.tar.gz"
I'm trying to bootstrap an amazon aws instance with the command:
knife bootstrap 50.60.71.109 -N {node_name} -d {distro} -E {environment} -x ubuntu -i ~/.ssh/my-key.pem --sudo
but the output I get suggests that it's not using sudo correctly:
52.60.71.109 usage: sudo -h | -K | -k | -V
52.60.71.109 usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
52.60.71.109 usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
52.60.71.109 [command]
52.60.71.109 usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
52.60.71.109 prompt] [-u user] [VAR=value] [-i|-s] [<command>]
52.60.71.109 usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
52.60.71.109 prompt] [-u user] file ...
52.60.71.109 E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
...
The server is an ec2 ubuntu 14.04 instance.
My version of knife is 11.16.4
I made a bash script helpme that contains help configurations tasks that I use daily.
I would like to use it everywhere (even in other machines) with simple running:
$ helpme
I made this for that:(MAC OS)
$ sudo chmod +x helpme
$ sudo mv helpme /usr/local/bin/helpme
If I use bash terminal works correctly but now I'm using oh-my-zsh terminal and it shows me this message:
usage: sudo -h | -K | -k | -L | -V
usage: sudo -v [-AknS] [-g groupname|#gid] [-p prompt] [-u user name|#uid]
usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U username] [-u user name|#uid] [-g groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file ...
If I run with sudo works, but I don't want to use sudo
$ sudo helpme
Edited:
This is an example:
#!/bin/bash
main(){
echo invalid option
}
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
main "$#"
fi
Any idea?
I am trying to do something simple in bash but I cannot get it to work. I have defined the variable:
export devcluster2="10.122.22.22"
in my .bashrc. When I type:
echo $devcluster2 I get as expected:
10.122.22.22
now I want to do:
echo '$devcluster2' | ssh
but I get
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user#]hostname [command]
I want to understand why the ssh doesn't get the output of echo as an input? and how can I get it to work?
To ssh to a host, you use:
ssh 10.122.22.22
If you want to ssh to a host in a variable, you therefore use:
ssh "$devcluster2"
Meanwhile, echo text | command is like running command and then typing in "text". If you to run ssh by itself and wait for an opportunity to enter text, it fails just like it does in your script:
$ ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
...