How can I remove the USB device without Password?

I will be asked for a password when I remove the USB-connected SSD storage device (see screenshot).
I don’t want to ask for my password, what is the method?

Thanks in advance.

[Environment]

  • Jetson AGX
  • JetPack 4.4.1

Sorry for the late response, is this still an issue? Thanks

Yes, Not solved yet.

I am curious, if you run command “lsblk -f” while the USB device is mounted, what do you see?

Thank you for your response.

The output of “lsblk -f” is following:

NAME FSTYPE LABEL UUID MOUNTPOINT
loop0 vfat L4T-README 6536-E270
sda
└─sda1 ntfs SSD-PUTA 9A7ADCC37ADC9D77 /media/9A7ADCC37ADC9D77
mmcblk0
├─mmcblk0p1 ext4 48057ae3-822b-45e4-9d94-54c662295444 /
├─mmcblk0p2
├─mmcblk0p3
├─mmcblk0p4
├─mmcblk0p5
├─mmcblk0p6
├─mmcblk0p7
├─mmcblk0p8
├─mmcblk0p9
├─mmcblk0p10
├─mmcblk0p11
├─mmcblk0p12
├─mmcblk0p13
├─mmcblk0p14
├─mmcblk0p15
├─mmcblk0p16
├─mmcblk0p17
├─mmcblk0p18
├─mmcblk0p19
├─mmcblk0p20
├─mmcblk0p21
├─mmcblk0p22
├─mmcblk0p23
├─mmcblk0p24
├─mmcblk0p25
├─mmcblk0p26
├─mmcblk0p27
├─mmcblk0p28
├─mmcblk0p29
├─mmcblk0p30
├─mmcblk0p31
├─mmcblk0p32
├─mmcblk0p33
├─mmcblk0p34
├─mmcblk0p35
├─mmcblk0p36
├─mmcblk0p37
├─mmcblk0p38
├─mmcblk0p39
├─mmcblk0p40
├─mmcblk0p41
└─mmcblk0p42
mmcblk0boot0
mmcblk0boot1
mmcblk0rpmb
zram0 [SWAP]
zram1 [SWAP]
zram2 [SWAP]
zram3 [SWAP]
zram4 [SWAP]
zram5 [SWAP]
zram6 [SWAP]
zram7 [SWAP]
nvme0n1 ext4 xavierssd1t 88b56173-1d8c-44e1-8618-c2f5f32f90e2 /mnt/ssd

Is the mount of interest at “/media/9A7ADCC37ADC9D77”? I also see a mount of “/mnt/ssd”, so I’m wondering which one is of interest to you (I wouldn’t want to remove the wrong disk).

Interesting device is:
sda1 ntfs SSD-PUTA 9A7ADCC37ADC9D77 /media/9A7ADCC37ADC9D77

Thansk for advance.

When this device is mounted, what do you see for this command:
ls -ld /media/9A7ADCC37ADC9D77

What user are you running as at the time you wish to umount? E.g., you can type “whoami” if there is any question about your user credentials.

The results are as follows:

ls -ld /media/9A7ADCC37ADC9D77 [Enter]
drwxrwxrwx 1 root root 32768 12月 3 16:23 /media/9A7ADCC37ADC9D77

whoami [Enter]
sanyu

This was mounted as user root, and thus only root can umount it. Basically this is the behavior of all Linux distributions. You would have to arrange to mount this as a non-root user on a partition owned by the user who will perform the umount. I’m not even sure if this would be enough since umount itself might not like the operation, but this is perhaps possible (and easy to test).

Keep in mind that if anything is using that partition at the time of umount, then no user can umount…the partition would be “busy”, and refuse umount even for root, but I’ll give you a test to perform to see if a non-root user can do this (and there will be more to test even if this fails, but let’s try this first):

# Logged in as a regular user at the moment, not as root...
sudo umount /media/9A7ADCC37ADC9D77
mkdir ~/tmp_mount
mount /dev/sda1 ~/tmp_mount
ls ~/tmp_mount
umount ~/tmp_mount

Does that succeed? What this does is create a mount point owned by the regular user, and then attempts to mount it there as that regular user. The only “sudo” was to umount the original mount point.

I would like to use Removable USB device without password.
The command “sudo umount /media/9A7ADCC37ADC9D77” may be asked password.

By the way, this phenomenon(asked password when removing USB device) does NOT occur in another Jetson in JetPack 4.5.
The both owner and group of /media/9A7ADCC37ADC9D77 are “sanyu” in JetPack4.5.
I think that is why remove this USB device without password.

Is it related to the JetPack version? Or is it a configuration issue?

What I’m asking is for gathering information…yes, it will ask for a password to umount. My question is if the partition is currently not mounted, and you do not use sudo, then can your regular user “sanyu” mount at a mount point owned by “sanyu”? The trick here is that the partition is being auto-mounted, as root, and if a manual test works, then we can disable auto-mount (at least as root) and get around root ownership of the mount point. Then you would be able to umount without a password (at least I hope so, but I don’t know yet if the unmounted partition can be mounted without sudo).

Incidentally, this is the behavior of most of Linux. It isn’t specific to Ubuntu, nor to Jetsons.

Please see screen shot when commands executed.
I got an error message stating that “only root can do this”.

You wrote:
Incidentally, this is the behavior of most of Linux. It isn’t specific to Ubuntu, nor to Jetsons.

I can not understand why another Jetson machine is no problem.

Thanks in advance.

Sorry, I don’t know what the reply is in the screenshot (sadly, I only speak English). Can you translate the result of the “mount” command when performed without “sudo”?

Translating is as follows:

$mount /dev/sda1 ~/tmp_mount
mount:only root can do this

Thanks in advance.

Note: Same basic procedure regardless of whether it is a USB device which is not an SD card, or if it is an SD card over USB.

So it would require setting up “non-superuser mounts” (a quote from the actual mount man page). I’ll quote the man page section:

   Non-superuser mounts
       Normally, only the superuser can mount filesystems.  However, when fstab contains the user option on a line, anybody can mount the corresponding filesystem.

       Thus, given a line

              /dev/cdrom  /cd  iso9660  ro,user,noauto,unhide

       any user can mount the iso9660 filesystem found on an inserted CDROM using the command:
              mount /cd

       Note that mount is very strict about non-root users and all paths specified on command line are verified before fstab is parsed or a helper program is executed. It's strongly recommended to use a valid mountpoint to  spec‐
       ify filesystem, otherwise mount may fail. For example it's bad idea to use NFS or CIFS source on command line.

       For  more  details,  see fstab(5).  Only the user that mounted a filesystem can unmount it again.  If any user should be able to unmount it, then use users instead of user in the fstab line.  The owner option is similar to
       the user option, with the restriction that the user must be the owner of the special file.  This may be useful e.g. for /dev/fd if a login script makes the console user owner of this device.  The group option  is  similar,
       with the restriction that the user must be member of the group of the special file.

This is actually fairly simple. Basically, you’d create a mount specification in “/etc/fstab”, and change to include option “user”. However, you want the fstab entry to be valid since it could interfere with system boot. Can we limit this to a single specific USB device? Making this work with an exact partition UID is easier than setting it up for all USB mass storage.

If this is for just a single SD card partition, then when that card is plugged in, what do you see from “lsblk -f” (I’d need translation if it has any messages other than the IDs and filesystem types).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.