Questions tagged [ssh]

SSH (Secure SHell) is a protocol for securely running commands on a remote computer. Use this tag for questions about configuring, using and trouble-shooting SSH client and server software.

Filter by
Sorted by
Tagged with
1 vote
2 answers
1k views

Get the size of a directory and store it into variable

I try to run a command from a server A to get the size of a directory located on server B. I got a blank result using this command: ssh root@remoteIP -t "size=$(du -hs /var/www/somesite.com/dir1/...
2 votes
1 answer
2k views

Upload and download the files from server without giving the password

I want to download the file from server by using a cron job, so I need to use the scp command without giving the password by keyword. How do I do it?
20 votes
7 answers
149k views

X11 Not Forwarding over SSH ($DISPLAY not getting set)

I am running CentOS/RHEL 6 and having the same issues as described in the referenced question below. I have tried all of the settings suggested in this almost identical question, but to no avail. On ...
0 votes
0 answers
27 views

SSH hangs before login prompt, fixes temporarily on reboot

I recently built a small home server (using Arch, I know it's not suitable for stable environments but I like it) and everything was going smooth but, after a while the server was on, it started to ...
0 votes
2 answers
72 views

How to run for loop over SSH on remote so that variables expand?

If I ls files without a for loop in a remote host everything is fine however, if I capture the ls in a variable and try to echo each file it fails as the variables don't expand/have a value. What I ...
1 vote
2 answers
159 views

Allow SSH connection to machine connected to VPN

My problem: I am using Ubuntu 22.04 with a VPN from ExpressVPN set up using their cli tool, they also provide an ovpn configuration file, so I can tweak the configuration as I please while maintaining ...
1 vote
1 answer
912 views

How to increase /dev/sda2 partition - OVH Server

We have a dedicated server with OVH. We can access the server via SSH and WHM Cpanel. We want to increase the size of the /dev/sda2 partition. It is only 20 GB. And running out of space frequently (...
0 votes
1 answer
109 views

How to get rid of ssh bandwidth limit?

I was playing around with a server I set up myself, running archlinux, and when I tried to retrieve files from it, using scp or rsync, I noticed the download speed was abnormally low, being capped at ...
0 votes
0 answers
35 views

Create Network Interface with SSH Tunnel

My question has already been asked with this exact title, however since new users brilliantly cannot ask further questions in the comment section because of reputation the only viable option that I ...
10 votes
1 answer
22k views

ssh working on all devices but scp from some devices gives "Connection closed" error

Quick version: ssh & scp work from my desktop and laptop computers. From termux on my android phone, ssh works but scp does not. In this case, I get an error about "Connection closed". ...
0 votes
0 answers
25 views

Local port forwarding using SSH only works from some machines

I am setting up an SSH server on Ubuntu 18.04.6 LTS. I am trying to use the server for remotely accessing Jupyter Notebook. For that purpose, I have downloaded an opens-server package. I set up ...
0 votes
0 answers
35 views

ssh-agent doesn't accept passphrase on first load

When there is no ssh-agent process running, when I open my terminal, the ssh-agent is started and it asks me for my passphrase for my private key. Every time I try to enter it, I get an error: Bad ...
6 votes
3 answers
10k views

ssh stuck at expecting SSH2_MSG_KEX_ECDH_REPLY

I faced this issue on a server in another country. I changed mtu to values between 1200 and 1500 but nothing changed. I reinstall openssh but nothing happened. please help. tnx.Also forcing ...
1 vote
0 answers
137 views

File sending failed on Linux but works on Windows

I am behind an unknown network and connect to a server through that network and ssh. File transferring worked OK at first, but the network provider made some changes, and after that I faced problems ...
3 votes
2 answers
4k views

How to show "number of failed login attempts" on a successful ssh login?

I use CentOS 7 on a host. There used to be a report of the number of failed login attempts shown whenever I logged into the machine using SSH. The full banner was something like this: Last failed ...
0 votes
0 answers
67 views

How to force TCP window scaling using SSH?

Inter continent data transfer's speed is maximum 2MB/s. I checked and the SSH server of my server doesn't even use window scaling, and the window itself is very small, around 22KB... Flags [S], seq ...
0 votes
1 answer
68 views

Can we use bi-key authentication with dovecot & thunderbird?

I run the dovecot imap server and use thunderbird as frontend. The access is password protected, and I see zillion login attempts with leaked passwords. I would like to switch to bi-key authentication ...
1 vote
1 answer
3k views

SSH Public Key Authorization error Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

I am trying to SSH onto my server with the command ssh -i key.pem ec2-user@ip_address as I did with no issues last week but this week it is giving me an error of only ec2-user@ip_address:Permission ...
0 votes
2 answers
70 views

Fedora SSH client sends RST after 3-way-handshake

I have a client running Fedora 38 and OpenSSH_9.0p1, OpenSSL 3.0.9 30 May 2023. The server is an old Buffalo NAS running Debian 11.8 Bulleye, it has OpenSSH_8.4p1 Debian-5+deb11u3 and OpenSSL 1.1.1w ...
1 vote
1 answer
413 views

Excessive SFTP CPU usage with chroot enabled when using the official Docker repository

I have a fairly niche problem involving Docker, Fedora 37, and a 500M+ pull SFTP image, atmoz/sftp. I installed Docker from the official repository, instead of Fedora's, and when I try to log into the ...
2 votes
0 answers
77 views

ssh-agent with multiple keys

I have a script which retrieves private keys from a repository database and adds them to the ssh-agent with ssh-add - <<<"----My Private Key----" The keys don't get stored on the ...
0 votes
1 answer
3k views

XAUTHORITY environment variable empty in ssh session

When I enter an SSH connection to a Linux host, the XAUTHORITY environment variable is unset. If I run sudo -b, the connection is dropped, unless I add a nohup command immediately after, in which case ...
0 votes
2 answers
266 views

Issue with SSH Client Alive Interval in sshd_config

We are currently using SSH for our project, and we need to implement a feature where SSH users are logged off after 1 minute of inactivity. Below are excerpts from our ssh_config and sshd_config files:...
1 vote
2 answers
4k views

Unable to connect to Linux VM from Windows 7 Desktop

ssh destination: --VM : Oracle VM Virtual Box 4.3.20 --Linux installed on VM: Fedora 22 (IP: 10.0.2.15 ) ssh source: --Windows 7 Desktop I installed putty on Windows 7 Desktop and am trying ...
1 vote
2 answers
99 views

Multiple ssh sessions with different users

I am writing a script that connects to multiple servers which uses 3 different users. #!/bin/ksh server1=("abc1" "abc2") server2=("abc3" "abc4") server3=("...
6 votes
1 answer
4k views

SSH ClientAliveCountMax setting does not seem to work and to disconnect the user

I have configured my Ubuntu Linux server /etc/ssh/sshd_config file as follows: ClientAliveInterval 60 ClientAliveCountMax 60 I would suppose that the server would send 60 null packets at 60 seconds ...
1 vote
3 answers
850 views

Why do I not need to start an SFTP Server ( why does SSH automatically start SFTP )?

Question When I start SSH server, my Debian automatically start the SFTP server as well - why is it design in such way? Environment: Linux 5.10.0-14-amd64 Debian 5.10.113-1 (2022-04-29) x86_64 GNU/...
2 votes
1 answer
2k views

SSH connection refused. Error 61

So, I set up another FreeBSD server. Everything was ok until I tried to connect to it via my old FreeBSD. On connection it echoes: Unable to connect to relay host, errno=61 ssh_exchange_identification:...
6 votes
1 answer
4k views

Running sshd in cygwin: "/var/empty must be owned by root..."

I installed OpenSSH on my Windows 7 system so I could tunnel my VNC into it from my Arch machine. However, when I run /usr/sbin/sshd -D on the W7 machine, I get the error: /var/empty must be owned by ...
1 vote
2 answers
68 views

Can't SSH in to remote server due to bad config

I wrote a bad SSH config on a remote server while setting up Git and now I cannot access the server. Here is the error: /users/<user>/.ssh/config: line 2: Bad configuration option: ...
2 votes
1 answer
3k views

New User unable to login via ssh

I'm trying to set up two new accounts in a Redhat 6.10 environment. The first account that I created works fine no issues. I used the same steps and the second account is unable to login via ssh with ...
0 votes
0 answers
24 views

Mounted point for a RAID drive not available when logging in via SSH

In my machine, I mounted a mdadm RAID array using sudo mount /dev/md0 /mnt/raid. Mounting is successful and I able to access the drive. RAID assembly is also successful and has a clean state. I used ...
3 votes
3 answers
3k views

Error “Can't assign requested address” when ssh-ing to remote server

On ubuntu 14.04 I have installed openssh, changed the ssh port. I can login within LAN with no problems, but I cannot access it from outside. I also have: allowed it though firewall and set up port ...
8 votes
1 answer
5k views

bash like autocompletion for ssh command in zsh shell with /etc/hosts file?

zsh is great so far. I am using zsh-completions but still I am unable to get autocompletion for ssh commands like in bash as shown in below screenshot: How to get hostnames from /etc/hosts for ssh | ...
2 votes
3 answers
3k views

behavior of ServerAliveInterval with ssh connection

Using ssh I am logging to another system and executing scripts there that creates new machines, and do some setups. It takes around 7-8 hours. So what happened is, the ssh connection keeps dropping ...
183 votes
9 answers
406k views

What does the Broken pipe message mean in an SSH session?

Sometimes my SSH session disconnects with a Write failed: Broken pipe message. What does it mean? And how can I keep my session open? I know about screen, but that's not the answer I'm looking for. I ...
2 votes
1 answer
3k views

HPC ssh "connection closed by remote host"

My HPC installed LSF job scheduler. I logon the login node (I use xshell) and using interactive job submission command bsub -Is csh Thus, I entered one of the HPC node, for example c01 node Then I ...
1 vote
0 answers
27 views

How to port forward to a different ip-address on the same network interface?

I have 3 systems spread accross 2 networks: computer 1 with 1 NIC: with ip-address 192.168.10.22 computer 2 with 1 NIC: with ip-address 192.168.10.30 and 192.168.11.30 computer 3 with 1 NIC: with ip-...
5 votes
3 answers
4k views

Seahorse / GNOME Keyring does not recognize my new ed25519 SSH key, is there another way to have the key unlocked upon login?

I am unsure if I did the whole procedure right, so let's start with what I've done: $ ssh-keygen -vvv -o -a 1000 -t ed25519 -f ~/.ssh/id_ed25519 -C "$(whoami)@$(hostname)--$(date -I)" with some real ...
1 vote
1 answer
6k views

StrictModes enable or disable in sshd_config in Linux

I have got question for you. I need to solve this problem. I have got folder /keys which chmod 755 on /keys folder and ACL right such as setfacl -d -m u:myadmin:rwx /keys In /keys folder are others ...
1 vote
1 answer
118 views

X11 does not forward everything

I know there are many variations on this question, but I could not find a solution to this exact scenario. Setting: local computer, remote computer (on the same local network). On the local computer (...
1 vote
0 answers
664 views

no way to see log from sshd

I've already tried to follow the solutions from Where are my sshd logs?, in particular I have: changed /etc/ssh/sshd_config by setting SyslogFacility to AUTH or AUTHPRIV and LogLevel to VERBOSE or ...
35 votes
12 answers
324k views

Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code: set timeout 30 /usr/bin/ssh -p 8484 ...
6 votes
2 answers
10k views

How do you mitigate the Terrapin SSH attack?

The Terrapin Attack on SSH details a "prefix truncation attack targeting the SSH protocol. More precisely, Terrapin breaks the integrity of SSH's secure channel. By carefully adjusting the ...
0 votes
1 answer
81 views

Custom ssh properties with sshd socket

I recently changed to Ubuntu Sever 23 from Ubuntu Server 20 and want to adapt my SSH configuration on the new system the same way it was on the old system. I had several custom properties in /etc/ssh/...
3 votes
2 answers
2k views

Loading OpenSSH certificate into ssh-agent without the private key

I'm storing my ssh keys on a yubikey and hence I don't have any private key file on disk. This gives me a problem when I'm also using OpenSSH Certificates to authenticate. If I would like to bring the ...
0 votes
1 answer
85 views

systemd service for ssh-agent with loading of identity files for each login

I am trying to set-up an automated way to load my ssh keys at login. I have the below configured: ❯ cat .ssh/config Host github HostName ssh.github.com User git Port 443 AddKeysToAgent ...
1 vote
3 answers
1k views

SSH hangs while connecting to Github

This started happening recently. I can't connect to github using ssh. I can connect to other machines on my local network and I can use a different computer to connect to github using the same ...
0 votes
1 answer
921 views

When all SSH sessions have been idle for more than a minute, shut down the machine

Idle is defined as when no foreground program is running and the terminal is waiting for user input, but the user does not make any input. Actually, my ultimate goal is: shutdown when all SSH sessions ...
0 votes
1 answer
84 views

expect script sending password before prompt

I have written a small expect script for automatic ssh to remote server. But sometimes my expect script don't work. Actually it sends password before password prompt. Here is my script #!/usr/bin/...

1
3 4
5
6 7
162