New home server ssh failed

Everything was working great.

I easily ssh into my ubuntu 22.04 Server physical.

Because of my lack of experience I decided to reformat the server and start again.

I can no longer ssh into the new server install. (.ssh/config: line2: bad configuration option: ssh_option)

I noticed the ssh config files were empty.

Ultimate goal is to ssh into my ubuntu server to configure.

I tried to recreate. ~/.ssh/config which was empty, then pasted what is in there now SEE screenshot.

Tried to uninstall openssh

Server public key is imported?

garuda-inxi
System:
  Kernel: 6.1.65-1-lts arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
    root=UUID=b5c6166b-9eaf-4020-98e9-32d928b43502 rw rootflags=subvol=@
    quiet quiet rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3
    ibt=off
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm
    v: 4.18.0 vt: 7 dm: LightDM v: 1.32.0 Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Laptop System: Acer product: Aspire ES1-531 v: V1.11
    serial: <superuser required>
  Mobo: Acer model: Aspire ES1-531 v: V1.11 serial: <superuser required>
    UEFI-[Legacy]: Insyde v: 1.11 date: 07/21/2015
Battery:
  ID-1: BAT0 charge: 26.1 Wh (100.0%) condition: 26.1/36.7 Wh (71.1%)
    volts: 12.5 min: 11.4 model: LGC AC14B18J type: Li-ion serial: <filter>
    status: full
