Score:0

rbash can't use tab to completion path in ubuntu 20.4

lr flag

I created a user and set bash to rbash. On centos7.x, users can use tab to complete the path. It doesn't work on Ubuntu 20.04, is there any additional configuration required?

i use ansible playbook to create user:

---
- hosts: all 
  user: root
  gather_facts: true
  vars:
    limit_user: "programer"
  tasks:
    - name: "clean dir"
      file:
        state: absent
        path: '/home/{{ limit_user }}/.bin'
    - name: "create a directory if it doesn't exist"
      file:
        state: directory
        path: '/home/{{ limit_user }}/.bin'
        mode: 0755
        group: root
        owner: root
    - name: "create symbolic link for {{ limit_user }}"
      when: ansible_os_family == "RedHat"
      file:
        state: link
        src: '{{ item.src }}'
        dest: '{{ item.dest }}'
      with_items:
        - { src: '/bin/bash', dest: '/bin/rbash' }
        - { src: '/usr/bin/ls', dest: '/home/{{ limit_user }}/.bin/ls' }
        - { src: '/bin/cat', dest: '/home/{{ limit_user }}/.bin/cat' }
        - { src: '/bin/vi', dest: '/home/{{ limit_user }}/.bin/vi' }
        - { src: '/bin/tail', dest: '/home/{{ limit_user }}/.bin/tail' }
        - { src: '/bin/grep', dest: '/home/{{ limit_user }}/.bin/grep' }
        - { src: '/bin/top', dest: '/home/{{ limit_user }}/.bin/top' }
        - { src: '/usr/bin/su', dest: '/home/{{ limit_user }}/.bin/su' }
        - { src: '/usr/bin/more', dest: '/home/{{ limit_user }}/.bin/more' }
        - { src: '/usr/bin/less', dest: '/home/{{ limit_user }}/.bin/less' }
        - { src: '/usr/bin/zcat', dest: '/home/{{ limit_user }}/.bin/zcat' }
        - { src: '/usr/bin/ps', dest: '/home/{{ limit_user }}/.bin/ps' }
        - { src: '/usr/bin/curl', dest: '/home/{{ limit_user }}/.bin/curl' }
        - { src: '/usr/bin/stat', dest: '/home/{{ limit_user }}/.bin/stat' }
        - { src: '/usr/bin/md5sum', dest: '/home/{{ limit_user }}/.bin/md5sum' }
        - { src: '/usr/local/jdk/bin/jstack', dest: '/home/{{ limit_user }}/.bin/jstack' }
        - { src: '/usr/local/jdk/bin/jstat', dest: '/home/{{ limit_user }}/.bin/jstat' }
        - { src: '/usr/sbin/ifconfig', dest: '/home/{{ limit_user }}/.bin/ifconfig' }
    - name: "create symbolic link for {{ limit_user }}"
      when: ansible_os_family == "Debian"
      file:
        state: link
        src: '{{ item.src }}'
        dest: '{{ item.dest }}'
      with_items:
        - { src: '/bin/bash', dest: '/bin/rbash' }
        - { src: '/bin/su', dest: '/home/{{ limit_user }}/.bin/su' }
        - { src: '/bin/ls', dest: '/home/{{ limit_user }}/.bin/ls' }
        - { src: '/bin/cat', dest: '/home/{{ limit_user }}/.bin/cat' }
        - { src: '/bin/more', dest: '/home/{{ limit_user }}/.bin/more' }
        - { src: '/bin/less', dest: '/home/{{ limit_user }}/.bin/less' }
        - { src: '/usr/bin/vi', dest: '/home/{{ limit_user }}/.bin/vi' }
        - { src: '/usr/bin/tail', dest: '/home/{{ limit_user }}/.bin/tail' }
        - { src: '/bin/grep', dest: '/home/{{ limit_user }}/.bin/grep' }
        - { src: '/usr/bin/top', dest: '/home/{{ limit_user }}/.bin/top' }
        - { src: '/usr/bin/curl', dest: '/home/{{ limit_user }}/.bin/curl' }
        - { src: '/usr/bin/stat', dest: '/home/{{ limit_user }}/.bin/stat' }
        - { src: '/usr/bin/md5sum', dest: '/home/{{ limit_user }}/.bin/md5sum' }
        - { src: '/bin/zcat', dest: '/home/{{ limit_user }}/.bin/zcat' }
        - { src: '/bin/ps', dest: '/home/{{ limit_user }}/.bin/ps' }
        - { src: '/usr/local/jdk/bin/jstack', dest: '/home/{{ limit_user }}/.bin/jstack' }
        - { src: '/usr/local/jdk/bin/jstat', dest: '/home/{{ limit_user }}/.bin/jstat' }
        - { src: '/sbin/ifconfig', dest: '/home/{{ limit_user }}/.bin/ifconfig' }
    - name: 'copy .bash_profile to {{ limit_user }}'
      synchronize:
        src: '{{ item }}'
        dest: /home/{{ limit_user }}
      with_items:
          - /data/control/init_hosts/limit_user/.bash_profile
          - /data/control/init_hosts/limit_user/.bashrc
    - name: 'modify {{ limit_user }} shell'
      user:
        name: '{{ limit_user }}'
        shell: /bin/rbash

GIF for test tab: rbash can't use tab to completion path in ubuntu 20.4

hr flag
It appears to be sufficient to disable the *programmable* completion feature - see this (underappreciated) [so] answer: [Allow tab completion in rbash](https://stackoverflow.com/a/73777881/4440445)
An.Shen avatar
lr flag
I tried that and it doesn't work
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.