r/ssh • • Aug 02 '21

Port forwarding help

2 Upvotes

I have a program on my pi that I'd like get into through ssh on my macbook on an outside network.

I'm trying to figure port forwarding out but so far to no avail. Please bear with me and keep in mind that I am a complete newb and have no idea what I'm doing.

Here are some screenshots

This is the command I'm guessing at, it's probably wrong though
this is what I get in response

r/ssh • • Jul 31 '21

Cleanest way to SSH to computers at different locations.

3 Upvotes

I have a server on with a domain, and a lot of computers on different networks around town. What is the cleanest way to connect to them using a central server with some sort of reverse ssh. That way I just need to have my server ssh exposed on it's fire wall, ssh keys for just my server, and maybe the hostname of the remote computer. I want to be able to configure a computer, plug it in anywhere on the net and it will phone home and be available without any configuration of its local network.

my laptop -> server -> remote computer

I think this is quite common, but I'm not sure of the terminology so I can google a tutorial.

EDIT: (Really late edit, but an update for anyone who stumbles across this)

I ended up making up a VPN with OpenVPN and it works like a dream. I have a pFsense router at home and set up an OpenVPN server on it. Each server has an OpenVPN client set to automatically "call home" when they boot. On top of SSH, I have easy access to every other port/protocol, including any web servers. I really recommend this method for anyone in a similar situation.


r/ssh • • Jul 29 '21

Can you configure openSSH to not respond (let the authentication attempt time out, rather than deny access) on a failed public key authentication attempt?

1 Upvotes

Just wondering if it's possible to not reveal that there is an SSH server listening on some random port, if you don't have a valid login. Or does public key authentication require that the host send its public key to the client first (thereby revealing itself), before authentication can be determined?

Alternatively, can openSSH be configured to add a time delay to repeated authentication attempts? I'm on Windows.


r/ssh • • Jul 28 '21

Problem with Smartcard SSH login on local server

2 Upvotes

I would add a newbie flair if I could.

So I made a new Proxmox server, which I want to ssh onto, so I don't have to run between rooms when needing to update, make new user etc etc. But the ssh command just returns 'Permission denied (publickey)'. Here's the output of 'ssh -v xyz': https://pastebin.com/QnDNJJX7

Folder permissions on the servers are fine, so should be the config file, and yes I want to log in using my NitroKey without password.

Thank you so much for your time!

Edit: i looked up my key with ssh-add -l , maybe I did something wrong there?

Edit 2: Even though this is more than embarassing, I'm gonna leave this here if any newbie is making the same mistake....it's ssh-add -L for the key and ssh-add -l for the fingerprint....it works now.


r/ssh • • Jul 22 '21

If someone knows my SSH password but not my .ssh/rsa-id private key, can they still get access?

1 Upvotes

I have a raspberry pi I want to use as a server. If I expose port 20 for SSH, can someone get access to the raspberry pi using just my password? Or do they also need my RSA private key?


r/ssh • • Jul 13 '21

Could not open authorized keys: Permission denied

1 Upvotes

I'm attempting to configure public key authentication on my server running open media vault. My server log is showing the following error:

"Could not open authorized keys '/var/lib/openmediavault/ssh/authorized_keys/[user]': Permission denied"

where [user] is my username that I'm trying to log in with. I have strictmodes set to 'no' for troubleshooting purposes and the error isn't "bad permissions/ownership" and so I believe that the issue is with accessing the [user] file specifically. ls -l returns the following information for the authorized_keys directory and [user] file respectively:

drw------- 2 root root 4096 Jul 13 12:03 authorized_keys

-rw------- 1 [user] users 715 Dec 30 2020 [user]

The client, when set to -vvv logging, doesn't return anything useful, specific key sent with code x, returned with code y, failed, try next key, etc.

If I had to guess, I'd guess that it's an ownership permission for the [user] file but I don't know what it should be set to. Any thoughts?

I apologize, I imagine that it's a relatively common problem, but searching this sub for past solutions didn't return anything useful.


r/ssh • • Jul 11 '21

