date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,461,309,630,000 |
Setup:
I have a system in bash where I have a single file that spawns off a pipeline of background processes.
In stage one of the pipeline, there are multiple processes writing to a single named pipe. In the next stage of the pipeline there is a reader process which reads the named pipe and passes the data off to oth... |
It shouldn't interfere with the named pipe, but it does interfere with stdin, namely trying to read from it. When you call stage2_worker, stdin is redirected from the pipe, that carries on the to the ssh process.
while true; do
if read QUEUE_DATA ; then
stage2_worker $QUEUE_DATA &
fi
done < $QUEUE
f... | Does ssh client interfere with named pipes? [duplicate] |
1,461,309,630,000 |
Say an authorized key is restricted to the command to test parameters, eg command="bin/testparameters" and the ssh call is:
ssh user@host 'some parameters which may include other commands'
How can bin/testparameters read the value 'some parameters which may include other commands'.
|
The additional parameters passed to ssh appear in the environment variable SSH_ORIGINAL_COMMAND:
$ tail -1 .ssh/authorized_keys
command="printf '%s\n' \"$SSH_ORIGINAL_COMMAND\"" ssh-rsa AAAA....kz6C5 [email protected]
$ ssh [email protected] foo bar farkle
foo bar farkle
| When an SSH authorized key is restricted to command how can the command read the parameters in the call? |
1,461,309,630,000 |
I'm trying to troubleshoot a sudden outbreak of short-lived SSH connections. These connections are initiated from my Mac (MBP, Catalina 10.15.6, zsh) to some of the Linux "appliances" that live on my network here - in particular the Raspberry Pies. After the connections terminate, they leave the message client_loop: s... |
See this answer.
From the man page:
When ssh-agent
is started, it prints the shell commands required to set its
environment variables, which in turn can be evaluated in the
calling shell, for example eval `ssh-agent -s`
So running ssh-agent just shows the commands to set the environment variables, not actually sets... | Why does `ssh-agent -k` not kill ssh-agent (macOS), or why is `SSH_AGENT_PID` not set? |
1,461,309,630,000 |
When I run:
ssh-keygen -t rsa
to generate a public/private key pair in files e.g. id_rsa.pub and id_rsa, my understanding is that the public key encodes a prime number p, and the private key encodes a number pq. But when I open these files I don't see human-readable numbers, I see sequences of characters. So my quest... |
The ssl keys (private and public) are usually stored in so named PEM format.
Privacy-Enhanced Mail (PEM) is a de facto file format for storing and
sending cryptographic keys, certificates, and other data, based on a
set of 1993 IETF standards defining "privacy-enhanced mail." While the
original standards wer... | What encoding is used for the keys when using `ssh-keygen -t rsa`? |
1,461,309,630,000 |
I'm using OpenSSH_5.8p1 in my machine,I'm connecting my machine using putty client but its slower so I have ran sshd in debug mode and found following messages can any one explain me in detail about each messages?
debug1: sshd version OpenSSH_5.8p1
debug1: read PEM private key done: type RSA
debug1: private host key:... |
This question sounds like a case of the XY problem; you're asking for something that probably doesn't help you with the problem you actually want to solve. Perhaps you should be more careful what you ask for, but for the sake of general knowledge, here goes..
debug1: sshd version OpenSSH_5.8p1
This indicates that ... | Understand debug messages from sshd [closed] |
1,542,878,501,000 |
When I use netcat to connect to an SSH port of a Debian system (nc host 22), I got the response SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u1. What does this Debian-10 mean? The host is on Debian 9.
|
It simply reflects the Debian revision of the package currently in Debian 9; see the package page for details. The current version is 1:7.4p1-10+deb9u1; you can ignore the “1:”, then “7.4p1” is the version of OpenSSH, and “10+deb9u1” means this is the tenth release of the Debian package, updated for Debian 9 for the f... | What does the "Debian-10" mean in the response of the ssh server "SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u1" mean? |
1,542,878,501,000 |
My users are shared across a number of machines via LDAP.
For one of those machines (let's call it 'fileserf'), I would like to restrict some users in what they can do (actually: prevent them from logging into an interactive session via ssh).
On the other machines, these users should be able to use ssh normally.
So my... |
The rssh manpage indicates it should be the login shell of these users:
The system administrator should install the shell on the restricted
system. Then the password file entry of any user for whom it is
desireable to provide restricted access should be edited, such that
their shell is rssh. For exampl... | Make sshd override login shell of a group of users |
1,542,878,501,000 |
I'm writing a shell script for copying a file from a remote host to a local directory using scp. In case the target directory does not exist, I'm getting a misleading error message. i.e.:
scp user@remote-host:/path/to/existing/file /local/non-existing/directory/
The error I'm getting is:
/local/non-existing/directory... |
Bug
Found the related bug. It seems to be fixed in Ubuntu 14.04.5 (openssh 1:6.6p1-2ubuntu2.8)
There's an explanation on a Redhat bug report :
This problem is also in original openSSH and appears when you try to
copy something into non-existing directory with existing parent
directory. There is missing check for... | Copying file using scp to non-existing local directory - misleading error message |
1,542,878,501,000 |
If I want to specify for LAN addresses that I don't want to deal with host keys, how do I do that?
/etc/ssh/ssh_config
Host 192.168.*.*
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
or
UserKnownHostsFile none
even with
CheckHostIP no
Isn't doing the trick. openssh 7.1p1. With no known_hosts file in ... |
Seems like your solution on openssh mailing list seems to be quite bearable. Reposting also here:
Match exec "ping -q -c 1 -t 1 %n | grep '192\.168\.'"
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Source: http://lists.mindrot.org/pipermail/openssh-unix-dev/2015-August/034335.html
| Disabling openssh host key checking on LAN |
1,542,878,501,000 |
Does ssh-copy-id recognize if the authorized_keys file is not in ~/.ssh? I am storing my authorized keys file in a different folder, which I have configured as:
AuthorizedKeysFile /mnt/sd_ext/.ssh/authorized_keys
But running ssh-copy-id on a client machine still causes the file to be created in ~/.ssh. Am I missing s... |
ssh-copy-id is actually a shell script as can be seen:
$ which ssh-copy-id
/usr/bin/ssh-copy-id
$ file /usr/bin/ssh-copy-id
/usr/bin/ssh-copy-id: POSIX shell script, ASCII text executable
It’s a fairly simple script and the .ssh/authorized_keys path is hard-coded as the script isn’t written to deal with non-standard... | ssh-copy-id doesn't copy to non-default location |
1,542,878,501,000 |
I am using openSuse 12.3.
I have created a new user using:
linux-amvn:~ # useradd -m -G users,dev -s /bin/bash -p pass123 harbir-PC
The user harbir-PC is not able to login, when I try to log using ssh.
I went ahead and looked into the /etc/passwd file and I see the following:
harbir:x:1000:100:harbir:/home/harbir:/bi... |
I usually run passwd after useradd to set the password as I want it. But if you are provisioning and doing this from a script you may need to use crypt and provide the encrypted password on the command line.
| openSuse, new user cannot login |
1,542,878,501,000 |
We have encountered a security threat in one of our RHEL servers which says the SSH server is configured to use Cipher Block Chaining.
As far as I know, the RHEL systems provide security updates through their RHN satellite which can be achieved just by running the yum update command. But, how can I know if the securi... |
You can check this with yum-plugin-security:
--cve This option includes packages that say they fix a CVE - Common
Vulnerabilities and Exposures ID (http://cve.mitre.org/about/),
Eg. CVE-2201-0123.
So try:
yum --cve <Your CVE here> info updates
And you can check the changelog coressponding to the packa... | check if latest openssh patch provided by RHEL is installed |
1,542,878,501,000 |
CentOS 5.x
When I enable the Banner /path/to/banner parameter in my sshd config file, the banner displays AFTER the login as: prompt.
For example:
login as: foo
***********************************************************
Test Example SSH Banner Text
This is a test
Example 12345
*************************************... |
This is caused by your client rather than the server. The login as: prompt is PuTTY's own, and it won't display the banner before a username is entered. If you're using shared keys, then the banner will be displayed at key exchange time, even if the key goes on to be rejected.
| How can I have a SSH banner appear BEFORE the "login as:" prompt? [duplicate] |
1,542,878,501,000 |
A user (user1) on an Ubuntu 12.04 desktop has two SSH RSA keys configured: ~/.ssh/id_rsa and ~/.ssh/id_rsa1 (and .pub files). Both public keys are configured in the authorised keys on the server's account (user1@myserver).
When logged on to the desktop (client) machine, and using a Gnome Terminal, logging on to the se... |
It turns out that the key that didn't work wasn't configured properly in the authorized_keys file after all. Sorry about that...
I wrongly assumed that ssh -i /home/user1/.ssh/id_rsa user1@myserver was an indication that it was configured properly, but this turns out not to be the case. It makes use of other keys too.... | SSH public key login: two different keys and SSH_AUTH_SOCK behaviour |
1,542,878,501,000 |
I installed openssh via brew install openssh.
I added the following to my .profile:
export SSH_AUTH_SOCK="~/.ssh/agent.$HOST.sock"
ssh-add -l 2>/dev/null >/dev/null
if [ $? -ge 2 ]; then
ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null
fi
And then I have to do the following:
ssh-add ~/.ssh/id_ecdsa_sk
Enter passphrase for ... |
Keychain integration is a feature added by Apple that is not in the standard release of OpenSSH. As you have now installed the standard OpenSSH release from HomeBrew, you won't have this functionality anymore. You have discovered this as the UseKeychain option now gives configuration errors - adding the IgnoreUnknown ... | MacOS: Installed openssh via brew, how do I add keys to keychain? |
1,542,878,501,000 |
The setup:
Raspberry 3B running Raspbian Stretch 9 on an external HDD and using ZRAM
Raspi used as a webserver running LAMP and MERN stacks and accessed remotely via SSH with 1 IDE (Coda for Mac OS)
SSH port forwarded by router with static IP
fail2ban running
The problem:
When accessing the raspberry from a remote l... |
Long story short, my problem had nothing to do with a network issue and was fixed by examining the syslog.
In details:
I noticed that none of the webapps (via LAMP or MERN stacks) while up and running before the issue started, were not reachable anymore.
So I dug up the syslog with the tail -f -n X /var/log/syslog com... | SSH "kex_exchange_identification: read: Connection reset by peer" |
1,542,878,501,000 |
I want to install openssh-server on my server, but it shows me :
apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssh-server is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packag... |
You may want to try purging the installation and cleaning up apt a bit.
Try:
sudo apt-get remove openssh-server openssh-client --purge && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get update
If you don't have any reason not to upgrade packages then also try:
sudo apt-get dist-upgrade
You can then t... | How to install openssh-server on my server? |
1,542,878,501,000 |
OpenSSH's display format for host key fingerprints has changed recently - between versions 6.7 and 6.8. When connecting to a new host, the message now looks like this:
user@desktop:~$ ssh 10.33.1.114
The authenticity of host '10.33.1.114 (10.33.1.114)' can't be established.
ECDSA key fingerprint is SHA256:9ZTSzJsnk0b... |
Use
ssh -o FingerprintHash=md5 10.33.1.114
to get the old-md5 fingerprint from the client.
| Verify host key fingerprint in old format |
1,542,878,501,000 |
I am using OpenSSH chrootdirectory feature to give access to a user via ssh.
Can this user exit the jail and return to the normal OS environment? Maybe with su?
|
If the user does not have root access (or any way to gain it, such as exploiting an insecure setuid program), escaping a chroot jail should be impossible.
With root access, escaping a chroot jail is trivial. In fact, the chroot(2) manpage even gives instructions:
This call does not change the current working director... | Chroot user exit jail [duplicate] |
1,542,878,501,000 |
In Crux Linux I already have installed SSH but when I use ssh-keygen, and try to use the command:
ssh localhost
to test SSH I get this error:
# ssh localhost
ssh: connect to host localhost port 22: Connection refused
#
So I decided to reinstall openssh but without apt-get I don't know how to do that.
|
You have the client (and, I believe, also the server) installed. But you're not running the server on your machine (it's not started by default on Crux).
Add sshd to the SERVICES setting in /etc/rc.conf. See the handbook. This will take care of starting the SSH server at boot time. For now, run /etc/rc.d/sshd start.
A... | How to install openssh in Crux Linux |
1,542,878,501,000 |
Is this even possible or is there a bug with openssh?
I had a problem with a compiler, and to allow the compiler's developer to replicate the result I created a remote server. The crazy thing is me running the same command on the same remote machine with the same user resulted in a different output than his. What coul... |
ssh has an option to transfer some environment variables from the client to the host (SendEnv on the client side ssh, AcceptEnv on the server side sshd). It might be that some environment variables you have on the client side are transferred to the server which causes this problem, and the other user doesn't (or has d... | Same ssh command gives different results to different local machines |
1,542,878,501,000 |
Given the following ssh.cfg:
Host bastion
Hostname xx.yyy.169.100
User ubuntu
IdentityFile ./the-key.pem
Host 10.250.*.*
ProxyJump %r@bastion
User core
IdentityFile ./the-key.pem
The attempt to connect to the server via the bastion is failing, because ssh applies wrong username:
$ ssh -vvF ssh.cfg 10.250... |
The %r part of your ProxyJump entry is being substituted for the username of the remote machine you are currently trying to ssh into (core). You just need:
ProxyJump bastion
so that it uses the default username for your bastion entry. See the OpenSSH Cookbook for more information.
| SSH ProxyJump applies wrong username |
1,542,878,501,000 |
I keep a local git repo at a remote host gitserver deployed to my LAN. When I am away from home I have to access that server through the LAN's external IP. (The router does not offer loopback).
At home my LAN DNS resolves gitserver to the LAN address but when I'm away, I put gitserver to my /etc/hosts file as the exte... |
The |1|b64|b64 format in ~/.ssh/known_hosts is a hashed hostname; see HashKnownHosts in man 5 ssh_config and -H in man 1 ssh-keygen. Using this format is optional; if you want it, see -H in man 1 ssh-keyscan
Note that if anyone intercepts your first connection from a given machine to what you think is the correct addr... | SSH add key to known_hosts from ssh-keyscan |
1,542,878,501,000 |
I have an issue where my server is not able to ssh to a cisco device after upgrading the server to the latest version.
I did a ssh -vvv, I am not sure about two sections. Below are the details :
I want to know the meaning of ciphers ctos and ciphers stoc
ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256... |
Your upgraded OpenSSH no longer includes diffie-hellman-group1-sha1 as a key exchange algorithm by default, yet that's the only key exchange algorithm that the Cisco device is offering.
The quickest work-around would be to tell your SSH client that it's OK to use diffie-hellman-group1-sha1 in communication with that d... | ssh to Cisco device not working [duplicate] |
1,542,878,501,000 |
Is there an easy way to generate hashed hostnames to be added to the ~/.ssh/known_hosts file?
I'd like to add a @cert-authority line to the ~/.ssh/known_hosts file.
Obviously the ssh-keygen command would not get the CA cert.
I think it also needs a connection to the server,
and I'm not sure I can get it to hash a wil... |
If you want to change the hostname for an existing hashed host, edit your known_hosts file, replacing the hashed hostname with the plaintext hostname you wish associated with that key, and rehash the file:
ssh-keygen -H
If you want to generate hashes for a list of hostnames without disturbing your known_hosts, creat... | Generate hashed name for SSH known_hosts |
1,542,878,501,000 |
What is a good configuration to allow ssh root access in order to set up your server? Most of the time I have the connection closed but maintenance and setup requires as such.
I've been using the same configuration for the past 15 years; FreeBSD mostly.
|
Don't allow SSH root access on your server. Allow only a small subset of nonprivileged users; have them added to the sudoers file so they can sudo root.
Here's an example of what you should have on your /etc/ssh/sshd_config:
PermitRootLogin no
AllowUsers ahr 13nilux dr01
If you disable password-based authen... | SSH root access configuration |
1,542,878,501,000 |
How to log the Protocol, KexAlgorithm, Cipher and MAC algorithm negociated by the client and the client's user agent string?
What I'm looking for is the OpenSSH equivalent to Apache HTTPD's CustomLog+LogFormat+mod_ssl %{SSL_PROTOCOL}x %{SSL_CIPHER}x + %{User-agent}i
I want to log (on the server side) the same informat... |
Use at least LogLevel DEBUG to see these message in the server log. Also do not forget to restart the sshd service after the change.
sshd[31049]: debug1: Client protocol version 2.0; client software version OpenSSH_6.0p1 Debian-4+deb7u3
sshd[31049]: debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
sshd[... | OpenSSH accesslog : Logging ciphers, MAC and user agent |
1,542,878,501,000 |
I'm using a new system and ssh is ignoring my ssh-agent. Note I've been doing this for years elsewhere, it is not a new thing I am confused about. With bash:
> echo $SSH_AGENT_PID
1234
> echo $SSH_AUTH_SOCK
/tmp/ssh-foo/agent.1234
> ps -p 1234
PID TTY TIME CMD
1234 pts/12 00:00:01 ssh-agent
So, ssh-ag... |
It is a new feature, presumably for 7.x. It required adding the key type to /etc/ssh_config using this option:
PubkeyAcceptedKeyTypes +ssh-dss
RSA keys are accepted by default (see man ssh_config), which is why it worked in one case but not another (being root was a red herring factor and I've removed this from the q... | ssh ignores ssh-agent |
1,542,878,501,000 |
Used for a few years arcfour as default cipher for SSH2 connection in my ~/.ssh/config file
host namaka
hostname localhost
port 2022
ciphers arcfour
IdentityFile ~/.ssh/virtualbox
compression true
StrictHostKeyChecking no
user kermit
After an upgrade to Debian 8 I have discovered this cip... |
I've found the culprit: it was a bash alias I created a few years ago and then forgot
alias scp='scp -c arcfour'
Shame on me
| scp does not honor .ssh/config |
1,542,878,501,000 |
Our accounts in our lab are all mounted over NFS and are accessible over all the systems in a subnet. So, effectively we can ssh into any of the machines in the subnet and continue our work. The problem is that the machines come up or go down randomly because of people accidently turning it off etc. To find running ma... |
The Host directive can take multiple hosts, for example:
Host *.domain.tld specific-host.tld 10.*.*.*
User foo
Port 2222
This would set user and port for all hosts matching the star pattern,
the explicit host specific-host.tld, or, assuming you type IP
numbers, any host whose first IPv4 byte is 10. Then you can add H... | Use a dynamically obtained hostname with an ssh config entry |
1,542,878,501,000 |
I am not sure what's causing this, but it's mildly frustrating.
I'm sshing into my machine (Ubuntu 21.10) and invoking a tilix session to my client machine. I trying to run an app (from within tilix remotely), I need to run which should prompt for a password. The machine is running a GUI (kded5), but that shouldn't ma... |
Well it's not perfect, but I had to settle for the hints here...
The problem was mainly stemming from my signing code to github, which when I attempted to commit code, a dialog box was being created in my GUI, but I couldn't or wasn't seeing that from my Xserver. It was popping it up off-screen. So I needed to force c... | Force password prompt to work in terminal instead of GUI |
1,542,878,501,000 |
I'd like to configure an SSH Daemon on one of my servers so that certain users on remote clients can execute certain commands on the server. Each user, identified by a certain public key, must be able to execute a command specific to him.
In general, there seem to be many options to do this, three of them being:
Forc... |
If you use a recent enough openssh server (>= version 7.2), then you get the option restrict in the authorized_keys file:
restrict
Enable all restrictions, i.e. disable port, agent and X11 forwarding, as well as
disabling PTY allocation and execution of
~/.ssh/rc. If any future restriction capabilities are added ... | Relationship between options in authorized_keys and options in sshd_config? |
1,542,878,501,000 |
When I try to use up-arrow command history via sftp to my CentOS 7 server it just prints ASCII characters to the output instead of recalling recent commands:
sftp> ^[[A
It's very time consuming and annoying to have to retype commands all the time. Is there also a way to enable something similar to bash-completion?
|
Credit to @steeldriver who pointed out libedit is needed. So it was simply a matter of adding the libedit USE flag for portage. I added it locally like so:
# /etc/portage/package.use
>=net-misc/openssh-7.7_p1-r9 libedit
And then rebuilt OpenSSH:
$ emerge -av net-misc/openssh
Additionally, this requires bash-comp... | How to enable up-arrow command history and command completion in sftp on Gentoo? |
1,542,878,501,000 |
I would like to login to 127.0.0.1 via SSH without using a public key and password. sshd_config and log files are provided below, so here's just a quick outline:
The user accounts password is deleted with passwd --delete, i. e. login is possible without password
PasswordAuthentication and PermitEmptyPasswords is gene... |
In your PAM configuration (which is distribution specific) make sure that pam_unix.so line for sshd has the nullok argument, e.g.:
auth required pam_unix.so try_first_pass nullok
Otherwise pam_unix will prevent this, cf. the pam_unix man page:
The default action of this module is to not permit the user access ... | Keyless, passwordless SSH login on localhost not possible, PAM relation assumed |
1,542,878,501,000 |
In /etc/ssh/sshd_config I uncomment option PasswordAuthentication no and restart the service via service sshd reload. But password authentication is still available. Why?
|
The debug log (run ssh with -vvv arguments) would give you more clue about what is going on in the connection.
The password authentication is not the only one which can prompt you for some kind of password. There is always keyboard-interactive, which behaves very similarly and is usually used by PAM. It is controlled ... | ssh disable password authentication |
1,542,878,501,000 |
Using the default OpenSSH sshd package for Debian, is there any way to configure it to treat every username as being the same?
For instance, if someone connected with a random username (ie: 8LaRiQRd8Qjh), which did not exist as a Linux user, could I configure sshd to treat that as some consistent username like "testus... |
I have no idea why you're trying to do this, and it seems like a terrible idea.
That said, for some reason the question got me hooked and I needed to find an answer.
The short answer is that this can't readily be done by simply configuring the available packages in debian.
If you want to do this you have to write two ... | Configuring an OpenSSH shell for any/every connecting username |
1,542,878,501,000 |
Basic setup:
- Operating System: CentOS 7 (64 bit)
- Grub 2
- separate boot partition with ext4
- luks encryption (aes-xts-plain64:sha512) on two disc partitions which both need to be unlocked by password at boot time
- after being unlocked both partitions are mounted on / as raid1 btrfs filesystem
Right now I am lo... |
So is dropbear really like the right and only choice for remote access during boot time?
I did some additional research on dracut which is used to build the initramfs image on CentOS and it shows the option "--sshkey " which needs to be combined with the module load option "ssh-client" in /etc/dracut.conf.
It looks to... | How to use openSSH for disc encryption at boot time (OpenSSH vs. Dropbear) |
1,542,878,501,000 |
I found missing information in the manpage for scp when using IP6: there is no hint that you have to use slash masked brackets around the IP when using scp -6:
scp -6 user@\[2001:db8:0:1\]:/tmp/test.file /tmp
How can I submit a change to the scp manpage?
|
The information you seek is here:
COLOPHON
This page is part of the openssh (Portable OpenSSH) project. Informa‐
tion about the project can be found at
http://www.openssh.com/portable.html. If you have a bug report for
this manual page, see http://www.openssh.com/report.html. This page... | Submit an updated manpage |
1,542,878,501,000 |
There are six key files in /etc/ssh directory for private and public keys. 4 of them are for DSA and RSA public & private keys. but there are two more files named ssh_host_key and ssh_host_key.pub, what are these keys?
|
ssh_host_key is the private key if you use the SSHv1 protocol and ssh_host_key.pub is the matching public key.
It should be a RSA key.
If you use SSHv2 you chose between multiple signing algorithms like DSA, RSA and ECDSA and then the ssh_host_ecdsa_key and etc are used.
| What are all of the SSH Key files? |
1,542,878,501,000 |
I have recently upgraded my workstation - Fedora 31 to Fedora 34. As it usually happens after upgrade some of ssh alogrithms become obsoleted and I have to add extra lines to .ssh/config and I am okay with that doing my best on security.
This time ssh-rsa term confuse me a lot. I have old RSA public key, for instance ... |
For background...
There's a great answer on the topic over on Security Stack Exchange which links through to openssh's notes on deprecating ssh-rsa.
It seems the problem is that the original ssh-rsa algorithm (described in RFC 4253) relied on SHA-1 which is now largely defunct for cryptography:
Since 2005, SHA-1 has ... | SSH-RSA public key authentication explanation needed |
1,542,878,501,000 |
SSH by private IP is fine
I'm able to connect to a server through SSH by its private IP address:
C:\Users\m3>ssh -vvvvA [email protected]
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/m3/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resol... |
Port 22 incoming is closed by ISP for security reasons. Figured it out by contacting the ISP.
Changed the SSHD port from 22 to 2222:
$ sudo vim /etc/ssh/sshd_config
$ sudo systemctl restart sshd
Now I'm able to SSH to public IP address by using the custom port:
>ssh [email protected] -p 2222
| How to debug: ssh_exchange_identification: Connection closed by remote host |
1,549,314,696,000 |
I've discovered that OpenSSH is capable of forwarding UNIX sockets like this:
ssh -R /var/run/program.sock:/var/run/program.sock
My question is whether this extends to abstract unix sockets too.
I've tried the following to no avail:
ssh -nNT -R @laminar:@laminar
ssh -nNT -R unix-abstract:laminar:unix-abstract:laminar... |
No, that's not possible with the standard openssh-portable.
You can look for instance at the unix_listener() function here.
Maybe there are patches floating around, but I'm not going to answer with google search results ;-)
Adding such a thing should be technically easy, but who's going to deal with the "political" p... | Forward abstract unix socket over SSH? |
1,549,314,696,000 |
I've freshly setup a rather standard current Arch Linux and encounter a problem that I can not get a grip on:
DHCP service is enabled and network is online (ping succeeds with hostname and IP address)
OpenSSH service is enabled
OpenSSH config allows public key and password
But I can not connect via SSH unless I als... |
You need to install and enable haveged to generate sufficient entropy for the cryptographic exchange of keys. Possibly related to this bug report.
| SSH only after login? |
1,549,314,696,000 |
I need a second openssh server source modified and running on debian.
The modifications I made on the source code are not really relevant, anyway they amplify the logs.
I compiled the modified openssh-7.4p1 with
./configure --prefix=/opt --enable-pam --with-pam
make ; make install
Then I created /lib/systemd/system... |
I'm seeing the same behavior on another systemd system (Ubuntu 16.04.3 LTS, but provided by an HPC vendor that may have made modifications.)
From what I can tell, the problem is that Type=notify, and sshd isn't or can't send notification messages using sd_notify(3) or similar to systemd. So systemd never gets the m... | OpenSSH Server start failed with result 'timeout' |
1,549,314,696,000 |
I have a file called hosts which looks as follow:
host1
host2
host3
host4
.....
On these machines there is also a local user named as the machine name. host1 user is created on host1 host and so on.
Is there a way to lock all these user accounts on all machines?
What I've used seems not to work properly.
pssh -h h... |
Build the command on the remote host, using the HOSTNAME variable to determine the host.
pssh -h hosts -l root -i 'passwd -l "$(hostname)"'
This assumes that the name of the user account to lock is what the machine thinks of as its name. If you're using nicknames in your SSH configuration and you want to use the nick... | pssh (Parallel-ssh) passing different parameter for every host |
1,549,314,696,000 |
I try to establish a remote ssh connection.
I tried to connect "Remote" with ssh -fN -R 10110:localhost:22 GatewayUser@GatewayHost
and "Gateway" with ssh -p10110 RemoteUser@localhost
I got the response on the Gateway Console Connection closed by ::1
running it with -v ssh -v -fN -R 10110:localhost:22 GatewayUser@Gate... |
What you do is: Crate a ssh connection from the raspi to the gateway, and forward the *:10110 from the gateway to 127.0.0.1:22 on the raspi.
Then you connect to port 10110@localhost, which may in some configurations use the ip6-address (::1) which has no tunnel behind it. sshd then closes the connection.
Try
ssh -4... | Reverse SSH "Connection closed by ::1" |
1,549,314,696,000 |
Is there any way to list the tunnels that SSH clients connected to my OpenSSH server have set up?
I can use e.g. lsof -i to show connections that are being actively tunnelled, but I'd like to be able to list tunnels that the clients have set up but may not currently be in use.
(It's just struck me that this may be an ... |
Well yes it is client sided.
Plus there isn't any configuration in the traditional sense. You create a tunnel by specifying the correct parameters when connecting to a server.
Sure you can store it in .bashrc, .ssh/config, or some other place for re-usability, but in general it is purely on-demand.
| List ports tunnelled on OpenSSH server |
1,549,314,696,000 |
The one thing that's been bothering me is, there is always concept of "ssh-ing" from client to server.
Might be a trivial question, but I just want to clear my mind. Which one do I choose to install on my host machine, openssh-server or openssh-client? How do I know if I want to install openssh-server or openssh-clien... |
openssh-client contains the ssh client program /usr/bin/ssh, you use this to connect TO other machines running sshd or some other compatible ssh daemon. This package also contains other client-side programs like scp, sftp, ssh-keygen, ssh-agent, ssh-copy-id, and more.
openssh-server contains the ssh daemon /usr/sbi... | SSH client/server confusion |
1,549,314,696,000 |
Usually in the past I've always manually copied over my SSH public key to the remotes where necessary. I'm on a Mac and I finally decided to start using ssh-copy-id to make my life simpler, so I just used homebrew to install it.
I just used ssh-copy-id for the first time and am little confused by the result.
On my lo... |
Add option -i when running ssh-copy-id. This is explained in the manual:
Default behaviour without -i, is to check if 'ssh-add -L' provides any
output, and if so those keys are used. Note that this results in the
comment on the key being the filename that was given to ssh-add(1) when
the key was loaded into your... | ssh-copy-id: why is the end of my public key different on my local vs remote? |
1,549,314,696,000 |
I can't seem to debug this issue, but I'm trying to set an rsa public key login method to one of my servers running CENTOS7. I used the "ssh-keygen -t rsa" command to generate keys and copied contents into ~/.ssh/authorized_keys. Here is the output to "ssh -i id_rsa user@ip_address". The method I used worked perfectly... |
StrictModes is on by default on CentOS, and other distributions.
If you created the files on the host that doesn't work that is the most likely cause of this issue.
Make sure that the ~/ssh/ on the remote machine is 700 and that the ~/.ssh/authorized_keys is set to 600.
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorize... | SSH publickey login permission denied on CENTOS But not on Debian |
1,549,314,696,000 |
I recently installed openSUSE, and I want to set up an ssh server so that I can ssh into this machine. However, I am having trouble installing openssh-server.
I have tried
$ sudo zypper install openssh-server
This is what this site says to type, but I get this message:
Package 'openssh-server' not found.
On my Ubunt... |
There are two issues here:
openSUSE comes with openSSH pre-installed, so the ssh server does not need to be installed
https://nl.opensuse.org/OpenSSH
The packages for openSSH apparently have different names in openSUSE than they do in Ubuntu and Fedora (and maybe others?).
In Ubuntu (using apt-get) and Fedora (u... | How to install openssh-server on openSUSE? |
1,549,314,696,000 |
I want to create an account for my friend on my computer, but I don't want my friend to be able to view all my files. I saw that with OpenSSH, there is an option for that.
Inside the SSHD configuration file:
/etc/ssh/sshd_config
With the line:
ChrootDirectory /home/%u
However, the user home directory needs to be own... |
To answer your specific question, root must own the user home directory for the chroot provided by SSHD to work correctly. If the home directory is not owned by root, the user will be able to exit the directory when they connect via sftp.
There is no downside to root owning the user directory if the user is only conne... | OpenSSH, chroot user: Root needs to own the user directory, is there any consequence? |
1,549,314,696,000 |
I am trying to understand an sshd configuration that I believe should not work but does. The premise comes from a production system I’m working on; however, I simplified it for my own testing. Since I am unable to explain why this simple example works, I am also unable to explain why the more complex iteration works.
... |
I wasn't able to trace through the code as closely as I hoped, but I think I have a sense of what's happening. A very significant clue is in the source code file for the routines that parse the command-line arguments, the sshd_config file, and its included files:
/*
* The strategy for the Match blocks is that the co... | sshd_config with Multiple Match Address |
1,549,314,696,000 |
I'm writing some integration tests, that test SSH connections between servers.
For the time being the tests are run from people's laptops. In order not to muck around in the user's (the user running the tests) ~/.ssh/config I create a temporary directory with a bespoke ./tmp/.ssh/config file just for the tests. Then ... |
According to the source code, ssh gets the home directory from the password file and then, if it does not succeed, from the HOME environment variable.
What you can do is add an Include to every user's ~/.ssh/config, say ~/tmp/user/.ssh/config.
If the file to be included does not exist, ssh will not complain. But if it... | OpenSSH not respecting $HOME when searching for ssh config files |
1,549,314,696,000 |
Here is my use case: I have a script that lists through hundreds of servers and tests whether or not they allow logins using public key authentication using a specific private key (in the ssh client's .ssh directory). Some of these servers were misconfigured, and I do not have control over the SSH service on any of th... |
As per suggestion,
ssh has a -o batchmode=yes option that will prevent any interaction.
no password asked
no confirmation for foreign signature
This will result in error code if no connection is make.
| scripted ssh should not ask for a password if public key authentication fails |
1,549,314,696,000 |
How to get the return code of SFTP command?
I do this to download all files from a directory. But if the directory is empty the command returns 1
How to fetch the actual code for File not found?
echo 'get * /var/download' | sftp -b - user@host
Or a solution would be to ignore/suppress the error File not found and ret... |
OpenSSH sftp returns 0 on success and 1 on error.
No further distinction is provided.
To test, if any file exists in a directory before trying to download them, you can use:
echo "ls /remote/path/*" | sftp -b - [email protected]
if [ $? -eq 0 ]
then
echo "Files exist, can download now"
echo 'get /remote/pat... | Test if any file was downloaded with SFTP command |
1,549,314,696,000 |
I'm using this .ssh/config:
Host myserver
HostName 12.34.67.89
User anyuser
IdentityFile /root/.ssh/anything_rsa
But running ssh myserver returns a Permission denied (publickey) error.
Why isn't the given identity file (root/.ssh/anything_rsa) be used? Instead it seems to use /root/.ssh/id_rsa
OpenSSH_7.0... |
The comments below your post indicate that /root/.ssh is a symlink to another directory. I have never had a reason to use a symlinked .ssh directory, but I'm fairly certain that ssh will entirely ignore an .ssh directory that is either not owned by the user in question, or is group- or world-readable. IOW, it must b... | SSH: Permission denied as given IdentityFile is not used |
1,549,314,696,000 |
For all my servers PasswordAuthentication is set to no in the sshd_config file. This means that only key authentication is allowed.
In this situation, is there any risk if PasswordAuthentication is set to yes in the client's ssh_config?
|
There's a risk, if the client connects to the wrong machine, and that machine allows password auth. Then the user may enter their password, thinking it might be a server side change... and now the password can be stolen.
Related: Is your SSH password revealed when you attempt to connect to the wrong server?
| OpenSSH: if the server is set to "PasswordAuthentication no" then is there any risk if the *client* is set to "PasswordAuthentication yes"? |
1,549,314,696,000 |
I usually have to access a couple of remote and local SSH hosts, this works perfectly, I actually want to have to type in the passphrase every time.
However, there's a single SSH host on my local network that I have to log into a lot more frequently than the rest. Security is not much of a problem with this one in par... |
It sounds like you want to use two different sets of keypairs. Have one prompt you for your password every time, and set up the other one to be passwordless. Copy the passwordless set's public key to the server (or servers) you want to connect to more quickly.
| How to log into a single SSH host without passphrase? |
1,549,314,696,000 |
I have my desktop in the office. When X starts, ssh-agent starts automatically. I have to add my SSH key once, at the beginning, and then I can use ssh without having to enter my password each time.
However, when I connect to my desktop via SSH (i.e. from home) the ssh-agent is not accessible and I have to provide my ... |
You can use agent forwarding: make sure to include ForwardAgent yes in your client-side configuration (~/.ssh/config), or use the -A command line option. (This feature can be disabled on the server side (AllowAgentForwarding in sshd_config), but this is only useful for restricted accounts that cannot run arbitrary she... | using ssh-agent |
1,549,314,696,000 |
I work on remote servers frequently, but for some reason I cannot discern, today I am unable to ssh into anything.
Everything comes back with Write failed: broken pipe.
I know this is a common symptom of server timeouts, but I can't do anything besides enter a password.
When connecting, the password dialog is normal, ... |
When I have seen this kind of behavior, it's usually something network related.
You didn't mention if you were connecting from work or home. If you are connecting from home, I would reboot the personal router connecting to the internet. If you are connecting from work, I would check with the networking group and find ... | Can't SSH into Any Server |
1,549,314,696,000 |
I am trying to completely disable SSH comments.
Running ssh-keygen -C "" -f test results in:
ssh-keygen -l -f test.pub
3072 SHA256:Ir9Q4ykMBl0zx/NaCQGGx/qmEFIX84qaHDzFA0SzevE no comment (RSA) # (1) no comment
ssh-keygen -l -f test
3072 SHA256:Ir9Q4ykMBl0zx/NaCQGGx/qmEFIX84qaHDzFA0SzevE test.pub (RSA) # (2) commen... |
I did some RTFS and it looks like printing comments is hardcoded for the most part.
(1) ssh-keygen prints comments like comment ? comment : "no comment" so that's where the "no comment" comes from.
(2) ssh-keygen checks for presence of test.pub by itself, it opens and validates the file even though it was not given on... | How to completely disable SSH commenting? |
1,549,314,696,000 |
I have a RHEL 8.3 server and this is the content in the /etc/ssh folder:
[root@192 ssh]# pwd
/etc/ssh
[root@192 ssh]# tree -a
.
├── moduli
├── ssh_config
├── ssh_config.d
│ └── 05-redhat.conf
├── sshd_config
├── ssh_host_ecdsa_key
├── ssh_host_ecdsa_key.pub
├── ssh_host_ed25519_key
├── ssh_host_ed25519_key.pub
├── s... |
In the SSH protocol, the algorithms used for the cipher, MAC, key exchange, host key, and public key can be independently negotiated. In most cases, the algorithm selected is the first of the client algorithms that the server also supports.
Typically, a server has multiple host keys, and the choice of host key used i... | Which public key will be added into my ~/.ssh/known_hosts? |
1,549,314,696,000 |
I'd like to launch neofetch (a small utility that displays a banner) each time I log into a remote server via OpenSSH. So, I just added /usr/bin/neofetch into my ~/.ssh/rc file, and it works fine.
The problem is that ~/.ssh/rc is also parsed when I scp into the server. A complete scp command works just fine, there is ... |
The environment variable SSH_TTY seems to be set only when sshing, not when scping. So the following suffices (at least in my testing):
if [ -n "$SSH_TTY" ]; then /usr/bin/neofetch; fi
(For what it's worth, I guessed this by looking at the output of env | grep -i ssh.)
| how to distinguish ssh from scp in ~/.ssh/rc? |
1,549,314,696,000 |
I have an SFTP server where I need to restrict users with specific IP addresses or ranges.
To achieve this, I had been appending AllowUsers entries to the sshd_config file like below and there are 180 such entries on the same line:
AllowUsers user1 user2 user3@ipaddress user4@ipaddress/n user5@ipaddres user5@address u... |
Thanks a lot to those who put up their inputs here :)
I upgraded my OpenSSH and the limit restriction mentioned in my question is no more an issue now.
I followed the below blogs to complete and troubleshoot my OpenSSH upgrade. I was doing it on Amazon Linux. However, I believe this should work on centos as well.
http... | Is there a limit to the number of user entries in AllowUsers that can be given in sshd_config file in Linux? |
1,549,314,696,000 |
Imagine the following scenario:
"Client" and "Connected" both exist on a network. A third computer, "Isolated," is not on any network but exposes a console over a serial port that can be read by Connected.
I sit at "Client" and I can access "Connected" from "Client" over ssh.
My goal is to get to "Isolated" as seamle... |
From a comment:
I'm using ssh between the "Client" and the "Connected" computer. Usually, the back end of ssh opens up a shell on the local tty at "Connected." I suspect that there might be a way to ask it to open up the remote console instead, and save me from having to type screen /dev/ttyUSB0 on the "Connected" ho... | How to Configure OpenSSH Server to connect to an isolated computer's console via a serial port? |
1,549,314,696,000 |
I have many servers that shares a common TrustedUserCAKeys. I want to sign a user certificate so it grants some access on specific servers instead of all of them.
For example, the following command generates a certificate that can be used to log in as root on all servers:
ssh-keygen -s ca -I example -n root id_rsa.pub... |
Without changing the sshd_config file, the answer is generally no. The mechanism to pull this off is to setup an AuthorizedPrincipalsFile (or AuthorizedPrincipalsCommand). Without this directive in sshd_config, the default behavior is that the username for the authentication attempt must be listed literally as one of ... | SSH User CA: Sign a user certificate with selected hosts instead of all hosts? |
1,549,314,696,000 |
Ubuntu 18.04.3 LTS (bionic) have OpenSSH server version 7.6p1 but that release is 2 years old by now. On my local Arch Linux machine I'm running 8.0p1 but Ubuntu naturally have slower pace.
The network analysis tool we use suggests upgrading the OpenSSH server to a newer version since it finds a few medium threats whe... |
How would you handle a situation like this? And from where would you install the update?
Supported Ubuntu LTS versions provide relevant security fixes to older versions, usually backported to the version shipped in the release. In case a vulnerability is fixed, installing the updated version from Ubuntu's repository... | Install openssh-server 8.0p1 on Ubuntu 18.04.3 LTS |
1,568,391,724,000 |
I have an FTP server that allows only SFTP connection – and only via password.
I have a list of files on the server - hundreds and thousands of files in many directories. And the directories contain a loooot of files we don't need. So, I have to fetch files on-by-one, controlled by the list.
The way I hoped to use is ... |
You can provide the commands to sftp without the batch mode using an input redirection:
sftp [email protected] < commands.txt
This way you can still use an interactive password authentication.
$ sftp [email protected] < commands.txt
[email protected]'s password:
Connected to [email protected].
sftp> get -p source_fil... | Provide get commands to SFTP from a script file but keep interactive password login |
1,568,391,724,000 |
The server is running macOS Mojave 10.14.4. I'm unable to get the SSH daemon to start. After logging in locally, I run:
$ launchctl list | grep ssh
- 0 com.openssh.ssh-agent
$ ps -A | grep ssh
1483 ?? 0:00.00 ssh-agent -s
8483 ?? 0:00.00 ssh-agent
The service is not active. To resolve this, I've ... |
For enabling the SSH service/daemon in MacOS do:
sudo systemsetup -setremotelogin on
For disabling the SSH service do:
sudo systemsetup -setremotelogin off
For checking whether it is on or off:
sudo systemsetup -getremotelogin
(Tested with Mojave)
Btw, sshd has to be run as root, not as you are running it. It has... | Can't get SSH daemon running on macOS |
1,568,391,724,000 |
Very similar to Failed to open config file '/dev/fd/63', error: No such file or directory for wpa_supplicant except for the fact that I am running as root.
bash-4.4# autossh -v -M 0 -4 -o StrictHostKeyChecking=no -F <(echo "$VA_SOCKS_PROXY_SSH_CONFIG") -i <(echo "$VA_SOCKS_PROXY_PRIVATE_KEY") socks -D "0.0.0.0:2001" ... |
It appears that ssh closes all file descriptors early on in main() and as such does not support process substitution.
/*
* Discard other fds that are hanging around. These can cause problem
* with backgrounded ssh processes started by ControlPersist.
*/
closefrom(STDERR_FILENO + 1);
Sources
https://github.com/ope... | (root) Warning: Identity file /dev/fd/62 not accessible: No such file or directory |
1,568,391,724,000 |
Is it possible to restrict the use of CA certificates to specific users/principals/groups?
The use case is that I'd like to have 2 CA certificates. One would be used as part of an automated system to sign user keys. If this certificate were to be compromised, I want to be sure that it couldn't be used to allow someone... |
Based on Ulrich Schwarz's comment:
If I add normal users to an endusers group, then I can set the sshd_config like this:
TrustedUserCAKeys /etc/ssh/admin_ca.pub
Match Group endusers
TrustedUserCAKeys /etc/ssh/user_ca.pub
This results in the user_ca only being accepted for users in the endusers group, while the ad... | Restrict SSH CA certificates to specific users/groups |
1,568,391,724,000 |
I'm following this tutorial to validate a SSH server, in theory I should use a private key provided by an authoring server to sign the SSH pub key, but I don't understand the role of the -I <key_id> option and what value should it have:
ssh-keygen -s server_ca -I host_sshserver -h -n sshserver.example.com /etc/ssh/ssh... |
Excerpts from man ssh-keygen:
-I certificate_identity
Specify the key identity when signing a public key. Please see the CERTIFICATES section for details.
CERTIFICATES
ssh-keygen supports signing of keys to produce certificates that may be used for user or host authentication. Certificates consist... | What the -I certificate_identity ssh-keygen option is for? |
1,568,391,724,000 |
I'm looking for a way to set a specific SSH key while logging to a remote host with a particular username. Is this possible within the SSH config file?
For example:
Use key "id_rsa-test" for username "testuser":
ssh testuser@host1
ssh testuser@host2
ssh testuser@host3
Use key "id_rsa" for all other users.
ssh root@ho... |
Thank you @xhienne (comment link) for your suggestion.
Adding the following to ssh_config appears to have solved the problem:
Match User testuser
IdentityFile ~/.ssh/id_rsa-test
This block should be placed above Host * to send id_rsa-test ahead of id_rsa for testuser.
| Use X SSH key when logging in to Y remote user? |
1,568,391,724,000 |
When I log into a remote centos 7 server as root, I am able to see the sshd logs by typing journalctl _COMM=sshd in the terminal. But the logs are massive. How can I download all the logs into a format such as a text file for analysis on my local machine?
|
Redirect them out to a file:
journalctl _COMM=sshd > sshd_logs
| downloading sshd logs from remote centos 7 server |
1,568,391,724,000 |
I got a nexenta system,
I updated openssl to 1.0.1j, which I compiled from source code.
I updated openssh to 6.7, from source code as well, and I get this:
root@cteraportal:/root# openssl version
OpenSSL 1.0.1j 15 Oct 2014
root@cteraportal:/root# ssh -V
OpenSSH_6.7p1, OpenSSL 0.9.8k 25 Mar 2009
Should I expect the Op... |
Why can't the OpenSSH configure script detect OpenSSL explains the possible cause that might have occured in your case.
Several reasons for problems with the automatic detection exist.
OpenSSH requires at least version 0.9.5a of the OpenSSL libraries.
Sometimes the distribution has installed an older version in the... | update openssh and openssl on solaris |
1,568,391,724,000 |
I really really hope I'm wrong here, but it seems that Debian 11 has a vulnerable version of OpenSSH.
My OpenSSH banner reports my OpenSSH version is:
8.4p1 Debian 5+deb11u1
I checked with sshd and it reports the same version.
According to this CVE-2023-38408 ANY version before 9.3p2 is vulnerable.
I tried sudo apt up... |
At the time of writing (17 August 2023) the page of CVE-2023-38408 on the Debian security tracker says that:
Debian 10 (buster, security channel) is fixed
Debian 10 (buster) is vulnerable
Debian 11 (bullseye) is vulnerable
Debian 12 (bookworm) is vulnerable
Debian 13 (trixie) is fixed
Debian Unstable (sid) is fixed
... | Are all Debian 11 systems automatically vulnerable to CVE-2023-38408? |
1,568,391,724,000 |
I use keepassxc (my password manager) to manage my ssh keys. This means the keys are stored within the database (not stored on disk in a traditional way). When I unlock my password database, all keys are added to the agent. However, with a growing list of ssh keys, I get the problem that ssh tries all the keys in the ... |
but I can't use the IdentityFile option (and IdentitiesOnly yes), since I don't want to store my private keys on disk.
You can. Store the corresponding public key(s) on disk. Use IdentitiesOnly yes and the IdentityFile option and point to the right public key. This solution is not explicitly explained in man 5 ssh_c... | manage many ssh keys via ssh-agent |
1,568,391,724,000 |
I'd like to know why my known_hosts file doesn't seem to be checked correctly while using SSH. In short, my guess is that my SSH client is checking /dev/null instead of the known_hosts file. Details on how I guessed that are written below.
For my example, I'm logging in from a node named mars into a client node named ... |
The only explanation that comes to mind is that the SSH client configuration either on this machine or on this account has been modified to not remember known public keys in a known_hosts file. Check the settings for GlobalKnownHostsFile and UserKnownHostsFile in /etc/ssh/ssh_config, /etc/ssh/ssh_config.d/* and ~/.ssh... | SSH client seems to be checking '/dev/null' instead of 'known_hosts' file when checking remote server's ECDSA key |
1,568,391,724,000 |
Background
I use a 4096-bit RSA key-pair for authorizing access to my server. By ssh_config files I am referring to ~/.ssh/config and /etc/ssh/ssh_config.
Here's what my ~/.ssh/config looks like:
Host gg-root
HostName 172.47.95.122
Host ss-root
HostName 172.47.95.123
# Common for my servers
Host gg-root ss-r... |
ssh-add does not honour the configuration file. It just adds the key to the agent.
The ssh client would try to use the key ~/.ssh/id_rsa_bull when connecting to either of gg-root or ss-root (due to the IdentityFile configuration). If that key is available in the agent, then it will be used from there, otherwise the ... | Does ssh-add honor the declarations made in ssh_config file(s)? |
1,568,391,724,000 |
I have a server set up to require public-key authentication for ssh access using a key with a password. Is there a way to set up a password-less key that will only be allowed when executing rsync over ssh, while still requiring the key and password for all other ssh access?
|
Create a separate RSA key just for rsync to use. Do not put a passphrase on that key. Give it a unique name, such as id_rsa_rsync for the private key and id_rsa_rsync.pub for the public key.
On the server, install the public key on a new line of ~/.ssh/authorized_keys, like this:
(server)$ cat << EOF >> .ssh/authori... | Passwordless rsync while requiring key and password for all other access |
1,568,391,724,000 |
I'm trying to use ssh-copy-id in order to copy my id_rsa.pub into ~/.ssh/authorized_keys in remote host.
I execute the following:
$ ssh-copy-id remoteuser@remotehost
But I have the following error:
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/... |
It looks like this server is using something called rootsh. This tutorial titled: How to track Linux Shell Users activity? covers it too.
rootsh: bad characters in arguments
In these types of scenarios, you'll likely have to ssh to the server and then copy/paste the public portion of your SSH key-pair into the user ... | ssh-copy-id returns error "rootsh: bad characters in arguments" |
1,568,391,724,000 |
Other people log into my Raspberry Pi via SSH. It runs Ubuntu Mate 16.04 with OpenSSH. I want to disable some of the accounts but not delete them.
Now, I could just delete the passwords (which obviously has the disadvantage that a way to set the password, again, has to be found, unless I manually change the contents o... |
Well ... one of all the possible answers is to change the shell of the user to /sbin/nologin. It will allow to authenticate and then say
This account is currently not available.
(if the /sbin/nologin is in /etc/shells)
Otherwise you can use similar approach as the linked article with ForceCommand:
Match Group disable... | Disable accounts and print info message on attempted login |
1,568,391,724,000 |
I am trying to use ssh supporting GSSAPI with KeyExchange protocol with some servers that authenticate using kerberos. I have installed aur/openssh-gssapi. The problems is after getting the key from krb-server using kinit, when I ssh to the server it fails with this message:
Unable to negotiate with blah.blah: no matc... |
There is a bug in the patch in Arch Linux. They are setting the Kexs, but they are immediately overwritten by the other changes in the code:
The line
xasprintf(&myproposal[PROPOSAL_KEX_ALGS], "%s,%s", gss, orig);
should say
xasprintf(&options.kex_algorithms, "%s,%s", gss, orig);
From the brief check of the source ag... | Archlinux + GSSapi + kerberos |
1,568,391,724,000 |
I'm experimenting with Docker's Alpine Linux image and OpenSSH. The sshd_config file that ships with alpine has everything commented out by default. I only uncomment Port 22. I assume this is the most secure configuration (But would like some feedback on whether this assumption is correct).
I then run ssh-keygen -q... |
However if I try to connect from outside the docker conatainter / host I get prompted for a password. Should this happen? My assumption was that since I only configured the Port parameter everything else would be turned of including password authentication.
Yes. The password authentication is on by default, because ... | Authentication methods allowed by default in OpenSSH on Alpine |
1,568,391,724,000 |
With the 7.0 release, OpenSSH disabled ssh-dss keys. The not-so-recommended workaround is to explicitly re-add DSA key support to .ssh/config, which will eventually be dropped by a later OpenSSH version:
PubkeyAcceptedKeyTypes=+ssh-dss
As I have deployed my DSA key to countless machines (and I do not have a full list... |
There is no special mechanism in ssh to notify you that you use some key. It works or fails.
Differentiate the keys using passphrase
Only other idea that comes to my mind is differentiate between the keys using passphrase.
For example, have the RSA keys in ssh-agent or without passphrase and the DSA one with passphras... | SSH: display warning when using (deprecated) ssh-dss key |
1,568,391,724,000 |
I regularly upload large amounts of data using SCP through my DSL upstream connection, which is limited to 1kbit/s. While I really want interactive SSH sessions to have highest priority, simply setting SSH to the highest priority renders the connection unusable during SCP uploads.
How can I differentiate between SSH a... |
At least OpenSSH sets different TOS bits (0x16 for interactive sessions, 0x08 for bulk transfers), as discussed on quora.
This can be easily exploited using rules that match those bits. It seems the highest matching QoS takes effect, make sure not to have a general rule for port 22/SSH around: OpenWRT by default ships... | How to discriminate between SSH and SCP for QoS in OpenWRT (and other systems)? |
1,568,391,724,000 |
I'm completely at a loss as to what is preventing my local machine from authenticating the connection that is being forwarded from the remote server.
I've read a ton of the posts on here regarding this and man, I swear I've tried damn near everything.
The guide I've been following can be found here: http://www.zeespen... |
Thanks for trying to help everyone, really appreciate it. Anyways, it seems ssh-agent was the culprit. I forgot I have to check if there is previously spawned instances of it already running before spawning my own. I had something like 9 of them running. I don't know much bash, but here where the 3 lines I added to my... | Unable to force passphraseless ssh authentication while port forwarding |
1,568,391,724,000 |
I'd like to wrap an insecure connection (this one: http://culturedcode.com/things/) with a secure tunnel, a bit like http://en.wikipedia.org/wiki/Stunnel does, just using UNIX tools.
What's the best way to intercept insecure traffic, encrypt it and deliver it to the insecure socket at the other end of the communicatio... |
Have a look at ncat (which is part of nmap).
ncat -l 80 -c "ncat (ip-address) (port) --ssl"
For more information see: Using ncat to provide SSL-support to non-ssl capable software
| Wrapping socket connections |
1,568,391,724,000 |
I have an Ubuntu server and I want to log all SSH activity on my server.
For this, I found one good document here: How to log all Bash commands by all users on a server? I followed this document and enable the logging on the server. I log the commands with the following line:
export PROMPT_COMMAND='RETRN_VAL=$?;logger... |
The variable $SSH_CONNECTION gives you the ports and source/destination IP addresses used by the user connection. So add it as argument to your logger command.
As in:
export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug "$SSH_CONNECTION $(whoami) [$$]: $(history 1 | sed "s/^[ ]*[0-9]\+[ ]*//" ) [$RETRN_VAL]"
F... | How to log all SSH activity on server with user's hostname or User name? |
1,568,391,724,000 |
In RedHat based distributions you can set the type of server private and public keys which the init script will automatically create, with the variable AUTOCREATE_SERVER_KEYS variable.
Can you do this in Debian and if yes, how?
|
In Debian, regenerating host keys can happen with:
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
| OpenSSH - automatic server private and public keys creation |
1,568,391,724,000 |
I currently have an sftp-only sshd service running as an unprivileged user that works fine. When adding
ChrootDirectory %h
to the separate user_sshd_config, the user is immediately disconnected after successfully authenticating with publickeys and the error log shows the following:
fatal: server lacks privileges to ch... |
Alas, chroot(2) must be called as root.
| Is it possible to chroot sftp service as unprivileged user? |
1,568,391,724,000 |
With OpenSSH, how can I log the fingerprints of the keys used for authentication?
I would like to log it in production, so it would be best if this wasn't just some debug setting or similar.
|
Yes, by setting LogLevel to VERBOSE, you would see logs like the following,
sshd[1199]: Connection from 192.168.56.1 port 45811
sshd[1199]: Found matching RSA key: XXXX
sshd[1199]: Postponed publickey for root from 192.168.56.1 port 45811 ssh2 [preauth]
sshd[1199]: Found matching RSA key: XXXX
sshd[1199]: Accepte... | Assuming sshd allows only public key authentication, how do I log the fingerprints? |
1,638,661,752,000 |
I want to open many tunnels at once, they all have the same long password.
With -f, i.e.,
ssh -fN -p 22 usr1@gate1 -L 10001:ip1:22
ssh -fN -p 22 usr2@gate2 -L 10002:ip2:22
...
ssh -fN -p 22 usrn@gaten -L 1000n:ipn:22
I can open the tunnels in background, which allows me to run them all together and then just type con... |
I found the solution using https://stackoverflow.com/a/3980904/1424395 and https://unix.stackexchange.com/a/59632/269821
I use read -s to get the password into a variable, and then I use sshpass to pass the password to the ssh.
#!/usr/bin/env bash
# Read Password
echo -n Password:
read -s password
echo
sshpass -p $p... | Opening many tunnels typing the password only once (all accounts in gateways have the same pass) |
1,638,661,752,000 |
I'm connecting using OpenSSH to a Linux server where I have a tmux session where I do certain compiling work which takes a long time. Now I would like to be get right away a notification on my Linux client (the computer I'm connecting from) once a certain command which takes a long time finally is complete.
Locally, I... |
The simplest solution is to use the exit from tmux, by issuing a tmux detach, to close the ssh connection, then send a notification, and then reconnect and attach back to the tmux. Eg with the script
ssh -t remote tmux
notify-send done
ssh -t remote tmux attach
You run tmux, and start off your long-running command, t... | Notification that remote process completed (but no email) |
1,638,661,752,000 |
A question arose in a group discussion: Can directory listing be disabled for sftp while still retaining read and write access?
We are using openssh on ubuntu server 11.02 if that helps.
|
Remove Read access.
Read access on a directory means that you can see a listing of files within that directory.
Execute (X) access means you can cd into the directory or traverse it
Write access means that you are able to add or change items within the directory.
| Can directory listing be disabled for sftp? |
1,638,661,752,000 |
$ ssh 192.168.29.126
The authenticity of host '192.168.29.126 (192.168.29.126)' can't be established.
ECDSA key fingerprint is SHA256:1RG/OFcYAVv57kcP784oaoeHcwjvHDAgtTFBckveoHE.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
What is the "fingerprint" it is asking for?
|
The question asks whether you trust and want to continue connecting to the host that SSH does not recognise. It gives you several ways of answering:
yes, you trust the host and want to continue connecting to it.
no, you do not trust the host, and you do not want to continue connecting to it.
[fingerprint] means that... | What is the fingerprint ssh is asking for? |
1,638,661,752,000 |
There is already a great question and answer here, but I have a different case.
I create a tunnel with the following command:
$ ssh -N -R 0:192.168.0.16:80 [email protected]
Allocated port 35007 for remote forward to 192.168.0.16:80
I am getting output about the allocated port, however, when I background the tunnel w... |
Trying with the -f flag does indeed prevent the report that is given otherwise. Looking at the documentation (man ssh, search for -f), we can see that
-f Requests ssh to go to background just before command execution.
But in the next paragraph we can read,
If the ExitOnForwardFailure configuration option is set to ... | Saving the dynamically allocated port of SSH tunnel |
1,638,661,752,000 |
I will send a string from a local machine to a remote ssh server.
The user is in a simple jail, so he can't execute commands, login, do something on the remote bash or what ever, he can only send a string/value/variable and execute the script run on the ssh server not more.
This is the simple jail for the user
This is... |
Using ssh user@somehost <<< "$value" is pretty much the same as echo "$value" | ssh user@somehost: the contents of the variable are sent to the standard input of the SSH client process. SSH transfers that to the remote end, and it's available there for the remote process to read, again on stdin. For example using the ... | How can i send a string to a script on a server over ssh with a simple jailed user and save the result from the server on my local machine in a file? |
1,638,661,752,000 |
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/Linux
ssh.service - OpenBSD Secure Shell server
Background
Today I realized:
when I want to handle http requests, I sta... |
Although SFTP is not part of the extensible core SSH protocol, it is built-in to at least one of the the common SSH implementations (OpenSSH) and therefore can be considered to be a standard component.
You can disable the functionality on the server if it's not required by changing /etc/ssh/sshd_config so that you rem... | Why do I not need to start an SFTP Server ( why does SSH automatically start SFTP )? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.