NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot use fdisk Command to Format USB connected to CRIO-9063 Without Admin Account

Objective:  reformat USB drive to fat32 while it is plugged into a cRIO-9063.

 

Solution: Steps listed in this document are completed to successfully reformat the USB drive when it is plugged into a cRIO-9063. SSH is used to communicate with the cRIO-9063.  However, this can only be done when using the admin account.  Other accounts cannot use the "fdisk" command from the previous link, even if they have the admin privilege.  

 

Question:  Is there a way to reformat the USB drive to fat32 that does not require use of the admin account?  Using an admin account works, but it presents a greater security risk compared to using other accounts with the admin privilege. 

 

Note: Admin privileges are being assigned by using web services.

 

 

0 Kudos
Message 1 of 5
(3,146 Views)

Hi cblanchard,

 

NIAuth groups do not influence base OS-level permissions or privileges, only within NIAuth-enabled services.

 

An option would be to install and configure the sudo command to allow the lvuser (who is running the LV runtime engine on the RT target) to run the needed commands on the system to format an external USB device.

0 Kudos
Message 2 of 5
(3,101 Views)

Hi Brad,

 

Thank you for those details!  The steps that we previously discussed are below.  However, the computer is not connected to the internet so the sudo package could not be installed.  Is there a recommended method for transferring a package to a computer without internet access?

 

  1. Install the sudo package as admin with "opkg update && opkg install sudo", you will then configure the "sudoers" file to have restrictions using the following steps.
  2. Identify the device that you want to format: "lsblk -NAME,RM,FSTYPE,MOUNTPOINT"  
    1. > Check for RM=1, FSTYPE=vfat, and whether or not MOUNTPOINT is set, would be /media/sd[a-z][0-9]+
  1. If mounted, "umount /path/to/mountpoint"
  2. "mkfs.vfat -F32 /dev/sd[a-z][0-9]+", whatever was pulled from running "lsblk"
  3. *optional* Remount the new filesystem, "mount /dev/sd[a-z][0-9]+ /media/sd[a-z][0-9]+" (the media path should still exist from when the device was plugged in)

 

Thanks again!

0 Kudos
Message 3 of 5
(3,087 Views)

There are other instances of folks in the same situation on this forum, so it is documented. Basically, it comes down to downloading the packages from the feed from a computer that can access the internet and then sneakernetting the package to the controller, directing opkg to install the package by pointing it directly to the package. If the installation fails due to missing dependencies, repeat the above steps for the dependency (or dependencies).

0 Kudos
Message 4 of 5
(3,083 Views)

There are instructions for installing packages via opkg to Linux RT targets without internet access in the material from the NIWeek C/C++ on NI Linux Real-Time Hands-On session. Specifically, check out "Exercise 4: Interfacing with Existing Code (like OSS) on NI Linux Real-Time (No Internet Access)." starting on page 47 of the exercises PDF.

Message 5 of 5
(3,078 Views)