CPU:
  Info: model: Intel Celeron N3050 bits: 64 type: MCP arch: Airmont level: v2
    built: 2015-17 process: Intel 14nm family: 6 model-id: 0x4C (76) stepping: 3
    microcode: 0x368
  Topology: cpus: 1x cores: 2 smt: <unsupported> cache: L1: 112 KiB
    desc: d-2x24 KiB; i-2x32 KiB L2: 2 MiB desc: 2x1024 KiB
  Speed (MHz): avg: 1520 high: 2160 min/max: 480/2160 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 2160 2: 880
    bogomips: 6402
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx
    Integrated Graphics vendor: Acer Incorporated ALI driver: i915 v: kernel
    arch: Gen-8 process: Intel 14nm built: 2014-15 ports: active: eDP-1
    empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:22b1
    class-ID: 0300
  Device-2: Chicony VGA Webcam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-3:3 chip-ID: 04f2:b47f
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.9 with: Xwayland v: 23.2.2
    compositor: xfwm v: 4.18.0 driver: X: loaded: modesetting
    alternate: fbdev,intel,vesa dri: crocus gpu: i915 display-ID: :0.0
    screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
    s-diag: 414mm (16.31")
  Monitor-1: eDP-1 model: LG Display 0x0456 built: 2014 res: 1366x768 hz: 60
    dpi: 101 gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5")
    ratio: 16:9 modes: 1366x768
  API: Vulkan v: 1.3.269 layers: 5 device: 0 type: integrated-gpu name: Intel
    HD Graphics 400 (BSW) driver: mesa intel v: 23.2.1-arch1.2
    device-ID: 8086:22b1 surfaces: xcb,xlib device: 1 type: cpu name: llvmpipe
    (LLVM 16.0.6 128 bits) driver: mesa llvmpipe v: 23.2.1-arch1.2 (LLVM
    16.0.6) device-ID: 10005:0000 surfaces: xcb,xlib
  API: OpenGL Message: Unable to show GL data. glxinfo is missing.
Audio:
  Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series
    High Definition Audio vendor: Acer Incorporated ALI driver: snd_hda_intel
    v: kernel bus-ID: 00:1b.0 chip-ID: 8086:2284 class-ID: 0403
  API: ALSA v: k6.1.65-1-lts status: kernel-api tools: N/A
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Acer Incorporated ALI driver: r8169 v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: 1000 bus-ID: 01:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp1s0 state: down mac: <filter>
  Device-2: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter
    vendor: Lite-On driver: ath9k v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 bus-ID: 02:00.0 chip-ID: 168c:0036 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  IF-ID-1: pan1 state: down mac: <filter>
Bluetooth:
  Device-1: Lite-On Atheros AR3012 Bluetooth driver: btusb v: 0.8 type: USB
    rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-5.1:7
    chip-ID: 04ca:300b class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 2 state: up address: <filter> bt-v: 4.1
    lmp-v: 7 status: discoverable: no pairing: no class-ID: 7e010c
Drives:
  Local Storage: total: 931.51 GiB used: 166.22 GiB (17.8%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WD10SPZX-00Z10T0 size: 931.51 GiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 5400 serial: <filter>
    fw-rev: 1A01 scheme: GPT
Partition:
  ID-1: / raw-size: 175.39 GiB size: 175.39 GiB (100.00%)
    used: 166.22 GiB (94.8%) fs: btrfs dev: /dev/sda6 maj-min: 8:6
  ID-2: /home raw-size: 175.39 GiB size: 175.39 GiB (100.00%)
    used: 166.22 GiB (94.8%) fs: btrfs dev: /dev/sda6 maj-min: 8:6
  ID-3: /var/log raw-size: 175.39 GiB size: 175.39 GiB (100.00%)
    used: 166.22 GiB (94.8%) fs: btrfs dev: /dev/sda6 maj-min: 8:6
  ID-4: /var/tmp raw-size: 175.39 GiB size: 175.39 GiB (100.00%)
    used: 166.22 GiB (94.8%) fs: btrfs dev: /dev/sda6 maj-min: 8:6
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 7.59 GiB used: 333.5 MiB (4.3%)
    priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 2
    dev: /dev/zram0
  ID-2: swap-2 type: partition size: 9.84 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/sda5 maj-min: 8:5
Sensors:
  System Temperatures: cpu: 46.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Processes: 238 Uptime: 3h 7m wakeups: 0 Memory: total: 8 GiB note: est.
  available: 7.59 GiB used: 3.88 GiB (51.1%) Init: systemd v: 255
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: 1906 pm: pacman pkgs: 1895 libs: 468 tools: octopi,pamac,paru
  pm: snap pkgs: 11 Shell: Bash v: 5.2.21 running-in: xfce4-terminal
  inxi: 3.3.31
Garuda (2.6.19-2):
  System install date:     2022-09-16
  Last full system update: 2023-12-12 ↻
  Is partially upgraded:   Yes
  Relevant software:       snapper NetworkManager mkinitcpio
  Windows dual boot:       <superuser required>
  Failed units:            snap.matterbridge.matterbridge.service 

image
.ssh/config

image

image

Try to see if those files are the issue by moving them to backup.

mv ~/.ssh/config ~/.ssh/config.bak
mv ~/.ssh/known_hosts ~/.ssh/known_hosts.bak

Then try connecting to your server again.

1 Like

image

Please, no more screenshots. Copy and paste the terminal output into the thread as text, then highlight it and click the preformatted text button (</>) to format as a code block.

Your output shows the file you set up earlier in the thread is gone now. Do you know why that is?

1 Like

Ok, OH, I did uninstall openssh in Bauh. I suppose that would delete it. Sorry about that.

Hmm, it should not do that since it is in your home directory. :thinking:

No problem to reinstall it if you still want to connect to your server with SSH.

sudo pacman -S openssh

You do not need the ~/.ssh/config file, that is optional. It is a file you can fill with pre-configured values for connecting to devices more easily, see here: https://wiki.archlinux.org/title/OpenSSH#Configuration

For starters I would just try connecting to it without that file. Do you need a key for this server or can you connect with a password?

ssh *user*@*server-address*
1 Like

There is no change. I am typing the password that I can log directly into the server with. I have verified the password many times.

ssh NAME@192.168.IP
NAME@192.168.IP's password: 
Permission denied, please try again.
NAME@192.168.IP's password: 

That is a different message than you originally shared. Are you saying you have seen this message before?

Just to be clear: NAME here should be the username of the user you created on the server (not your Garuda user). The password should similarly not be your Garuda password, it should be the password of the user on the server.

1 Like

Correct, the name is the only user on the server.

Yes, I have seen this message before.

I have been struggling with this for a about 24 hours lol. The password is the password that I use to log into the server in the bash.

Do you have another way to access this machine? For example, can you connect a monitor and keyboard to it and log in directly?

Yes, It is a laptop but the key board has a few issues. I find that it is not always typing what I think, making it difficult and the reason I want to ssh into it.

(EI if i type anything capitals it will make it small case and I cant find the @ symbol)

I wonder if the password has been set differently than you think, since there is an issue with the keyboard. Try (with the laptop keyboard) typing the password in the plain text field (where the username goes) so you can visually inspect it and see if there are any missing characters or other surprises

It’s the same I type into the ssh

You should inspect /etc/ssh/sshd_config on the server and confirm it is configured to allow password authentication.

2 Likes

Oh, wow that config file is empty. There is nothing in it!

Are you sure SSH has been configured properly on the server? It sounds like maybe there has been a mistake somewhere. Did you follow the same guidance as the first time you set it up?

Yes but I’ll look into it tomorrow its been along day! thanks! I’ll stumble around more tomorrow on the server and make sure its all good on that end again. :grin:

I can’t ssh into anything. I have an ubuntu phone with terminal which I hooked up and it is giving me the same results.

ssh name@192.168.IP
name@192.168.IP: Permission denied (publickey).

This time I did only the key and accepted it but no password.
Next I tried to ssh into my server again after a complete reinstall of ubuntu 22.04 server and accepted the new key. after deleting my keys using.

ssh-keygen -f "/home/pinetar/.ssh/known_hosts" -R "SERVERIP"

ssh name@192.168.IP
name@192.168.IP's password: 
Permission denied, please try again.
name@192.168.IP's password: 
Permission denied, please try again.
name@192.168.IP's password: 
name@192.168.IP: Permission denied (publickey,password).

You’re using ssh-keygen wrong, ssh-keygen you would use to generate a user pair of keys and than use ssh-copy-id to send the users public key to the server to be used for login authentication. But for that you still have to read some more man pages. Your Ubuntu server is set up to handle passwords and ssh keys as you can see by your servers response.
Your servers public key will be saved in know_hosts at first connection, nothing else, not even running ssh-keygen on it. I haven’t done a lot with ssh recently, but on those 2 machines I set up in the past months, a debian included, I ssh with user name into the server, hit enter to save that public server key in known_hosts and than put in my password and hit enter again.
As straight as in Complete Guide to Configuring SSH in Ubuntu

4 Likes

ssh-keygen -t rsa click enter few times for default values
It will be in your user home directory/.ssh/ you should see two files there one with .pub extension, second one is the private key
Next ssh-copy-id -i ~/.ssh/your_key user@host

If still cant connect or have issue with pubkey use chmod 0400 ~/.ssh/public_key.pub of course public key will be your key

Default name for ssh keys should be id_rsa and id_rsa.pub

2 Likes