You are not logged in.
When I try to move a file off of my usb drive I get the following error:
mv: cannot remove ‘homework-1.txt’: Permission denied
The usb drive is mounted to a folder that I created as a normal user in my home directory. However, when I call ls -l on my home directory it says that the directory I'm using as a mount point is owned by root:
$ ls -l | grep mnt/
drwxr-xr-x 10 root root 4096 Dec 31 1969 mnt
When I unmount the flash drive, the ownership of the mount point changes back to me:
$ ls -l | grep mnt/
drwxr-xr-x 2 hugo hugo 4096 Feb 4 16:12 mnt
When I move the file I want as a super user it works but I don't get to retain ownership of the file anymore.
How can I make it so that when I mount the usb drive I have access to it as a normal user?
Last edited by Hurricane (2014-02-05 20:19:37)
Computers are extra dumb, which is why it takes extra smart people to make them work.
Offline
That is normal. For example, look at who owns /home, and the permissions for it.
What is the output of mount ? Is the device mounted read only? Is it an NTFS volume? Did you install NTFS-3g?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
How are you mounting it? If not ntfs, what filesystem is it using?
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
That is normal. For example, look at who owns /home, and the permissions for it.
What is the output of mount ? Is the device mounted read only? Is it an NTFS volume? Did you install NTFS-3g?
Mount gave me the following output:
$ mount
... (a bunch of other filesystem info) ...
/dev/sdb1 on /home/hugo/mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
I have ntfs-3g installed. The filesystem is vfat (I know it's a bit redundant because it's in the output above but just answering your question lmao).
How are you mounting it? If not ntfs, what filesystem is it using?
$ sudo mount /dev/sdb1 mnt/
Computers are extra dumb, which is why it takes extra smart people to make them work.
Offline
if you are using sudo, your user might not have write permissions on /mnt. You normally don't. So use sudo to mv files or mount the stick where your user has write permissions.
If you want your user to have write access, then why not use udevil -- which can also auto-mount usb sticks under /media and provide your user write access.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Look into uid and/or umask mount options ('man mount'), or use a user mount tool like Inxsible suggested.
Last edited by WorMzy (2014-02-04 23:03:16)
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
Seems to me that udev is giving ownership of the device to root and no write permission to world. Try adding something like:
SUBSYSTEM=="block" ID_BUS=="usb" GROUP="users" MODE=0660
to /etc/udev/rules.d/10-locale.rules
Read up on http://www.reactivated.net/writing_udev_rules.html
Offline
Seems to me that udev is giving ownership of the device to root and no write permission to world. Try adding something like:
SUBSYSTEM=="block" ID_BUS=="usb" GROUP="users" MODE=0660
to /etc/udev/rules.d/10-locale.rules
Read up on http://www.reactivated.net/writing_udev_rules.html
no, just no.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
fivedigits wrote:Seems to me that udev is giving ownership of the device to root and no write permission to world. Try adding something like:
SUBSYSTEM=="block" ID_BUS=="usb" GROUP="users" MODE=0660
to /etc/udev/rules.d/10-locale.rules
Read up on http://www.reactivated.net/writing_udev_rules.html
no, just no.
To expand on this... the rule changes permissions on all USB block devices (and will change permissions on some sysfs nodes as well), which is dangerous and doesn't accomplish what the OP wants -- to change permissions on the filesystem. You've also given the rule an irrelevant name (locale? wat?), and then point to an incredibly outdated resource (last updated nearly 6 years ago!!!) about udev rules. udev(7) is far more relevant and up to date. It doesn't mention outdated commands which no longer exist (udev$foo were all merged into udevadm).
Offline
if you are using sudo, your user might not have write permissions on /mnt. You normally don't. So use sudo to mv files or mount the stick where your user has write permissions.
The mount point's full name is ~/mnt. I have full permissions on it when the stick isn't mounted. It's only when I mount it.
As for using something to facilitate it, I'm perfectly fine with using sudo to move the files around but I will give udevil a try. I'm marking it as solved since I'm guessing if there's tools to implement the behavior I'm asking for it's because there's no way to really do it with mount itself.
Computers are extra dumb, which is why it takes extra smart people to make them work.
Offline
there's no way to really do it with mount itself.
Mount options for fat
(Note: fat is not a separate filesystem, but a common part of the msdos, umsdos and vfat filesystems.)
...
uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the current process.)
umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value
is given in octal.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online