Personal tools

Connecting to Linux console

From SomLabs Wiki

Revision as of 08:25, 8 June 2020 by KrzysztofChojnowski (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Connecting to Linux console


Linux host PC

Prerequisites

  • PC with Ubuntu 16.04 operating system and USB port (for USB-UART converter connection) or local network connection (for SSH connection)
  • VisionCB-STD board with VisionSOM-6ULL and Linux image installed
  • Micro-USB cable

Connecting to Linux console through UART-USB converter

VisionCB-STD has built-in UART-USB converter, it lets you connect to the console via virtual COM port. First of all you need to determine what is the VisionCB-STD virtual COM number on your Linux system. To do that connect VisionCB-STD board to your PC with micro-USB cable and list your terminal devices:

ls /dev/ttyUSB*
/dev/ttyUSB0

If there is only one device then it is the terminal you are looking for (/dev/ttyUSB0 in the example above), if there are more /dev/ttyUSB* terminal then disconnect and reconnect your board to find proper one.

Now install minicom:

sudo apt install minicom

Start minicom:

sudo minicom -b 115200 -D /dev/ttyUSB0 -s

Enter Serial port setup, press F to disable hardware flow control, press Enter, choose Exit, now you can log in as root (password root) or som (password som). It is strongly recommended to change the default passwords of existing users. To do that enter passwd <user_name> command, you will be prompted to enter password twice:

root@somlabs:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@somlabs:~#

To exit minicom press Ctrl+A, Z, X, then confirm by pressing Enter.

Connecting to Linux console via SSH client

Connecting as root - not recommended

Login to the UART-USB console as described in the previous section and change the root password. Once you have changed it (still via UART-USB connection) you need to modify /etc/ssh/sshd_config file:

nano /etc/ssh/sshd_config

Add line:

PermitRootLogin yes

Restart SSH service:

service sshd restart

Now you can log in as root via SSH, you only need IP address of VisionSOM-6ULL. Enter ip a for list of all network interfaces and their IP addresses:

root@somlabs:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether a6:e3:1c:a0:3d:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.25/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:a310:813c:d700:a4e3:1cff:fea0:3db0/64 scope global mngtmpaddr dynamic
       valid_lft 974055sec preferred_lft 369255sec
    inet6 fe80::a4e3:1cff:fea0:3db0/64 scope link
       valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default
    link/sit 0.0.0.0 brd 0.0.0.0

In this case the IP address of the Ethernet (eth0) interface is 192.168.0.25. Now you can connect to VisionSOM-6ULL with SSH client from your Linux host PC:

ssh root@192.168.0.25

Connecting as regular user

To connect as a regular user you need to create new account or use existing one. In the first case login as root through USB-UART converter or SSH, and add a new account and set password:

root@somlabs:~# useradd tom
root@somlabs:~# passwd tom
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@somlabs:~#

By default new user has no home directory and his shell is /bin/sh. To create home directory enter:

root@somlabs:~# mkdir /home/tom

To change shell to bash enter:

root@somlabs:~# chsh -s /bin/bash tom


Now you can log in as tom with SSH client.

Windows host PC

Prerequisites

  • PC with Windows operating system and USB port (for USB-UART converter connection) or local network connection (for SSH connection)
  • VisionCB-STD board with VisionSOM-6ULL and Linux image installed
  • Micro-USB cable
  • PuTTY terminal

Connecting to Linux console through UART-USB converter

VisionCB-STD has built-in UART-USB converter, it lets you connect to Linux console via virtual COM port. First of all you need to determine what is the VisionCB-STD virtual COM number on your Windows system, to do that open Control Panel, connect VisionCB-STD to your computer, find Ports (COM & LPT) and expand it. You should see USB Serial Port (COM<port_number>), if there is only one item with this name then it is your port, if there are more ports then disconnect and reconnect VisionCB-STD to check which port shows up. Now we can connect with PuTTY to your VisionSOM-6ULL, connect VisionCB-STD to your PC, run PuTTY and:

  • Select Serial in Connection type section
  • Enter VisionCB-STD port number in Serial line field
  • Enter 115200 in Speed field
  • Click Open

Now you can log in using one of existing user names. It is strongly recommended to change the default passwords of existing users. To do that enter passwd <user_name> command, you will be prompted to enter password twice:

root@somlabs:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@somlabs:~#

Connecting to Linux console via SSH client

Connecting as root - not recommended

Login to the UART-USB console as described in the previous section and change the root password. Once you have changed it (still via UART-USB connection) you need to modify /etc/ssh/sshd_config file:

nano /etc/ssh/sshd_config

Add line:

PermitRootLogin yes

Restart SSH service:

service sshd restart

Now you can log in as root via SSH, you only need IP address of VisionSOM-6ULL. Enter ip a for list of all network interfaces and their IP addresses:

root@somlabs:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether a6:e3:1c:a0:3d:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.25/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a02:a310:813c:d700:a4e3:1cff:fea0:3db0/64 scope global mngtmpaddr dynamic
       valid_lft 974055sec preferred_lft 369255sec
    inet6 fe80::a4e3:1cff:fea0:3db0/64 scope link
       valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default
    link/sit 0.0.0.0 brd 0.0.0.0

In this case the IP address of the Ethernet (eth0) interface is 192.168.0.25. Now you can connect to VisionSOM-6ULL with SSH client from your Windows host PC:

  • Start PuTTY
  • Enter VisionSOM-6ULL IP address in Host Name field
  • Click Open button
PuTTY connection window
PuTTY connection window

Connecting as regular user

To connect as a regular user you need to create new account or use existing one. In the first case login as root through USB-UART converter or SSH, and add a new account and set password:

root@somlabs:~# useradd tom
root@somlabs:~# passwd tom
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@somlabs:~#

By default new user has no home directory and his shell is /bin/sh. To create home directory enter:

root@somlabs:~# mkdir /home/tom

To change shell to bash enter:

root@somlabs:~# chsh -s /bin/bash tom


Now you can log in as tom with SSH client.