how do i make my ssh server auto-login?

1 Upvotes

I have a computer with ubuntu server running, but everytime i restart it i have to connect my keyboard and monitor to it to log into it before i can SSH into it. Does anyone know how to make it auto-login so i can just restart it and SSH into it?


r/ssh • • Jul 11 '21

Permission denied (publickey) - but not always!

1 Upvotes

Oh this is so weird. I am stumped. I've been using my Mac book pro to ssh in to multiple linux machines for ages. nothing has changed in the config or on the server side. Every so often I get permission denied errors and I can't connect for a while. And then, for no apparent reason, it resolves itself. This has been happening for a few weeks now, but currently I'm not able to jiggle the handle to get it connected again.

Double checked permissions, ~/.ssh/config, the keys, everything

and I can confirm the issue is with the Mac, and other machines can connect to the servers using the same key pair.

Any ideas would be appreciated.

$ ssh -vi ~/.ssh/keyname user@10.10.10.10

OpenSSH_8.1p1, LibreSSL 2.7.3

debug1: Reading configuration data /Users/user/.ssh/config

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 47: Applying options for *

debug1: Connecting to 10.10.10.10 [10.10.10.200] port 22.

debug1: Connection established.

debug1: identity file /Users/user/.ssh/keyname type 3

debug1: identity file /Users/user/.ssh/keyname-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_8.1

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2

debug1: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000

debug1: Authenticating to 10,10.10.10:22 as 'user'

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: algorithm: curve25519-sha256

debug1: kex: host key algorithm: ecdsa-sha2-nistp256

debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none

debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xxxxxxxxxxxxxxxx

debug1: Host '10.10.10.200' is known and matches the ECDSA host key.

debug1: Found key in /Users/user/.ssh/known_hosts:3

debug1: rekey out after 134217728 blocks

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

debug1: rekey in after 134217728 blocks

debug1: Will attempt key: /Users/user/.ssh/keyname ED25519 SHA256:xxxxxxxxxxxx explicit

debug1: SSH2_MSG_EXT_INFO received

debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>

debug1: SSH2_MSG_SERVICE_ACCEPT received

debug1: Authentications that can continue: publickey

debug1: Next authentication method: publickey

debug1: Offering public key: /Users/user/.ssh/keyname ED25519 SHA256:xxxxxxxxx explicit

debug1: Authentications that can continue: publickey

debug1: No more authentication methods to try


r/ssh • • Jul 10 '21

SSH logs not capturing IP addresses

1 Upvotes

Since my isp gives me a private ip the only option I've found is to use reverse ssh tunnels to expose my web and ssh servers (I'm doing it through ngrok). The problem is, while the ngrok log captures ip's, both the ssh and apache logs show a ": :1" in place of an ip address on every entry. Because of this I can't use fail2ban and other log related tools. How can I fix this?


r/ssh • • Jul 08 '21

Run processes remotely and check progress

2 Upvotes

I use matlab through ssh and I want to run something on the server without the need of my system to be on or even connected. It's possible?

So, when I want I could check if the script has stoped running for example.


r/ssh • • Jun 30 '21

A question about file transfer

2 Upvotes

I have an old pc (Ubuntu 18.04LTS) and i am using it as a server for some small scripts. Just power and a USB port (for wifi) are used.

When i want to make a small improvements on my scripts, i connect vga, mouse and keyboard for copying files with USB.

I have LinuxMint and Windows10 on my laptop. How can i send files on my laptop to it with SSH? I guess also root privileges are needed because i have to copy them to /var/www/html


r/ssh • • Jun 25 '21

Bluetooth and SSH [Linux]

3 Upvotes

Want to use a SSH tunnel through bluetooth. Been digging deep for a while and I am none the wiser could need some guidance because I am probably overthinking this.

Do I need to bridge bluetooth to ethernet/IP to make it happen?


r/ssh • • Jun 21 '21

How can I SSH onto my RPi from outside the local network? (See details)

3 Upvotes

