I have just installed and setup vsftpd in standalone mode, with users but chroot’d by default with the exception of my own account.
I would like to share my external drive over the FTP server, which is a USB drive mounted in /media/external, with owner being my main account and group owner being users.
However it won’t allow any other user to navigate to this folder. They can’t navigate to it using ssh either, with a permission denied message. I tried creating a new group called sharing and then running the following command to change the group ownership. The edit time code did update though
chgrp sharing /media/external
but it seems to have no effect with the user group still staying as user. I’m running the command as root but have tried as the file owners account too. Chown doesn’t seem to work either.
I would also like to know how I can then create a link in another users home directory to allow then access to this external drive.
Which is what I thought too but running any permission change, (e.g. chown, chmod, chgrp) doesn’t produce an error but doesn’t have an effect on the permission other than to change the edited timestamp.
I have tried making the changes under both the owner account, and root. Same result.
Yes, we ar of course allways supposing you use native Linux file systems, unless you tell us otherwise.
And please prove with computer evidence what you say. Thus when you say a chmod does not do anything, show us the whole session with the commands* ls -l,* chmod g+rwx and *ls -l *again.
As /media/external is the mount-point for your external disk which is I’m guessing formatted as fat or ntfs you will need to set the ownership and permissions when you mount the disk.
If you were mounting the disk manually you would control this via the command line (mounting the device with the options gid=xxx,umask=007) or via an entry in /etc/fstab where the options would be placed in the fourth field
I’m going to assume however that you’re allowing the disk to be mounted automatically via the system. This uses udev so you will need to ensure udev mounts the device using the options ENV{mount_options}="$env{mount_options},dmask=007,fmask=117,gid=xxx"
You’ll be able to find the group id for your new group using:
cat /etc/group | grep -i sharing | cut -f 3 -d :
from a console prompt - for for the group “users” rather than “sharing” this would usually be 100
I’ll try and test a couple of local rules tomorrow and post some samples for you:
A point to note is that USB disks in performance terms aren’t great -In my experience, if you’re using the ftp server in a “LAN” environment and pulling large files you may get timeouts which usually cause the mount point to get dropped. I’ve certainly found trying to transfer any more than 1 high quality video file at a time via vsftpd on a Gigabit network difficult. Limiting to a single transfer is OK but not much use when you have lots of users…
A little more research shows this is more complicated!
it appears auto-mounting is now achieved via udisks and the default permissions are hard-coded so the only way to change them is to edit the source code and recompile - ugh!
However you can manually remount the disk with the correct options
My usb stick is mounted it’s uuid as it has no label so appears at /media/7CCF-F043
to remount with the required perms I run the following:
If that works you could create a script to do this for you
vi ~/bin/remountusb.sh
i
#!/bin/bash
udisks --unmount /dev/disk/by-label/external
udisks --mount-options “dmask=007,fmask=117” --mount /dev/disk/by-label/external
:wq
chmod u+x ~/bin/remountusb.sh
running remountusb.sh from the command line would then be easier
Hope that helps & very sorry it seams complicated - sometimes new features are oversimplified, I’m sure someone has put in a feature request to allow “udisks” permissions to be configurable. If not perhaps you’d like to ask?
In it, you’ll not only find an entire section that applies only to USB devices, you might also find interesting that apparently the properties and attributes of the auto-mounted device is based on discovery of the type of device and seems to be defined in a “wrapper” and generally speaking that wrapper can be customized.
audiocomp’s solution looks promising in that it does change the permissions, problem is that it sets drive owner and group to the current, which has to be root cause any other account gets a Authorization Required message.
I tried adding gid=1000,uid=1000 into the command making it;
but that just gets an error that gid and uid are not supported mount options, which I always thought they were.
tsu2’s solutions looks promising by creating a custom wrapper, and I have had some mixed results playing around with it. Gonna take some more research on how it works before I can make it work properly though.
Eventually I gave up trying to sort this and dealing with udisks stupid hard-coded design and simply removed udisks which can be done with
zypper rm udisks
I can then mount the drive with whatever permissions I want in fstab. There doesn’t seem to be any adverse effects to removing udisks, other than having to resort to the old system for mounting usb, but I don’t count that as adverse. If I come across any though I’ll be sure to post back.
> I can then mount the drive with whatever permissions I want in fstab.
> There doesn’t seem to be any adverse effects to removing udisks, other
> than having to resort to the old system for mounting usb, but I don’t
> count that as adverse. If I come across any though I’ll be sure to post
> back.
I find automatic mounting of usb drives useful, but I also use manual
mounting via fstab. At least in gnome, when an external drive is defined in
fstab, gnome does not mount it automatically, the fstab entries are
respected. So I get the best of those worlds.
I think that does not happens with kde, but haven’t verified it myself.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)
That’s interesting cause I have a friend running 11.4 who says he always just uses fstab, and has never had to use udisks in any form however when I tried just adding a line in fstab to override udisks it didn’t seem to make a difference to the mount, and the mount ended up with the same permissions udisks was always assigning it.
The line I was using, and currently am using, in fstab is;
Like Carlos, my idea is that an fstab entry overrules any “automatic” mounting. It did so allready with HAL and AFAIK this is still the case and Carlos (and several others) confirms this. Also the same is true in KDE as it is IMHO desktop independent.
And about your fstab entry: many problems on many threads about permissions using ntfs (being a non-Linux file system that must mimic permissions in one way or the other) were solved by using the single option defaults instead of the long range you have. Just a suggestion.
On 2011-10-07 11:26, hcvv wrote:
>
> Hm, strange.
>
> Like Carlos, my idea is that an -fstab- entry overrules any “automatic”
> mounting. It did so allready with HAL and AFAIK this is still the case
> and Carlos (and several others) confirms this. Also the same is true in
> KDE as it is IMHO desktop independent.
I read at least of one person for which it doesn’t work in KDE. I have not
investigated it.
> And about your -fstab- entry: many problems on many threads about
> permissions using ntfs (being a non-Linux file system that must mimic
> permissions in one way or the other) were solved by using the single
> option -defaults- instead of the long range you have. Just a suggestion.
It is also solved by using the proper options
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)
On 2011-10-07 14:36, hcvv wrote:
>
>> It is also solved by using the proper options
> Of course. According to the -man- page -defaults- means
>> Use default options: rw, suid, dev, exec, auto, nouser, and async…
I just change the options that YaST uses with fmask=0117,dmask=0007, and it
works.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)