Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a NTFS hard disk automounted on a computer running ubuntu 12.04 gui. That computer finds the drive just fine and accesses the files on it without problems. The file ownership is set to the admin userid and permissions are set as rw for the admin only. All my other computers, whether xp or linux also see the disk through the network and can access its files.
Now here's the problem. I need to access the files through my browser and have written a php routine that uses scandir for that purpose. The routine works fine for all my other networked disks except for the automounted one and I suspect it's a permissions issue because in cases where I added permanent disks to the network all I had to do was add +r to owner and +l to everyone for the routine to work. But I can't do that to the automounted disk no matter what, even when I log in as root. I also added a udev rule with KERNEL set to the automount drive, OWNER to the admin userid, GROUP to the admin group, and MODE to 0777, all to no effect.
So here's my question. How in the world can I set the permissions for this disk?
Unless this drive is sometimes connected to a Windows machine, you should rather use ext4 or some other unix like file system.
If you're auto-mounting at boot time, you should be able to specify permissions in /etc/fstab I think.
Alternatively, if the drive is being mounted after booting, can't you mount it manually?
All good points glue. Unfortunately this disk travels between two machines, one of them xp. Not that it matters because xp can read an ext4 disk but, and this is the unfortunate part, it's a 1tb disk loaded with some rather huge files. I guess I could move them elsewhere, convert the disk to ext4, and copy them back but there must be a way to modify permissions or else I'm overlooking something obvious. Besides I'm not all that sure that a different filesystem would help. As to your second point a filesystem can't be mounted twice. I've already tried unmounting it and remounting it but umount fails even with the -f switch. The only way to disconnect it is by killing the process that controls it which opens another can of worms, especially since I need access to the files remotely. It just seems the simplest way to solve this is to instruct the automount process to grant the proper permissions and I'm stumped.
The problem with ntfs is that it doesn't have Unix file permissions and ownership data. Thus, the ntfs-3g driver creates 'virtual' permissions and ownership during mounting. This usually works fine as long as only the person mounting the drive needs access to it, but it can cause issues when you need multiple users to have access to the drive.
The official Ubuntu documentation for /etc/fstab provides suggestions on how to set permissions on an auto-mounted ntfs volume. I hesitate to make any suggestions to interpret that information without being in a situation to test it myself though.
As I said, ntfs can be a pain to work with but it is also pretty much the only option for a large volume that needs to be readable from both Windows and Linux.
P.S: To the best of my knowledge, no Microsoft (tm) operating system can access ext2 type filesystems natively. There are, however, third-party software packages that can access ext2 from Windows.
Ok, so I modified fstab and changed type from fuseblk to ntfs-3g and options from:
user,blksize=4096,nosuid,default_permissions,allow_other,nodev,noauto
to:
rw,auto,user,fmask=0111,dmask=0000
I left filesystem, mount point, dump and pass the same. The result was no change. I can access the files through explorer or nautilus but not scandir and the file permissions have not changed and can't be changed with chmod. Files are all rw and folders drwx. I also tried setting umask, fmask, and dmask to 0000 but again no change. Owner and group are set to the admin account as before. I should also note that I added the apache user www-data to the admin group but with no effect. And here's the thing that mystifies me: I have no problem accessing the disk through ssh, explorer, nautilus or the samba share of my network server but not scandir which explicitly uses that same samba share.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.