Help Center/ Bare Metal Server/ Private Image Creation Guide/ Linux/ Configuring Remote Login to a BMS/ x86: Oracle Linux 7.3/Oracle Linux 7.4/Red Hat 7/CentOS 7.2/CentOS 7.4/CentOS 7.5/CentOS 7.6
Updated on 2022-11-03 GMT+08:00

x86: Oracle Linux 7.3/Oracle Linux 7.4/Red Hat 7/CentOS 7.2/CentOS 7.4/CentOS 7.5/CentOS 7.6

This section uses the configuration files of CentOS 7.2 as an example. Configuration files of other types of OSs may be different.

  1. Use the vi editor to open the /etc/sysconfig/grub file and add consoleblank=600 console=tty0 console=ttyS0,115200n8 after the GRUB_CMDLINE_LINUX field.
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT=saved
    GRUB_DISABLE_SUBMENU=true
    GRUB_TERMINAL_OUTPUT="console"
    GRUB_CMDLINE_LINUX="crashkernel=512M rhgb quiet consoleblank=600 console=tty0 console=ttyS0,115200n8"
    GRUB_DISABLE_RECOVERY="true"
    ~
    ~
  2. Run the following commands to update the configuration:

    stty -F /dev/ttyS0 speed 115200

    grub2-mkconfig -o /boot/grub2/grub.cfg

    systemctl enable serial-getty@ttyS0

  3. To enable user root to log in to the BMS through a serial port, add ttyS0 to the end of the security configuration file /etc/securetty.
    vc/1
    ...
    vc/9
    vc/10
    vc/11
    tty1
    ...
    tty9
    tty10
    tty11
    ttyS0
    "securetty" 39L, 221C
    For CentOS 7, if garbled characters are displayed over the serial port, as shown in Figure 1, perform the following operations:
    Figure 1 Garbled characters during login

    a. Use the vi editor to open the /etc/default/grub file and add 115200 to the end of the GRUB_CMDLINE_LINUX field.

    b. Run the systemctl disable getty@ttyS0 and systemctl stop getty@ttyS0 commands to change the getty@ttyS0 service status as follows.

    c. Run the stty -F /dev/ttyS0 speed 115200 command to change the baud speed to 115200.

    d. Run the grub2-mkconfig -o /boot/grub2/grub.cfg command again. (The directory of the grub.cfg file is an example only.)

    e. Run the following command to check whether the baud speed is 115200:

    stty -F /dev/ttyS0 -a