i have a mobile hard disk, its file system is ext4. when i plugged into my machine, dolphin prompted me to mount , so i clicked to mount them.
but i found the mounted mobile hard disk is not writable.
if *MHD1 *partition is automatically changed to 777 after mounted, then the problem will get fixed. and i guess dolphin / KDE maybe have an internal or external mount policy which i can customize . but i don’t find it.
Well, you have it formatted as ext4 and owned by root. This filesystem uses **nix permissions which are respected. That can easily be changed if required though.
For comparison, I have a vfat partitioned storage device that mounts via udisks2/KDE, and so it mounts like this
ll /var/run/media/dean/
total 8
drwx------ 12 dean users 8192 Jan 1 1970 SP UFD U2
it seems that i can use polkit actions / rules to change owner and / or access privilege, but i am not familiar with polkit, i haven’t a clear solution yet.
is it possible that running chmod when an action is performed ?
but first of all, $MOUNT_POINT_ABS_PATH ( such as /run/media/bruce/MHD1 ) can be passed in by polkit .
<action id="org.freedesktop.udisks2.filesystem-mount-other-seat">
<description>Mount a filesystem from a device plugged into another seat</description>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/chown bruce:users $MOUNT_POINT_ABS_PATH</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
</defaults>
</action>
There is no difference between this mounted (Linux file system) partition and any other of the kind. This means that the ownership/permissions of the mountpoint do the same as ownership/permisions of any other directory. Same for all file/directories in the file system.
Thus when you post
drwxr-xr-x 3 root root 4096 Jul 23 13:54 MHD1
(which I assume is about the mount point, you never said or showed hat), it means that root kan search, read and write in the directory and that others can not write.
Thus, when you say it is “readonly” that probably is not true (you can show that with the mount command), but you probably tried to write somwhere inside the directory as end-uer and that failed of course. As root it has to be possible to write there (did you try?).
My advices would be:
read something about ownership by user and group and permission bits;
create an entry in /etc/fstab for the mount (e.g. through YaST), then you can decide yourself where the mountpoint should be;
first decide what the usage of the file system will be, for the system, for one of the users? Then you can plan mountpoint, ownership, etc. accordingly.
@hcvv thanks for your advice.
actually i know about file / directories’ ownership and access bits very much. i also know how to manually mount or automatically mount with /etc/fstab.
what i just wanna know is that whether it is possible to auto-mount removable hard disks within dolphin / krusader / system tray notification by a simple click which a newbie linux user can do.
after all, /etc/fstab usually fits for mounting fixed hard disks (contrast to removable hard disks).
i researched polkit and like @deano_ferrari already pointed out, polkit can decide who can mount , can not decide how to mount.
so finally my solution comes ( i know it not for newbie users):
nofail option ensures there will be no failure even if my removable hard disk doesn’t exist while booting system.
and then i have to manually change /mnt/sdb1 's ownership.
i don’t wanna format my hard disk to NTFS because ntfs-3g works in user mode and consumes too much CPU ( 40% when copying a 4G-size file ) , and ntfs is slower ( 30MB/s constrast to 60MB/s ) when copying a 4G-size file
there is a weird thing happens with this code snippet
if this hard disk is already plugged in before booting system, my system will automatically mount all these three partitions.
but when i plugin my removable hard disk after system already booted, my system will also automatically mount all these three partitions, and i bruce user can write !
and i do not enable automatic mounting of removable media http://i.imgur.com/yVFlGeI.png
You told the system to mount when present. What is so strange?? The system will use the fstab file if it has an entry for the partition(s). If you don’t want the partitions mounted don’t put them in the fstab
yes ,you are right.
if there is no explicit noauto option, this entry will be automatically mounted while booting . and if the hard disk does not exist, the boot sequence will be halted. and the entry will be automatically mounted after the disk is plugged in
some posts in stackoverflow said there is an option named nobootwait can fix boot sequence hanging , but this option doesn’t work in openSUSE 13.2.
Well, use noauto. That is normal when the disk is not always available at boot.
Do nnot use /dev/sdxn in your fstab entry/ies, but /dev/disk/by-id or other that identify the partitions without doubt.
And use user (or users) to allow any user to mount (or mount and unmount) it.
I do noy know if the desktop(s) will still show pop-ups when the device is connected. When not, create a mount and an unmount script for the user that can of course be started using some nice icons on his desktop.
On 2015-07-23 13:36, BruceAuyeung wrote:
>
> @hcvv thanks for your advice.
> actually i know about file / directories’ ownership and access bits
> very much. i also know how to manually mount or automatically mount
> with -/etc/fstab-.
> what i just wanna know is that whether it is possible to auto-mount
> removable hard disks within dolphin / krusader / system tray
> notification by a simple click which a newbie linux user can do.
The usual trick is to create directories in that “hard disk” with the
appropriate permissions and ownership, and not use the root directory of
that “disk”.
Notice that with automatic mounting, the mount point is volatile.