Non-root user has read & write access to /mnt/usb with `root root` for ownership


I can mount an NTFS formatted USB storage device on my OpenWrt router with this command:

sudo mount /dev/sda1 /mnt/usb

The directory /mnt/usb and all its contents show root root for owner and group.

Yet I can SSH into the router as a non-root user, say bob, and have read and write access to /mnt/usb (can read, write, delete, rename, and edit any subdirectory or file in it). scp, sftp, and rsync all work with bob@router credentials. Also I can WinSCP (from a Windows machine) as bob to /mnt/usb and have the same access.

I used id bob to confirm that bob is not a member of the group root. bob is only a member of group bob and sudo.

How could I explain the above situation? Actually two parts to the question:

  • Is OpenWrt supposed to work like this?
  • If not, where can I look for an explanation (which setting)?

If I were to do the same thing in a Linux (e.g. Ubuntu machine), i.e. just use sudo mount /dev/sda1 /mnt/usb without bothering about further options (e.g. uid, gid), I would not get read and write access to it as bob. Thanks.

  • Can you explain how you created these other non-root accounts?
  • Group sudo - did you setup groups, etc?

On both user and group, I followed the instructions found here:

1 Like