Bug 927363 - bash-completion does not complete hostnames from /etc/ssh/ssh_known_hosts
Summary: bash-completion does not complete hostnames from /etc/ssh/ssh_known_hosts
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: bash-completion
Version: 18
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-25 18:37 UTC by Ralf Oltmanns
Modified: 2013-03-31 15:17 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-03-31 12:52:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
-x output from completion as root user (9.98 KB, application/octet-stream)
2013-03-25 21:18 UTC, Ralf Oltmanns
no flags Details

Description Ralf Oltmanns 2013-03-25 18:37:59 UTC
Description of problem:
As in earlier Fedora releases, I use an unhashed /etc/ssh/ssh_known_hosts file with permissions 644.
When typing 'ssh bb1<tab><tab>' I am not offered any hosts starting with the string bb1 although there are 82 host entries starting with bb1 in my ssh_known_hosts file.

Version-Release number of selected component (if applicable):
$ rpm -q bash-completion
bash-completion-2.0-2.fc18.noarch

How reproducible:
Always.

Steps to Reproduce:
1. Type 'ssh some_partial_hostname<tab><tab>'
2.
3.
  
Actual results:
No result at all

Expected results:
List of all hostnames containing the partial hostname string in /etc/ssh/ssh_known_hosts

Additional info:
Linux iroquois.at.home 3.8.3-203.fc18.x86_64 #1 SMP Mon Mar 18 12:59:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Comment 1 Ville Skyttä 2013-03-25 20:22:03 UTC
The code that completes from /etc/ssh/ssh_known_hosts hasn't gone anywhere, and hostnames from that file do get included in completions for me.

Do a "set -x" in a shell, then invoke the completion, and attach the output here (edited as appropriate in case it contains something you don't want to post in public). Also, double-check the permissions of the /etc/ssh dir and /etc/ssh/ssh_known_hosts file that they're readable by the user you're completing as.

Comment 2 Ralf Oltmanns 2013-03-25 21:15:45 UTC
Permissions are:
ls -la /etc
drwxr-xr-x.   2 root          root            4096 Mar 25 22:03 ssh/
ls -la /etc/ssh/
-rw-r--r--    1 root root     678127 Mar 25 21:56 ssh_known_hosts

My non-privileged user can read the content of /etc/ssh/ssh_known_hosts as permissions suggest.

As user, following 'set -x' and trying i. e. 'ssh ad1<tab>' does not return any output at all.

As root, completion works for hostnames and following 'set -x' as expected I do get a verbous output (will attach that afterwards).

SElinux is disabled.

Comment 3 Ralf Oltmanns 2013-03-25 21:18:06 UTC
Created attachment 716220 [details]
-x output from completion as root user

Comment 4 Ville Skyttä 2013-03-26 15:54:46 UTC
(In reply to comment #2)
> As user, following 'set -x' and trying i. e. 'ssh ad1<tab>' does not return
> any output at all.

I suppose this means your user doesn't have any completion whatsoever installed for ssh, and it doesn't load dynamically either, so bash-completion is effectively disabled for it. Why it's so I don't know, but I'd start by looking into the user's ~/.bashrc and ~/.bash_profile to see if they contain anything unexpected, e.g. verifying that the former sources /etc/bashrc and the latter sources ~/.bashrc.

Comment 5 Ralf Oltmanns 2013-03-31 12:52:01 UTC
Your hint on .bashrc and .bash_profile was the right clue.
I had some misconfiguration in my .bashrc which caused the problem.
I fixed that and completion is working like a charm as it used to.

Sorry for the inconvenience caused.

Comment 6 Ville Skyttä 2013-03-31 15:17:06 UTC
NP, glad to hear you got it sorted out.


Note You need to log in before you can comment on or make changes to this bug.