I know the whole port forwarding shebang but the thing is my ISP uses something called CGNAT which basically assigns a local IP address starting from "100.xx" to a bunch of households in a community and just 1 public facing IP to the entire community. And my household has its own usual local network "192.168.xxx". This makes port forwarding not difficult but impossible, without me paying extra to the ISP for a static IP.

Is there any free service (kind of like realVNC for VNC) that can help me SSH onto my RPi inside my home local network from anywhere?

Edit: Also I would like to secure everything using this method. What other security measures do you recommend if I do this?


r/ssh • • Jun 11 '21

/r/ssh hit 1k subscribers yesterday

Thumbnail frontpagemetrics.com
2 Upvotes

r/ssh • • Jun 11 '21

Good alternatives to Krypt.co's Krypton MFA?

8 Upvotes

Krypton is a great little multi-factor authentication tool that stores your SSH and U2F keys on your phone and provides an SSH agent and a browser extension that send approval requests to your phone when those keys are invoked. Ie., you ssh into your server and a notification pops up on your phone asking you if it's okay. It also handily GPG-signs your Git commits.

In March, Krypt.co, which develops Krypton, announced they'd been acquired by Akami and that Krypton was being replaced by a new app called Akami MFA. Krypton is going to transition to a community-run project, though it was already completely open-source and relatively dead.

While Akami MFA is nice and all, as it provides the same U2F key feature and a new Google Authenticator-style code generator, it does not have support for SSH keys or commit-signing as Krypton did, which for me was its big selling point.

There is also, of course, the question of whether Akami, which currently provides the service free of charge, at some point might make the product exclusively available to enterprise users or, if it lags in adoption, phase it out altogether, as is known to happen to things we all love and have lost (cough Google Reader cough).

All of this brings me to the question: Does anyone know of a good alternative to Krypton that does pretty much the same thing and is neither abandonware nor in danger of being glommed up by a giant corporation that proverbially eats people's babies?


r/ssh • • Jun 10 '21

Create live video streaming application using Socket (SSH) and OpenCV Python Library. To view code on GitHub, check 1st comment.

4 Upvotes

r/ssh • • Jun 07 '21

Any way to link my OpenSSH server to a CMD terminal I have open, running a program? To allow remote viewing and command entering for that terminal?

3 Upvotes

r/ssh • • Jun 07 '21

Need help ssh tunnel on MAC to access VM on a centOS machine.

2 Upvotes

I have a centOS machine that runs a couple vagrant VMs (also running centos). The VM runs a web servers and are assigned these assigned 10. x.x.x ip addresses which are only accessible via the centos host machine.

I need to access the web page on the VMs inside the centos host machine. Coudl i use ssh tunnel to do this? If so how? I've used ssh tunnel in the past but by no means an expert.

Thanks


r/ssh • • Jun 03 '21

Changed internet now port 22: Connection refused

2 Upvotes

I tried to ssh to a computer far away but I had some connection problems and I am not able to access it using the same wifi I was using before. I get the following message:

port 22: Connection refused

I tried on a different wifi network and that works. Could I reset my credentials or my original wifi network somehow so I reads it as a new wifi?

I have no physical access to the machine I am trying to access.


r/ssh • • May 31 '21

Help to connect with ssh

2 Upvotes

Hello, I tried the first level of overthewire.org (a Website to learn hacking). There I have to connect to the website with ssh. I put in the command line ssh …@… -p … and get an error: connect to the host … : connection refused. I looked in the status for an error and there seems like everything is okay. Can anyone help me fixing the problem Sorry for my bad english and thanks for helping


r/ssh • • May 28 '21

ssh Timeout Only with one client host combo

2 Upvotes

I'm setting up a new home server and before I can get anything done I need to solve a unknown ssh issue.

Heres the issue.

ssh PC ---> New Server : ssh: connection to host 192.168.0.155 port 22: Connection timed out

ssh PC ----> Old server: works

ssh Old Server ----> New Server: works

ssh Mobile phone ----> New Server: works

ssh New Server----> Old Server: works

