Switching to root user, doesn't add "root@" to the prompt

Bug #1995988 reported by Karla Felix
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Karla Felix

Bug Description

Brief Description

Switching to root user, doesn't add "root@" to the prompt.

Following commands gives output as

controller-1:~# whoami
root
controller-1:~# source /etc/platform/openrc
[root@controller-1 ~(keystone_admin)]#

Severity

<Minor: System/Feature is usable with minor issue>

Steps to Reproduce

Automation: testcases/wrcp/regression/security/test_root_access_denied.py::test_root_access_denied

Manual:

Login to the lab using sysadmin and change the user 'sudo su -'

Expected Behavior

As of 'Build Id: 2022-09-22_18-00-11' in CentOS:

[2022-09-23 21:11:44,398] 351 DEBUG MainThread ssh.send :: Send 'sudo su -'
[2022-09-23 21:11:44,582] 474 DEBUG MainThread ssh.expect :: Output:
]0;root@controller-1:~

Actual Behavior

controller-1:~$ sudo su -
Password:
controller-1:~#

Reproducibility

<Reproducible

System Configuration

Load info (eg: 2022-03-10_20-00-07)

 SW_VERSION="22.12"
BUILD_TARGET="Host Installer"

Timestamp/Logs

controller-1:~$ sudo su -
Password:
controller-1:~#

Alarms

NA

Test Activity

Regression Testing

Workaround

NA

Karla Felix (kkarolin)
Changed in starlingx:
assignee: nobody → Karla Felix (kkarolin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to config-files (master)
Changed in starlingx:
status: New → In Progress
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.8.0 stx.config stx.security
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config-files (master)

Reviewed: https://review.opendev.org/c/starlingx/config-files/+/864059
Committed: https://opendev.org/starlingx/config-files/commit/77c3958fcca414b5c7be386dcb25c13f4f784061
Submitter: "Zuul (22348)"
Branch: master

commit 77c3958fcca414b5c7be386dcb25c13f4f784061
Author: Karla Felix <email address hidden>
Date: Tue Nov 8 16:47:50 2022 -0300

    Changing login prompt to show root as user

    Switch to root user, wasn't adding "root@" to the prompt in
    case of "sudo su -", for "sudo su" it uses the configuration
    described in /etc/bash.bashrc, but for "sudo su -" it is
    replaced by the $SP1 described in /etc/profile.d/prompt.sh.
    To fix it was necessary to change the regex inside
    /etc/profile.d/prompt.sh to show the user before @.

    Test Plan:

    PASS: Generate new image and check with the changes were
          applied and working.

    Closes-Bug: 1995988
    Signed-off-by: Karla Felix <email address hidden>

    Change-Id: I0160c01ad2ffa99203abf11ca61e7d34faf740dd

Changed in starlingx:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to config-files (master)

Reviewed: https://review.opendev.org/c/starlingx/config-files/+/865324
Committed: https://opendev.org/starlingx/config-files/commit/b2f15301ee8e360a5d09a7a08995bdee3cd7c2ec
Submitter: "Zuul (22348)"
Branch: master

commit b2f15301ee8e360a5d09a7a08995bdee3cd7c2ec
Author: Karla Felix <email address hidden>
Date: Tue Nov 22 15:42:48 2022 -0300

    After upgrade subcloud linux prompt is different

    The regex in prompt.sh is incorrectly adding [] to around
    user@hostname. This commit removes those brackets in order
    to have the expected format.

    Test Plan:

    PASS: Enter "sudo su -" and verify if the prompt shows
                "root@controller-0:~$".
    PASS: Generate a new .iso with the changes and verify
          if when entering sudo with "sudo su -" it is showing
          "root@controller-0:~$".
    PASS: Install system and verify if prompt show
          "sysadmin@controller-0:~$ "

    Closes-Bug: 1997972
    Related-Bug: 1995988
    Signed-off-by: Karla Felix <email address hidden>
    Change-Id: Idfd3b03f2ce1eb9679e227c9406aaf200514977a

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.