date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,635,063,773,000
NB: The OpenSSH clients I am using are all at version 7.2, so no RemoteCommand available. Assume the following setting: machine foo is a jump host and provides access to host bar via its localhost:10022 bar sits inside a network inside of which we can access host rdp and access its RDP port (3389). I actually give th...
First, with your kind of setting, what would work, requiring anyway two ssh: Host foo LocalForward 10022:bar:22 Host bar Hostname localhost Port 10022 LocalForward 33389 rdp:3389 term1$ ssh foo # or use ssh -f -N -o ExitOnForwardFailure=yes foo for background task term2$ ssh bar What you'd really ne...
SSH port forwarding via jump host, ssh_config files and ONLY "ssh targethost"
1,635,063,773,000
Before I can to connect to a particular remote machine I have to run a certain local command. So instead of ssh [email protected] I have to do local_command ssh [email protected] I would like to automate this so that I only have to do ssh remote.machine. I know that I can achieve this at the shell level by creating m...
If using ProxyCommand, you must use something like /usr/bin/nc to connect the server. For invoking your command before connect, you need to use sh -c "command list" to merge the two commands as one. Host remote.machine ProxyCommand sh -c "local_command; /usr/bin/nc %h %p" MORE: If your local_command is too compli...
Can ssh_config's ProxyCommand run a local command before connecting to a remote machine?
1,635,063,773,000
After updating raspbian and all of its libraries I noticed something different about SSH. When I delete the 'known hosts' file in my home and ssh into my box it provides me with the hosts public key like always however this time I see: ecdsa-sha2-nistp256 SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx I swear ...
The client can specify the hostkey algorithm it prefers with the option HostKeyAlgorithms in ssh_config or ~/.ssh/config or on the command line. man ssh_config on your system to see the default HostKeyAlgorithms preference for your version of openssh. The server will use the first key type which is on the client's l...
How does OpenSSH determine the choose the host key algorithm?
1,635,063,773,000
I have a script that relies on public/private key ssh authentication. The problem is that some systems are misconfigured and do not have the proper ssh public/private key trust set up. When that happens ssh ask me for a password blocking the script's execution. I have tried this command: sudo ssh -o "PasswordAuthen...
The canonical way to do this is with the BatchMode option: ssh -o BatchMode=yes … According to the manual: If set to “yes”, passphrase/password querying will be disabled. This option is useful in scripts and other batch jobs where no user is present to supply the password. I would have expected the combination of P...
How to disable password prompt from ssh client side?
1,635,063,773,000
I have been using PKI based SSH connections for over 10 years. Suddenly, after a server update - some of the connections stopped working. I am using the same PKI keys I have used for years (each server has it's own keys, I have a small set of personal keys). Working - looks like this: C:\Users\michael>ssh2 -p 2222 [em...
After an update - side-effects may come into play. With OpenSSH - defaults change frequently. OpenBSD (who maintain/develop OpenSSH) have a policy of OpenBSD to not be concerned about backwards compatibility. This can 'break' things that are, read were, working well. There is a massive hint - that I did not notice whe...
SSH stopped working after a server update? What happened?
1,635,063,773,000
Is there a more direct way to exit an OpenSSH control master process and delete its socket file than with the help of the programs lsof or fuser and without knowing the destination host (connection details) as suggested by the accepted answer of this question? I thought of something like this along the lines of: $ ssh...
This works for me using just the socket file for the control master: $ ssh -o ControlPath=~/.ssh/<controlfile> -O check <bogus arg> NOTE: You can also use ssh -S ~/.ssh/<controlfile> ... as well, which is a bit shorter form of the above. Example Here's an example where I've already established a connection to a remot...
How to exit OpenSSH control master process without using lsof or fuser?
1,635,063,773,000
I'm having problems getting sFTP working while there are no problems with ssh. I'm basically building zlib, openssl, and openssh for an ARM processor using an existing embedded Linux filesystem. After searching for ideas, this seemed liked a common problem, but I haven't made any progress. I only have one user defined...
While this is more of an alternate solution than a direct answer to your issue, I would try using the internal sftp server instead of an external one. Since this is an embedded system, this probably makes more sense to do anyway. In your sshd_config, just add: Subsystem sftp internal-sftp That way you can leave out t...
sFTP server fails to start
1,635,063,773,000
Is it possible to query ~/.ssh/config in the command line? Let's say I would like to retrieve what IP address does the particular alias point to in a separate program, is it possible?
If I understand that you just want the IP address returned, ie., 192.168.1.1, then this is one (incredibly brittle) way of querying the file from the command line, provided you have the appropriate permissions to read it and your .ssh/config is consistently formatted: awk '/Host $youralias/ {getline; print $2}' .ssh/c...
OpenSSH - map aliases in ~/.ssh/config to IP addresses in command line
1,635,063,773,000
I have openssh-server installed on a Debian Jessie host and am trying to find the original version of the sshd_config file. But that was apparently not installed by openssh-server: root@apu ~$ dpkg -S /etc/ssh/sshd_config dpkg-query: no path found matching pattern /etc/ssh/sshd_config What am I missing? Are there co...
There are quite a few configuration files which aren't managed by dpkg; they're managed by maintainer scripts instead. In this case, in Debian 9 the original file is available as /usr/share/openssh/sshd_config; that's copied to /etc/ssh/sshd_config by openssh-server.postinst. In Debian 8 the original contents are stor...
Where is my /etc/ssh/sshd_config coming from?
1,635,063,773,000
ssh clients (by default, at least in Ubuntu 18.04 and FreeBSD 12) always check if server's key fingerprint is in the known_hosts file. I have a host in the LAN which has dual boot; both the OSs use the same static IP. I would like to connect through ssh to both of them, without encountering errors. This obviously vio...
Your problem is that host keys are just that, they are a key for the host. There is really only supposed to be one per host. Of course there are several because there are several types of key, but I would avoid relying on key types to give you multiple acceptable keys for a single host. On the server side My first s...
ssh, accept two key fingerprints for the same server IP
1,635,063,773,000
The ssh-add command lets you specify the lifetime of an identity being added to ssh-agent. For example, if I type ssh-add -t 1h the identify will expire after 1 hour. I can then list the identities currently represented by the agent using ssh-add -l. Is there a way (other than recording information when I run the ssh...
No, there is no interface in ssh-agent communication protocol to provide this information. It is used only when adding the key (constraint array), but this is not returned when you list the keys, as the PROTOCOL.agent page describes (there is only key blob and comment for each key). Requiring this would probably requi...
Detecting the remaining lifetime of an ssh-agent identity
1,635,063,773,000
Starting an Interactive shell over SSH is slow to one of my servers. Everything leading up to it including negotiating encryption is fast, but then it hangs for 45 seconds. After that, it finishes and I have a shell. How do I identify what it's hanging on? I tried clearing the environment and disabling all forward...
pam_krb5.so was configured to acquire AFS tokens for a non-existent shell which had a 30 second timeout halting any authentication using that module, not just SSH. Removed that and authentication happens much quicker.
SSH slow at starting session
1,635,063,773,000
I have a host which I ssh into. Sometimes I'm inside the same network, and can ssh directly into it, other times I'm outside it and I need to use a proxy. Because ssh via the proxy server is much slower than direct, I'd like to have my ssh config set up such that I try to connect directly, falling back to the proxy if...
Match is rather on-par with Host. It doesn't exist as a subset of Host the way other options do. But you can specify multiple criteria on a match, and they appear to operate as a short-circuit AND. So this should be possible and useful for you: Match host target_host exec not_inside_network ProxyCommand ssh -W %...
Only apply Match keyword to single Host in ssh config
1,635,063,773,000
In my automated backups, I'm not sure if I should be doing this. If the hard drive fails or if I wipe the hard disk and start over, what will be the effect of starting with a new SSH host key to my clients? Will I have to do anything special other than remove the host's name from each client's known_hosts file? What i...
If you're reinstalling the OS on your computer, but you consider that it's still the “same” computer, then you must back up the SSH private key and restore it after the installation. If you're reusing the same hardware to make a different system, then you must generate a new key for the new system. Deciding whether it...
Should I be backing up my SSH host keys?
1,635,063,773,000
In some tutorials around the web to install OpenSSH exists the following commands: sudo apt install openssh-server sudo apt install openssh-client For example for Ubuntu Desktop is mandatory install the Openssh's Server - and it is not necessary for Ubuntu Server, it is already installed - furthermore I have never in...
for client: $ ssh -V OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020 for server: $ sshd -V unknown option -- V OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020 or nc -w1 localhost 22 SSH-2.0-OpenSSH_8.9p1 xxxx
Commands to know the version of OpenSSH client and server?
1,635,063,773,000
I generated the keypair in Computer 1. And move the public key to the Computer2(server) and make it in authorized_keys. And move the private key to Computer3(client) and use ssh-add to add it. Why I can directly login to server without offering a public key? What's the real workflow of ssh key authorization?
The client (Computer 3) does have access to the public key You are perhaps confusing a private key file with a private key. When you generate a public/private key pair, most implementations will create a private key file which contains BOTH the private and public key. Many implementations also write public key to a fi...
Why I can use only private key to login a server using ssh?
1,635,063,773,000
Is each a different side of the connection or a deeper layer of logging. I am interested because of, for example, this excerpt from a vvv output debug3: send packet: type 30 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY Connection reset by nnnn port 22 Looking through the output I can't determine which side is saying wha...
The short answer: Yes! The long answer: From [man ssh][1]: -v Verbose mode.  Causes ssh to print debugging messages about its progress.  This is helpful in debugging connection, authentication, and configuration problems.  Multiple -v options increase the verbosity.  The maximum is 3. To see what it really does...
What are the various levels in ssh -vvv: debug1, debug2, debug3
1,635,063,773,000
I am looking for an in-depth explanation of the following ProxyCommand, down to the nuts and bolts of its operation, please. Can you kindly completely dissect it for me and improve on it if you can? For readability, if nothing else. ProxyCommand ssh gatewayserver 'exec 3<>/dev/tcp/targetserver/22; cat <&3 & cat >&3;ki...
(I don't have a /dev/tcp device on my system; however bash seems to have some built-in handling for it, allocating a tcp socket connected to the following /host/port part.) So, your ssh proxy command securely runs a shell on gatewayserver which does: exec 3<>/dev/tcp/targetserver/22 i.e. attach a socket on filedescri...
All about ssh ProxyCommand
1,635,063,773,000
On my server, I have several public SSH keys in ~/.ssh/authorized_keys. I would like to temporarily block/disallow/deactivate one key. I want to prevent the user to log in using this key now. but I might want to reanable it later (i.e. I don't want to delete the key entirely). What is the correct/recommended way to do...
You could prefix the key with a forced command that tells the user what's going on. For example: restrict,command="printf 'Your key has been disabled\n'" ssh-rsa AAAAB2...19Q== [email protected] or for Openssh before v7.2: command="printf 'Your key has been disabled\n'",no-pty,no-port-forwarding ssh-rsa AAAAB2...19Q...
temporarily disable login using one specific ssh key
1,635,063,773,000
I have my SSH client configured to multiplex my sessions: Host * ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600 I'm occasionally bumping into the default OpenSSH server side MaxSessions limit of 10. The obvious answer is to increase MaxSessions to a number significantly larger than I'd eve...
There is always a reason why to limit anything. The 10 is "sane default". The less is for more restrictive use cases (preventing shell access or allowing only single channel), bumping it to more can also make a sense, if you really know, you will be issuing millions of sessions. I rarely open more than 4. To the quest...
Why not set OpenSSH's MaxSessions to 1000000? [closed]
1,635,063,773,000
I have the following setup where I use an OpenSSH server to remotely start a certain command using ssh. My authorized_keys file has the following entry: command="/path/to/script.sh $SSH_ORIGINAL_COMMAND",no-port-forwarding,no-x11-forwarding,no-agent-forwarding ssh-rsa AAAA…qGDf my_special_key This means that if anyo...
Use quotes: cat bin/script.sh #!/bin/sh printf '<%s>\n' "$@" command="/home/user/bin/script.sh \"${SSH_ORIGINAL_COMMAND}\"" ssh-rsa AA... ssh -i .ssh/id_rsa.special hamilton '*' <*> ssh -i .ssh/id_rsa.special hamilton 'foo bar' <foo bar> But also you will get: ssh -i .ssh/id_rsa.special hamilton '*' 'foo bar' <* foo...
OpenSSH: Prevent globbing on SSH_ORIGINAL_COMMAND
1,635,063,773,000
By default, my SSH client disallows the use of the diffie-hellman-group-exchange-sha256 key exchange algorithm. However, I need to access a server on 10.0.0.1 that requires the use of that algorithm. This works fine at the command line: $ ssh -o KexAlgorithms=diffie-hellman-group-exchange-sha256 [email protected] Pas...
OpenSSH options might behave somehow strange on the first sight. But manual page for ssh_config documents it well: For each parameter, the first obtained value will be used. The configuration files contain sections separated by “Host” specifications, and that section is only applied for hosts that match one of the p...
Specifying SSH KexAlgorithms works at CLI but not via ssh_config [duplicate]
1,635,063,773,000
The title basically says it all. But mind: host key, not the login key. And if they're not compatible out of the box, is there a way to convert between them - and what would be the steps in that case? Rationale: it would be nice to be able to bring up a dropbear instance in the scope of the initrd, if boot fails, but ...
After the misunderstanding that I am referring to host keys instead of login keys, I decided to dig into this a little myself. The main point was to establish whether the formats are compatible, not whether they're different (I knew they are). Trying to install dropbear over a system that already had OpenSSH of course...
Are dropbear and OpenSSH host keys compatible?
1,454,834,906,000
I want a host section in my ssh config that matches any local IP: Host 10.* 192.168.*.* 172.31.* 172.30.* 172.2?.* 172.1?.* setting setting ... This works as long as I connect directly to a relevant IP. If I however connect to a hostname that later resolves to one of these IPs, the section is ignored. sshd has ...
You can't do that using only ssh_config options, but there is exec option, which can do that for you: Match exec "getent hosts %h | grep -qE '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'" setting
ssh_config: Add a host section that matches IPs even when connecting via hostname
1,454,834,906,000
Since I want to protect my ssh connections, I set some global cipher suite options to restrict set of used algorithms. But recently I've encountered a server which doesn't support some of those algorithms. So, I need to selectively enable deprecated algorithms for a specific host record in client (my system) configura...
OpenSSH options might behave somehow strange on the first sight. But manual page for ssh_config documents it well: For each parameter, the first obtained value will be used. The configuration files contain sections separated by “Host” specifications, and that section is only applied for hosts that match one of the p...
options override for openssh client configuration
1,454,834,906,000
How to disable ChaCha20-Poly1305 encryption from ssh under Debian? I tried (as root): echo 'Ciphers [email protected]' > /etc/ssh/sshd_config.d/anti-terrapin-attack echo 'Ciphers [email protected]' > /etc/ssh/ssh_config.d/anti-terrapin-attack systemctl restart sshd But my ssh -Q cipher is still showing [email protec...
ssh -Q cipher always shows all of the ciphers compiled into the binary, regardless of whether they are enabled or not. This is true also for algorithms which are insecure or disabled by default. The configuration you have set up should be sufficient to disable the algorithm, assuming you're using a recent version of ...
How to disable ChaCha20-Poly1305 encryption to stop the terrapin ssh attack
1,454,834,906,000
Here's the problem: I'm trying to SSH into a system that is accessible from at least 3 different networks—sometimes directly, sometimes via a proxy—at different times. Connecting directly is far faster and more reliable than connecting via an intermediate host, which is again far faster and more reliable than connecti...
Do not use aliases for ssh connections! Use a proper ssh_config in ~/.ssh/config. It has some truly powerful features. Lets say you can identify in which network you are. For example using your IP, which can be pulled for example using hostname -I. So lets write some configuration: # in network1 I am getting ip from "...
How to use the same SSH alias with multiple host addresses/ports/etc.?
1,454,834,906,000
Possible Duplicate: How to speed my too-slow ssh login? I have a very strange issue with my SSH server. Whenever I attempt to connect, it literally waits about 30 seconds to a minute before allowing the connection. Other servers in the same datacenter are connecting in about 2-3 seconds, while this one waits just ...
Check the debugging output (-vvv) to see if it is waiting for protocols that don't exist on that server. I've had similar symptoms with gssapi authentication. See where the program is hanging and try to turn off that authentication, for example adding -o GSSAPIAuthentication=no to the command line or to the config f...
SSH "sleeping" for a long time before connect? [duplicate]
1,454,834,906,000
These do not do the same: $ seq 1000000 | (ssh localhost sleep 1; wc -l) 675173 $ seq 1000000 | (ssh localhost sleep 1 </dev/null; wc -l) 1000000 What is the rationale for ssh reading stdin?
ssh always reads stdin unless you tell it not to with the -n option (or the -f option). The reason is so that you can do things like tar cf - somedir | ssh otherhost "tar xf -" And it always does this because ssh has no way of knowing if your remote command accepts input or not. Likely what is happening in your first...
ssh reads stdin without being asked to
1,454,834,906,000
Is DNS resolution tunneled to the other end when I use a SOCKS proxy created with ssh -D? I have read the manual, searched the Internet, and found no documentation relevant.
DNS resolution via Socks is up to the client. You have to explicitly tell the application to lookup DNS via Socks. Name resolution is, just like connecting to a host, done by system calls like gethostbyname() or getaddrinfo(). Unless instructed otherwise, a program may just use this function for name resolution which,...
Does `ssh -D` proxy DNS request?
1,454,834,906,000
I am a beginner and new to development boards and Linux as a whole, and have been using the wonderful SSH package with Debian (I believe this is OpenSSH) to tinker around and learn more without the need to be physically connected to my Pi through a serial cable. I have followed various websites and threads on this fo...
The ListenAddress is actually telling which system interface the SSH server should listen on (0:0:0:0 makes it listen to all interfaces). For instance if your system has a Wifi (on 10.0.1.4) and an Ethernet (10.0.1.12), ListenAddress 10.0.1.12 will make it listen only on the Ethernet interface, and other computers wil...
How can I restrict SSH to only listen for requests from my local network?
1,454,834,906,000
TLDR In sshd_config(5), this config segment: Match Address fe80::/10 PasswordAuthentication yes ... is not matching link-local IPv6 addresses as expected. Why and how to fix? I am trying to configure sshd to only allow password authentication when connecting from local addresses. Otherwise public key authent...
After trying just about everything I could think of, I was able to find a solution that worked for me. I wanted to allow password auth to users on my LAN but only allow key based auth from outside the LAN which is why I ended up finding this post. From other reading I saw some indication that square brackets should be...
sshd_config - "Match Address <IPv6>" not matching
1,454,834,906,000
I have a CentOS VM to which I log in using SSH. I appended the following line to .bashrc echo "from ~/.bashrc: (pid $$)" and the following line to .bash_profile echo "from ~/.bash_profile" When I log into the VM and run ps I get the following output user@laptop:~ $ ssh vmcentos Last login: Sun May 17 04:48:24 2020 f...
According to the manual, it's supposed to do that: Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If Bash determines it is being run in this fashion, ...
Why is bash sourcing .bashrc in non-interactive mode when working via ssh?
1,454,834,906,000
I am having a weird problem. I am not able to ssh to docker container having ip address 172.17.0.61. I am getting following error: $ ssh 172.17.0.61 ssh: connect to host 172.17.0.61 port 22: Connection refused My Dockerfile does contain openssh-server installation step: RUN apt-get -y install curl runit openssh-serve...
Container vs. Image The RUN statement is used to run commands when building the docker image. With ENTRYPOINT and CMD you can define what to run when you start a container using that image. See Dockerfile Reference for explanations how to use them. Services There is not preinstalled init-system in the containers, so...
openssh-server doesn't start in Docker container
1,454,834,906,000
I've setup public key authentication for enabling SSH connection into my university machine. However, it only logs me in on the local machine and doesn't give me Kerberos credentials which I need for accessing my network folder. This causes problems with tools like git. Is there a way for me to automatically get Kerbe...
Kerberos will work only if you authenticate to Kerberos-enabled server by password. You can: set up kerberos trust for the incoming user if the user is already authenticated by known realm; enable GSSAPI forwarding of credentials on ssh client and server ('ssh -K', GSSAPIAuthentication for sshd), this would work if s...
Public Key Auth + Kerberos
1,454,834,906,000
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 sequence numbers during the handshake, an attacker can remove an arbitrary amount of messages sent by the client or server at the ...
This sounds like a big scarry attack, but it's an easy fix. To mitigate the attack, see my Thwarting the Terrapin Attack article for SSH configuration details. Specifically you need to block the ETM HMACs and ChaCha20 cipher as follows: For recent RHEL-based Linux systems (Alma, Rocky Oracle, etc), this will work: # ...
How do you mitigate the Terrapin SSH attack?
1,454,834,906,000
For some remote work, I sometimes use X11 forwarding on ssh connections, but usually don't. But, instead remebering to use the -X flag on my ssh connection, I can also set ForwardX11 yes to enable it by default. My question is, is there any (significant) downside to having X11 forwarding always enabled while not activ...
When writing about this topic, I recommend reading through this paper: http://www.giac.org/paper/gcih/571/x11-forwarding-ssh-considered-harmful/104780 It describes the consequences of letting ForwardX11 option turned on by default in really nice and prosaic way. But to sum this up, yes, you should turn this off by def...
Is there a downside to enabling X11 forwarding in ssh?
1,454,834,906,000
I need to log ssh passwords attempts. I read somewhere you could get this done by patching openssh but I don't know if that is the correct way to get this done. I am using Arch. EDIT: I want to get the passwords people tried to guess to gain access to my system. It could be with journalctl or get piled in a text file....
What I think is a better answer is to download the LongTail SSH honeypot which is a hacked version of openssh to log username, password, source IP and port, and Client software and version. The install script is at https://github.com/wedaa/LongTail-Log-Analysis/blob/master/install_openssh.sh I also do analytics at htt...
How can I Log ssh login passwords attempts?
1,454,834,906,000
I am trying to achieve to perform scp via specific NIC. I read SCP man page but couldn't find required flags.
Use BindAddress or BindInterface options using -o switch. For example: scp -o BindAddress=x.x.x.x ...
scp: using specific NIC
1,454,834,906,000
We have RHEL v6.9 server and OpenSSH v5.3p1 is installed on it (confirmed by rpm -q openssh which outputs openssh-5.3p1-123.el6_9.x86_64). After the security testing, we are asked to upgrade OpenSSH to v7.3, to avoid any vulnerabilities. I have tried yum update openssh and it says No Packages marked for Update Any id...
You’re using the latest officially packaged version of OpenSSH on RHEL 6.9, which is still supported (and will be, without an extended support contract, until late 2020): This means that all known vulnerabilities in your version of openssh are fixed, and newly-discovered vulnerabilities which are discovered in the fu...
RHEL 6.9 - Upgrade OpenSSH from 5.3 to 7.3
1,454,834,906,000
I would like to replace the default 2048 bit host key generated when installing OpenSSH or starting it the first time with one of 4096 bit length. This leads to two questions: Does OpenSSH allow running with a 4096 bit RSA host key (for SSH2 obviously)? How can ssh-keygen be convinced not to prompt for a passphrase? ...
Whatever key-length is supported in ssh-keygen most likely would work with sshd as well. Besides that, you should generate your host-keys with ssh-keygen -h anyways, so if ssh-keygen isn't totally dumb, it should inform you if the desired key-length is not supported for host keys. The passphrase could be specified wi...
Generate own (stronger) RSA host key for OpenSSH?
1,454,834,906,000
I have the following network topology: workstation <-> network_device <-> authentication_server When I log in to network_device from workstation over SSH, then network_device checks with TACACS+ authentication_server if I have a permission to log in, what are my access rights for that network_device, etc. When I exec...
The bulk of what you want to know is in log.c in the OpenSSH source. There is an enum variable called log_level. (Enum meaning it acts like a number under the hood, but each level is associated with an easy-to-understand name.) This log_level variable is set globally and acts as a mask for hiding logs you aren't inter...
How does OpenSSH LogLevel option work?
1,454,834,906,000
Is it possible to set the AuthorizedKeysFile setting explicitly such that it covers the following cases: standard user under /home/%u/.ssh/authorized_keys system user under /var/lib/%u/.ssh/authorized_keys root user under /root/.ssh/authorized_keys My question is, is there a variable that contains the user directory...
You have indicated that you would accept using the the user's home directory to be used as the base for .ssh/ - whether the user is a real user, system user or root. I'm inferring this from your question: I tried to solve this by changing my /etc/ssh/sshd_config to AuthorizedKeysFile ~/.ssh/authorized_keys This fa...
How can I provide the authorized_keys path in sshd that allows normal users, system users, and a root user?
1,454,834,906,000
Problem: When running the ssh-keyscan command in cron it emails me the output of ssh-keyscan every day. The email simply contains the following. # <hostname> SSH-2.0-OpenSSH_5.3 My (simplified) cron job: host=`uname -n` SSHKey=`ssh-keyscan $host` echo $SSHKey >> /root/.ssh/known_hosts My question: How do I preven...
redirect stderr into /dev/null host=`uname -n` SSHKey=`ssh-keyscan $host 2> /dev/null` echo $SSHKey >> /root/.ssh/known_hosts
Prevent ssh-keyscan from generating output
1,454,834,906,000
I have read numerous solutions to this problem, but none seem to apply to what I'm seeing. Most focus on directory permissions, but those appear to be correct in this case. TL;DR: Two Centos7 servers with the same home directory; one's sshd is not allowing publickey authentication even though it is enabled. I have two...
Some additional googling revealed to me that the issue was with SELinux being enabled on the new systems I've configured. In my case setting this to permissive solves my issue. # getenforce Enforcing # setenforce 0 # getenforce Permissive That might not be the right solution for people who require SELinux in their en...
ssh publickey authentication failure: receive packet: type 51. sshd is not accepting publickey auth at all
1,454,834,906,000
I have multiple keys (some private, some public) and I want to get information about them (their length, their type, anything else). Is that possible?
Based on the question tags, I’m assuming you’re asking about SSH keys. For public keys, you can ask ssh-keygen: ssh-keygen -lf /path/to/key.pub This will show you the key type (at the end of the output), its length (at the beginning), and its fingerprint. For private keys, you can ask openssl, but you’ll need to know...
Read key properties
1,454,834,906,000
I am trying to have a local Unix domain socket, say, ~/docker.sock. I want it to proxy everything to a remote Unix domain socket running elsewhere over SSH. (You can find a diagram of what I’m trying to do below). OpenSSH supports this (an example here). For instance, this command will proxy MySQL client connections o...
The man page for ssh offers two complementary options: -R for remote forwarding to local, and -L for local forwarding to remote. In your case just use -L instead of -R.
Proxying traffic on local unix to a remote unix socket over SSH
1,454,834,906,000
In my current work setup, I have: Windows 7 laptop Ubuntu virtual host / SSH Windows 2k8 guest I'd like to be able to RDP from my laptop into the Windows guest without having to open additional ports or have Windows RDP directly exposed to the internet. If I forwarded localhost:10467 to ubuntuhost:22 using Putty, ca...
With a tunnel SSH, you can do something like that: laptop Ubuntu server guest ____ 10467 22 _____ ? 3389_____ | |___________________| |__________| | |____| \ |_____| |_____| \ \__SSH connection But take care t...
Can an OpenSSH server forward inbound traffic to another server?
1,454,834,906,000
Is it possible to configure OpenSSH (or any other standard sshd) to accept any key offered by a connecting client? EG ssh -i ~/arbitraryKey hostname grants a login shell while ssh hostanme doesn't. I ask because of a half remembered anecdote about a misconfigured server but I've had a look and I couldn't find anything...
Configuring an SSH server to accept any password would be easy with PAM — put pam_permit on the auth stack, and voilà. The possibility of misconfiguring such an open system is inherent to the flexibility of PAM — since it lets you chain as many tests as you want, the possibility of doing 0 tests is unavoidable (at lea...
Accept any private key for authentication
1,454,834,906,000
I'm a bit confused what the "correct" path for ssh's systemwide known_hosts file is.. the man ssh says /etc/ssh/ssh_known_hosts whereas SSH Host Key - What, Why, How talks about /etc/ssh/known_hosts. Are both locations valid? Is the difference a historic artefact? Is it distribution specific? Which file path should be...
For OpenSSH, its man page is the canonical documentation. According to ssh(1) - OpenBSD manual pages, /etc/ssh/ssh_known_hosts is the official path for the “systemwide list of known host keys”. This applies to all releases of OpenSSH and is not specific to any one distribution – or OS for that matter. SSH.COM is the w...
openssh-client - what is correct location for global known_hosts file?
1,454,834,906,000
Short Question I'm assuming that ssh-keygen -r hostname uses a default public key. I would have thought that it would default to ~/.ssh/id_rsa.pub, but that does not appear to be the case. So what is it doing? Long Version My experience with the OpenSSH command-line utilities is that they either prompt the user for an...
ssh-keygen -r generates a SSHFP record. That's something you put in a DNS entry to say indicate the host key corresponding to a host name. This allows someone who wants to log into your machine to know what host key to expect, assuming that they trust the DNS record (which in practice means that it must be obtained us...
What does `ssh-keygen -r` do if a public key is not specified?
1,454,834,906,000
How can I specify the order in which OpenSSH's SSH client (OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017; Git for Windows v2.11.1) offers the public/private key pairs to a SSH compliant daemon such as Apache Mina SSHD (Gerrit Code Review service). My intention is to try to authenticate with an Ed25519 public/private key ...
Add IdentitiesOnly option. Without this option SSH tries first default ssh-keys available: id_rsa, id_dsa, id_ecdsa. To change this behaviour replace your config with this one: Host foobar foobar.example.com Hostname foobar.example.com IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes Host * IdentityFile ~/.s...
OpenSSH's SSH client not respecting order of IdentityFile settings
1,454,834,906,000
How do I configure sshd to 1) require public key and 2) require a password for login? Note that I am not referring to the symmetric encryption of the client's key here. I am referring to a server-side password. Is this possible?
The linked answer in the other answer is really old and there are many changed things since then. So once again: If you read through the manual page for sshd_config(5), there is option AuthenticationMethods, which takes the list of methods you need to pass before you are granted access. Your required setup is: Authent...
How do I configure sshd to 1) require public key _and_ 2) require a password for login?
1,454,834,906,000
I have my DNS search path set to ".intranet", ie, /etc/resolv.conf contains: search intranet When I SSH to a host using a FQDN, like "mailserver.intranet", it adds an entry for "mailserver.intranet" to ~/.ssh/known_hosts. If I later SSH to this same host but using the simple "mailserver" name, SSH adds another entry ...
You could use aliases for host keys: Host <hostname>* hostname <fqdn> HostKeyAlias <alias> Your key will be saved to known_hosts as "alias" instead of "hostname" either short or long, the downside is you have to write an entry for each one of your hosts. Please note the '*' after the hostname at the fir...
Avoiding duplicate entries in ~/.ssh/known_hosts
1,454,834,906,000
I'm sure this has been answered before, but I could not locate the answer with Google, and this search. I currently only allow shared key authentication for openssh server on my box. However, I would like to be able to use password auth, when I am connecting locally, via my internal (192.168.1.x) subnet. Is it possi...
Use a Match directive in /etc/sshd_config. PasswordAuthentication No Match Address 192.168.1.0/24 PasswordAuthentication yes You can restrict this to a few users (who you trust not to choose terrible passwords), for better security. PasswordAuthentication No Match Address 192.168.1.0/24 User joe,bob PasswordA...
Use different authentication methods for OpenSSH server depending on client IP
1,454,834,906,000
Does gnome-keyring support SSH private keys that are saved in the newer OpenSSH file format? Will Gnome Keyring automatically import those private keys? In more detail: When generating a SSH private key, ssh-keygen can save the private key in the newer OpenSSH format (rather than the "more compatible PEM format"). W...
Things have changed slightly now. As a result GNOME 3.28 now wraps OpenSSH's ssh-agent, which gives it the same level of support as OpenSSH. Reference - Archlinux wiki - GNOME/Keyring Known issues Cannot handle ECDSA and Ed25519 keys As of January 2018, GNOME Keyring doesn't handle ECDSA nor Ed25519 keys. You can t...
Does Gnome Keyring support new-format OpenSSH private keys?
1,454,834,906,000
On my vanila Arch Linux system, I can send to local tmux-session (session main) using: $ tmux send -t main.0 'echo asdf' ENTER I can also send commands to a remote machine using ssh: (just for the demonstration, I'm using localhost): $ ssh garid@localhost "ls /home" I want to send command to tmux-session in remote-...
In the comments, we've confirmed that the intended command, ssh remote "tmux send -t main.0 'echo asdf' ENTER" ... works when remote is not the local host. We have also confirmed that the reason the command fails when connecting to localhost is that the TMUX_TMPDIR variable is unset in the SSH session. This environm...
How to send a command to tmux-session of remote-device (using ssh)
1,454,834,906,000
I'm using ControlMaster auto ControlPath ~/.ssh/tmp/%l_%r@%h:%p in my ~/.ssh/config to open multiple sessions using the same connection when accessing a host via SSH. That works fine for most use cases, but doesn't allow me to connect to the same hostname via IPv4 and IPv6 at the same time; all additional con...
I've split my answer into two separate answers so you can up/downvote the "wrapper" and "patch" approaches separately. Solution 1: Write a wrapper function ssh () { controlpath="" for argument in $@ do if [[ "$argument" = "-"*"4"* ]] then controlpath="~/.ssh/tmp/%l_%r@%h:%p.inet...
How to make SSH's `ControlPath` distinguish between IPv4 and IPv6?
1,454,834,906,000
I have an AIX server which suddenly stopped servicing SSH connections. When I try to start the service through startsrc -s sshd it says: 0513-059 The sshd Subsystem has been started. Subsystem PID is 258300. However, right after issuing the command, the services status shows up as inoperative: sshd ssh ...
Looks like libz.so.1 is missing on your system.
sshd process inoperative
1,454,834,906,000
I'm looking to install Debian over my Android installation so as to be able to use openssh-server, as it's so much better than Dropbear. Is there an easy way to do this, or just to simply install openssh-server on my phone? I'm running Android 2.3.X on a Google Nexus One.
If you want to run an ssh server on a rooted phone, you can install SSHDroid. You can build a Debian image via deboostrap. Debian runs on ARM so you wont have problems building an image for that arquitechture. There is an interesting howto writen for SG1, you could try it out.
Is there a way to run an ssh server on an Android device?
1,454,834,906,000
In the environment I work in, we use tunnels to SSH to various servers. For example, I'll 'ssh -p XXXXX username@localhost' to reach the server. If the port was always the same, I could do this, and I'd be done: Host somehost User bryan Hostname localhost Port 12345 ProxyCommand ssh -p 2218 [email protected...
It is not possible to write a script in the configuration file to pull a variable for port number. But you can write a bash function to get the port for you and place it into the correct place. For example place the following to the ~/.bashrc: function ssh-dynamic() { PORT=`sh get_port_for_somehost.sh` exec ssh -p...
.ssh/config ProxyCommand with a variable port
1,454,834,906,000
SOLVED! The machine is a Dell Poweredge system which ran what they call iDRAC in the background - iDRAC in its turn ran a SSH-server which conflicted with the one I installed in Debian. The solution for me was just to disable iDRAC since I don't use it, and I'm glad I don't. I have no idea how that conflict should'...
SOLVED! The machine is a Dell Poweredge system which ran what they call iDRAC in the background - iDRAC in its turn ran a SSH-server which conflicted with the one I installed in Debian. The solution for me was just to disable iDRAC since I don't use it, and I'm glad I don't. I have no idea how that conflict should've ...
SSH won't work before manually restarting networking.service
1,454,834,906,000
I'm trying to connect to my Redhat AWS instance with a port other than 22. This command works: ssh -i my.pem -p 22 [email protected] But this command does not:ssh -i my.pem -p 8157 -vvv [email protected] The second command outputs: OpenSSH_7.6p1, LibreSSL 2.6.2 debug1: Reading configuration data /etc/ssh/ssh_config...
This command works: ssh -i my.pem -p 22 [email protected] But this command does not: ssh -i my.pem -p 8157 -vvv [email protected] Your other side may have opened port in the firewall, but... Since port 22 works, your server listens on that port. Re-configure your server to listen on whatever port you wish. You can...
ssh Connection refused, stuck at "debug1: Local version string"
1,461,309,630,000
In my SSH config file, I have to enable the RequestTTY force for some important reasons. And currently my config file looks like this: Host x.x.x.x HostName yyyy StrictHostKeyChecking no RequestTTY force IdentityFile ~/path/id_rsa But now when I execute an scp command, it completes but creates an empt...
There are many possible solutions for that: You can configure sudo not to require tty: RequireTTY in /etc/sudoers You can force tty allocation on command-line in these specific cases, where you need it: ssh -tt host command You can tell scp not to allocate TTY by -T or -o RequestTTY=no command-line option: scp -T fil...
Why does SCP fail when "RequestTTY force" option is enabled?
1,461,309,630,000
We are running CentOS 6.9 with OpenSSH_5.3p1 and created chrooted accounts for external users with the same home directory (mounted to htdocs). Problem is that the file .ssh/authorized_keys2 is owned by the first user (and this works already). How can I make it work for another user? I tried to add an AuthorizedKeysFi...
One option is to use tokens to give each user a unique authorized_keys file. From man sshd_config: AuthorizedKeysFile Specifies the file that contains the public keys that can be used for user authentication. The format is described in the AUTHORIZED_KEYS FILE FORMAT section of sshd(8). AuthorizedKey...
authorized_keys for multiple chrooted users with the same home directory
1,461,309,630,000
Is there a command to extract information about the algorithm that is used (RSA, ECDSA, 3DES ...) for SSH keys, regardless of the format (pem, der etc)? I looked into openssl, but I could not find anything about this.
You can use next command to get the type of the key (RSA, DSA, etc): # ssh-keygen -l -f .ssh/id_rsa 2048 SHA256:4+Na0ttfBkspSFSYnRjwbwja8/b708lRxzqjPBzLJMw ........ (RSA) # ssh-keygen -l -f .ssh/id_dsa 1024 SHA256:F6h53Zu0A9M094CbszkwxfQ5L2EZ0kUEpLkH0dp1alU ........ (DSA) # ssh-keygen -l -f .ssh/id_ed25519 256 SHA256:...
Extract ssh key algorithm
1,461,309,630,000
I have SSH public key (generated on my Mac) in OpenSSH format like this: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXaDj1YGcvKIhUIgmjV/Mjz8so5O2tdxG9gVlTwCxuFLjcUOsciB5R+hZ28GZtb9tb0p4ZSGd8bLcUnI/tqFlVBfRKhfixbvJlDJkzh1eqzqjgCz7Sgd7vo/9pX4FNmajcdt4nsgMI0Q0NLZOWF0M90gTAkcpfCVyt561IIrHK0MpWPqQbp917X8hfRH23sgo8B471FhN6j3ghS1...
I spent one night and I found this solution: OpenSSH public key must be converted to PKCS#1 PEM-encoded public key that is in base64: ssh-keygen -f id_rsa.pub -e -m pem Next, use base64 to HEX converter like this: http://tomeko.net/online_tools/base64.php?lang=en Enter string without begin and end mark -----BEGIN RSA...
Convert OpenSSH public key to a PKCS#1 in HEX format with spaces and columns
1,461,309,630,000
I have installed openssh server. I want to disable banner which is shown when I do :: nc 0.0.0.0 22 It shows something like this :: SSH-2.0-OpenSSH_6.7p1 Raspbian-5 . How to make it show something else or nothing at all ?
This banner SSH-2.0-OpenSSH_6.7p1 Raspbian-5 is part of SSH protocol as described in chapter 4.2. Protocol Version Exchange of RFC 4253: When the connection has been established, both sides MUST send an identification string. This identification string MUST be SSH-protoversion-softwareversion SP comments CR...
Change SSH banner which is grabbed by netcat
1,461,309,630,000
My office has one default gateway and behind that is a local network with locally assigned IP addresses to all computers including mine. I hold admin in my Ubuntu installed office PC and is it essential that I access the computer during weekends through SSH. At office, I do not have a public IP but I always get the sa...
It's easy: [execute from office machine] Setup connection Office -> Home (as Home has public IP). This will setup reverse tunnel from your office machine to home. ssh -CNR 19999:localhost:22 homeuser@home [execute from home machine] Connect to your office from home. This will use tunnel from the step 1. ssh -p 19999 ...
SSH PC at office in local network from home
1,461,309,630,000
I have the reverse problem that most people seem to be having. If I start an X application while logged into ssh, it displays on the server(host) machine instead of the client(local). This is the command I use $ ssh -X -p 6623 [email protected] My $DISPLAY variable appears correct on the client. $ echo $DISPLAY :0 I...
For the sake of this conversation lets say there are 2 machines named lappy and remotey. The lappy system is where you'd be running your ssh commands from. The system you're connecting to is remotey. 1. Display GUIs from remotey on lappy lappy .-,( ),-. __ _ .-( ...
SSH - How to make X applications run on client?
1,461,309,630,000
I configured key pairs for SSH connection. It works but of course asks for the passphrase. ssh [email protected] So now I try to login with sshpass which I have installed. I tried with -p property but also and with -f property and nothing works - it just hangs. verbose gives these info on the client side sshpass -v -...
ssh prompts for and reads password (or passphrase) using the terminal (/dev/tty), not its stdin. This way you can pipe/redirect data to/from ssh and still be able to provide a password when asked. But to provide a password not via the terminal, one needs to present a "fake" terminal to ssh. This is what sshpass does. ...
"ssh" works but "sshpass" doesn't - how is this possible?
1,461,309,630,000
How are lines removed from a standard (system) systemd unit file? Here are the details: ls -la /etc/ssh/ssh_host_*key* This shows I have unused and unwanted host key types. They are not configured in my sshd_config, but I prefer they not exist at all. If I remove them, they get auto-regenerated. From what I see, /usr...
In systemd units, lists can typically be reset in overrides by assigning an empty value. This works for conditions too: If any of these options is assigned the empty string, the list of conditions is reset completely, all previous condition settings (of any kind) will have no effect. In your override, use this: Cond...
How to remove (not override, not create new) options from systemd unit files?
1,461,309,630,000
I have already configured login to ssh with keys and it works fine. The problem is that when I'm connecting to the server with key and included password but I don't see any failed login attempts when I type a wrong password. There are no failed login attempts using key in: /var/log/audit/audit.log or /var/log/secure...
It sounds like you've configured your client key to require a password to open the key before connecting to the server. It won't be logged by your server because that occurs on the client machine.
Logging wrong password for ssh with key
1,461,309,630,000
Say for some reason, there is only a "user" account on a shhd server. Everyone has his own private key to ssh to the server, as "user". Then, is there a way to see who is he (during or after his session)?
You can see which SSH public key was used in the syslog. The authentication subset of the syslog is usually at /var/log/auth.log. For the whole syslog, you can try /var/log/syslog or /var/log/messages. The log lines should look something like this: Sep 10 19:17:00 server.example.com sshd[1337]: Accepted publickey for...
How to know which public key was used when someone used passwordless ssh login?
1,461,309,630,000
Let's say I use this command: ssh -vvv user@server I get an output similar to this: send packet: type 21 ssh_set_newkeys: mode 1 receive packet: type 6 SSH2_MSG_SERVICE_ACCEPT received receive packet: type 51 Permission denied (publickey,password) What are all these packet-types? Where can I read and learn about th...
SSH is defined in IETF RFCs like RFC4253 - The Secure Shell (SSH) Transport Layer Protocol (note that there's errata and several updates) RFC4250 - The Secure Shell (SSH) Protocol Assigned Numbers In general the places to find out how things work are IEEE standards and IETF RFCs. They're not the easiest read, the la...
How to read and debug SSH verbose-mode?
1,461,309,630,000
Short Description I have been seeing an strange behaviour on my SSH connection for years but never thought of raising a question until today. I tried to search a lot about this but couldn't find any reason. Environment Basically, I have various AWS EC2 instances running on different regions (like Ireland, Mumbai etc....
I would surmise that a system tracking (and forgetting) connections statefully is causing this. When NAT is in use (and it's very often the case when not on IPv6) then usually the system doing NAT needs a memory to remember where to send back replies. For your Wifi broadband, the system doing NAT might have a longer m...
SSH connection freezes on 4G Hotspot but not on any Wifi
1,461,309,630,000
In sshd config you can specify the option TCPKeepAlive yes. These Pakets are not encrypted so the could be spoofed. With the options ClientAliveInterval ClientAliveCountMax ServerAliveInterval ServerAliveCountMax you can specify the interval of the keep alive packets and the timeout (*CountMax) after which the conn...
The reason why OpenSSH doesn't offer any tweaks for TCPKeepAlive (which is implemented by the OS) is probably because there's no portable way to change its parameters; the only portable thing is turning it on or off with setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on_off). On Linux, you can see (and change) the default ...
OpenSSH: What is the interval for TCPKeepAlive option?
1,461,309,630,000
I'd like to run a privileged command upon successful SSH logins at the server's end. However, this has to be in the server configuration (sshd_config or anything else that cannot be manipulated or circumvented by the user) as I need this to be mandatory. That is, however restricted the system account used is, it needs...
You can do this using PAM and the pam_exec.so module. You simply add a line to /etc/pam.d/sshd to the 'session' section such as the following: session optional pam_exec.so /usr/local/bin/ipset-ssh Where ipset-ssh is some script you create. The script will be run as root. You can get the client's IP address with...
Is there a way to run a privileged command upon successful SSH login (not necessarily with shell or PTY)?
1,461,309,630,000
I have a problem with an SSH session freezing after using it again when it was idle for a while. The problem is that the session doesn't freeze immediately, I can still use it. But as soon as a command sends more data, it freezes before any output arrives, and I have to restart the terminal. If have read earlier solut...
Change ~/.ssh/ssh_config to ~/.ssh/config. Make sure the permissions on it are 700. This discussion has a lot of good information. You can also follow the tag for ssh (just click on /ssh under your question) to go to a tag wiki for more information and trouble shooting guidance.
SSH connection freezes after bigger output when inactive for a while
1,461,309,630,000
I'm trying to set up SSH multiplexing, but I'm running into an error, and there are insofar 0 hits on Google for the exact error message. I created ~/.ssh/config with the contents: Host * ControlPath ~/.ssh/master-%r@%h:%p Then, I created the master connection by running: ssh -vMM [email protected] which seems to c...
I've figured out what is causing the "Access denied" error. By default, SSH seems to want to interactively ask for permission when another SSH process wants to use an existing multiplex session. However, the ssh-askpass program, which it uses to ask for permission, was missing on my system, so SSH defaults to "no, don...
Master refused session request: Permission denied
1,461,309,630,000
Is there any way to configure OpenSSH (/etc/ssh/sshd_config) server to allow private keys necessarily with passphrase?
No, you have little control over how the private keys are configured, and you can't detect / enforce any passphrase requirement on them. You also can't limit the size of the keys without modifying the OpenSSH source itself (i.e. there is no configuration option to achieve a minimum key length limit). You can limit the...
How to limit connections to OpenSSH server to using private keys necessarily with passphrase?
1,461,309,630,000
By default, recent versions of OpenSSH automatically set ForwardX11Timeout to 20 minutes if you set ForwardX11Trusted to no. This means that 20 minutes after you start your ssh connection, you can't open any more X clients, because the authentication token has expired. Especially bad if you try to use this with long-l...
There was a patch 2018-04 and discussion 2018-06 but my search of mailing list archive by subject lines alone suggests it was not yet accepted as of 2019-04. Duplicating some related info I posted at https://superuser.com/a/1429080/1027014 just now - The maximum timeout is uint_max of milliseconds minus some slack, j...
Disable ForwardX11Timeout without ForwardX11Trusted in OpenSSH Client?
1,461,309,630,000
We have a server on the company network named serverA, and if I type ssh serverA, it will connect my PC to this server, even though there is no entry for this server in my /etc/hosts, but I used to have another PC where I do have to set this up manually in /etc/hosts. So, how does ssh discover hostnames on the network...
This happens when the server is within the DNS search domain you have configured. For example, my current search domain is example.com: $ grep ^search /etc/resolv.conf search example.com I can now do the following transparently: $ ping foo.example.com PING foo.example.com (127.0.0.1) 56(84) bytes of data. ^C $ ping f...
how does ssh discover hostnames on the network?
1,461,309,630,000
I am able to ping my friend but not able to do ssh. Why so? He is using a modem. I thought there might be some firewall enabled. I told him to type #iptables -F He did that, but still I am not able to do ssh on his system. How can I do this? I get the error: ssh: connect to host 182.64.31.131 port 22: Connection refu...
As @sbtkd85 notes, it's almost certainly because port forwarding needs to be set up at his router/access point. Here's some related/maybe pertinent info: http://forum.portforward.com/YaBB.cgi?num=1139203841 Cheers, Robert
Can ping but can't do ssh
1,461,309,630,000
Here are basics information: $ which ssh /opt/local/bin/ssh It's like that because I'm using MacPorts and it did install there. I did the sudo port load openssh When doing a netstat -an | grep LISTEN on reboot. I have this: tcp4 0 0 *.2222 *.* LISTEN tcp6 0 0 ...
OS X comes with sshd already. It's running if you enable "Remote Login" in System Preferences under Sharing. If all you want to do is make it listen on a non-default port, the trick is as follows: Open /System/Library/LaunchDaemons/ssh.plist in your favorite text editor. Find the SockServiceName key. Change the strin...
I can't ssh on localhost at a certain port on os x
1,461,309,630,000
I have ArchLinux (kernel 4.8.4-1) machine which I try to turn into SSH server. For the last few days I've been struggling with getting it to work. I have read loads of articles, tutorials and other stuff like this but all of them look the same and none solves my problem. After running $ssh -vvv alagris@Oelkozadam ...
I have no idea what happened. I kind of gave up but then after a few reboots it just magically started working.
SSH to localhost server [closed]
1,461,309,630,000
Three server A,B & C. How to ssh connect from A to C via intermediate server B, if A to B & C to B are password less(key)? I encountered this in an interview. Anyone knows how?
The original question does not make much sense. But I can guess they wanted to ask about the servers A and C in private networks (so they do not "see" each other) and B visible to both of them. In this case, the answer is Remote Port Forwarding. With example: Create a tunnel B->C from C: C$ ssh -R 2222:localhost:22 B ...
How to SSH via intermediate server [duplicate]
1,461,309,630,000
What do I have to do to be able to access my local network over ssh with a dynamic IP address?
Use a dynamic DNS service. This is basically a little script or daemon that calls into a dns server so it gets updated whenever the IP changes. There are a number of providers for this service. For home use or only a few addresses you can use a free service like duck dns. I've used them since dyndns kicked off all the...
How to access my local network from anywhere over ssh?
1,461,309,630,000
I am unable to connect to ssh despite the fact that PermitRootLogin option is set to "yes" in my sshd_config. ssh localhost root@localhost's password: Permission denied, please try again. Here is my full sshd_config: PasswordAuthentication yes ChallengeResponseAuthentication no UsePAM yes X11Forwarding yes PrintMotd...
AllowUsers If specified, login is allowed only for user named that match one of the patterns. Add root to the list: AllowUsers root otheruser
Cannot use root ssh despite option "PermitRootLogin yes" in sshd_config
1,461,309,630,000
There are two (unix) users who are allowed to connect to my Debian Wheezy server using ssh: git and peter. While git is allowed to connect from everywhere, peter (who is in the sudo group) should be only allowed to connect from my local network. I therefore added the line AllowUsers git [email protected]/24 to my /e...
Use: AllowUsers git [email protected].* or for example: AllowUsers git [email protected]?? if only 200-254 are allocated for VPN connections. And make sure to read man ssh_config (the section PATTERNS). Yes, that's ssh_config, not sshd_config. But if you read the latter, you'll notice it refers to the former.
Restrict SSH login to local network: VPN connection not allowed
1,461,309,630,000
Having a problem installing an openssh rpm I hand-rolled today: [root@local_host ]# rpm -i openssh-6.7p1-1.i386.rpm error: Failed dependencies: libcrypto.so.1.0.0 is needed by openssh-6.7p1-1.i386 Huh? That's strange: [root@local_host ]# ls -l /lib/libcrypto* lrwxrwxrwx 1 root root 19 Jan 20 15:18 /lib/...
Aha! I added: Provides: libcrypto.so.1.0.0 libssl.so.1.0.0 to the spec file, respun and installed. NOW.... openssh installs without question! Question now is.... WHY? I don't see a lib or pre-requisite in the openssh.spec file. Update Thanks to Mark for putting me onto the requires bits... figured out that I had th...
RPM Says Shared Object Is Missing But I Can Find It With ls
1,461,309,630,000
I'm connected to Ubuntu server that is a member of a corporate Active Directory domain via likewise-open. The users are in the form mydomain\myuser. I can connect to it via ssh, escaping the \ with another \: ssh mydomain\\myuser@myserver I've generated a pair of keys via ssh-keygen, then tried to copy it to the remo...
The reason this is happening is because you are escaping it for the shell, but ssh-copy-id is also attempting to interpret it. This should work: ssh-copy-id 'mydomain\\myuser@myserver'
how to escape "\"in ssh-copy-id?
1,461,309,630,000
For those who worked with ssh port forwarding or for those who have an idea, I managed to create a remote tunnel from my PC to a remote machine(a camera that does not have a public address) through a ssh server ( has a public address ). The goal is to forward the access of the camera to the public with ssh remote port...
What you want is not to create a tunnel that listens on two remote machine ports, you want two tunnels that listen on the same remote port. That is not possible. How is ssh supposed to know to which port an incoming connection should be forwarded? There are solutions that can distinguish between protocols, but none of...
SSH Remote port forwarding with multiple ports
1,461,309,630,000
I am trying to set up my Openssh server to allow for chrooted sftp-only users as well as for non-chrooted sftp and ssh users. My condensed (comments and blank lines removed) /etc/ssh/sshd_config looks like this: Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparati...
Subsystem sftp intenal-sftp Should be "internal".
How to set up chrooted and non-chrooted sftp?
1,461,309,630,000
I have a lot of ssh public key logins on a Linux server, e.g.: Jul 25 11:41:01 host sshd[24594]: Accepted publickey for root from xxx.xxx.xx.xx port 33374 ssh2 This is strange for me since there's no authorized_keys file in the /root/.ssh directory. The AuthorizedKeysFile option in /etc/ssh/sshd_config has the defaul...
I've figured out what's going on. The messages are coming to the server from remote hosts via UDP. I didn't notice the host field changing at first, my mistake. BTW, actually there is a possibility to login using public key authentication with no authorized_keys file involved. RedHat (and variants) have a supported pa...
public key authentication without authorized_keys file
1,461,309,630,000
I have many reverse ssh tunnels and because monitoring ports can't be reused, I am trying to find a free random port for monitoring. Meanwhile I specified -M 0 and the forwards work great and in most cases: when there is a disconnection, it will automatically reconnect. However, sometimes, on rare occasion, a connect...
I ended up finding the answer: have an echo server on the ssh server and specify that as the monitoring port for all connections (better but requires setting up an echo server) find an available port range and have a way for each connection to create a unique port forward on a different port.
Specifying a random monitoring port with autossh
1,461,309,630,000
I am running an OpenVPN server on Ubuntu 14.04 as well as OpenSSH. I have my SSH server configured to bind to an IP address on my VPN interface. Once my machine boots, binding to that IP fails. Once I log in, can see with netstat that sshd is not listening. I am able to restart sshd and the machine will start listen...
I found a solution. In the OpenVPN configuration file /etc/openvpn/server.conf you can specify a script to run on up. If you take a look at the OpenVPN manual page man openvpn, you will see --up cmd. In the /etc/openvpn/server.conf configuration file, I added a line: up "/etc/openvpn/up.sh" This file is one that I cr...
Starting SSH server after VPN starts
1,461,309,630,000
I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did: ssh -L 80:127.0.0.1:8080 -N -f myserver But I get the error: Privileged ports can only be forwarded by root. I can execute sudo commands when logged in that server, but how can I do it for the purposes of port for...
You probably want ssh -L 8080:127.0.0.1:80 -N -f myserver Local port comes first. (That's not my political stance!)
SSH port forwarding: "Privileged ports can only be forwarded by root" error
1,461,309,630,000
This post is about applying the latest patch for OpenSSL to protect our port 443 web traffic, not using ssh to log into these systems. I went and obtained the lastest OpenSSL tarball source patch openssl-1.0.1g.tar.gz from here for my Linux workstation running CentOS 6.5, and built the patch, including ./config; mak...
Preamble: As observed in the question, openssl installs by default into /usr/local/ssl. My recommendation is to use ./config --prefix=/usr/local shared (notice the space before "shared") so that it installs there (and builds the shared library, libssl), rather than its own private subdirectory. If you do not do this...
How I Determine The latest OpenSSL patch is installed?
1,461,309,630,000
My sftp -v to host returns, Connecting to xxx.xx.xx.xx... OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to xxx.xx.xx.xx [xxx.xx.xx.xx] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: ...
Answer by narcisgarcia @ http://ubuntuforums.org/showthread.php?t=1482005 solved my problem. Summary: "Owner of the destination directory must be "root", and group/other users cannot have write permissions."
SFTP, SSH Couldn't read packet: Connection reset by peer [duplicate]