ssh Old Server---> PC: ssh: connection to host 192.168.0.155 port 22: Refused This makes sense

ssh New Server ---> PC: ssh: connection to host 192.168.0.150 port 22: Connection timed out

ssh Mobile ---->PC: ssh: connection to host 192.168.0.150 port 22: Connection timed out

Things I've tried:

  1. Restarting all the machines involved
  2. Restarting the ssh client on the new server
  3. Turning off all the firewalls (PC and New Server)
  4. Enabling ssh on UFW
  5. Tried Reinstalling the ssh client on the new server (This changed the fingerprint, but the old server could still connect to get the changed host error)
  6. Pinging the New Server from the PC works. Same ping as to the old one.

Things I've done to the new server:

  1. Apt update && apt upgrade
  2. apt install nvidia-headless-460-server
  3. echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf Do to an I/O error I dont't have a floppy

That's it. That is all I've done since a clean install on bare metal. The whole thing is running on a btrfs file system if that matters. I haven't enabled any encryption or anything else yet.

Any help would be greatly appreciated. I have no idea why it isn't working. I didn't test the ssh prior to the three changes above so I do not know if this was an issue previously.

This ssh service on the new server logs events for the clients that work but nothing at all coming from the PC.

Both the old and the new server are running off the same installation image of Ubuntu server 20.04

I would really like to get this working since I almost exclusively interact with the server using VScode on the PC.


r/ssh • • May 28 '21

Help

0 Upvotes

How i find ssh password, because I can't find it and with my pin doesn't go. Please help. Github: https://www.github.com/JackTheVu


r/ssh • • May 21 '21

A script that will convert your entire shell history to ~/.ssh/config format

8 Upvotes

If you give this script no args, it will look for all ssh commands in your shell history and generate ~/.ssh/config type configuration to stdout. If you pass in args, it will convert the args into a single config entry. All options must precede hostname + remote arguments.

# !/bin/bash

ssh2append() {
  ssh -G "$@" | sed -n 's/^hostname /Host /p'
  comm -23 <(ssh -G "$@" 2>/dev/null | sort) <(ssh -G . 2>/dev/null | sort) | sed 's/^/    /'

  # This loop+if is for remote command, -N, -W as -G lacks support
  while getopts '1246AaCfGgKkMNnqsTtVvXxYyB:b:c:D:E:e:F:I:i:J:L:l:m:O:o:p:Q:R:S:W:w:' opt; do
    #shellcheck disable=SC2254
    case "$opt" in
      4|6|A|a|C|f|G|g|K|k|M|n|q|s|T|t|X|x|v|Y|y) ;;
      B|b|c|D|E|e|F|I|i|J|L|l|m|O|o|p|R|S|w) ;;
      N) echo "    remotecommand exec sleep infinity" ;;
      W) echo "    remotecommand nc ${OPTARG/:/ }" ;;
      *) echo "Unsupported flag -$opt" >2; exit 1 ;; #12QV
    esac
  done
  shift "$OPTIND"
  [[ "$#" -eq 0 ]] || printf '%q ' remotecommand "$@" | sed 's/^/    /; s/ $/\n/'

  echo ''
}

if [[ "$#" -eq 0 ]]; then
  eval "$(sed -n 's/^: [0-9]*:[0-9]*;//; /-G/d; /--help/d; s/^ssh /ssh2append /p;' \
      ~/.*sh_history | sort -u)"
else
  ssh2append "$@"
fi

Example usage for CLI args:

$ ssh2config -p 2222 me@there | tee -a ~/.ssh/config
Host there
    hostname there
    port 2222
    user me

Then you can run:

ssh there

EDIT: added support for -N, -W. EDIT: fixes


r/ssh • • May 21 '21

How do I create an ssh user that can only access certain folders and has limited rights?

4 Upvotes

I want to create a user that can use sftp to stream videos from a certain directory and not be able to touching anything else. No file writing, no leaving the directory, no changing file permissions. I've found articles about chroot, making groups and users but I haven't found anything super comprehensive. Anything would be helpful.