LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-05-2015, 08:36 AM   #1
samhill5215
Member
 
Registered: Apr 2011
Posts: 46

Rep: Reputation: 1
automount drive security


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?
 
Old 01-06-2015, 04:07 AM   #2
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
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?
 
Old 01-07-2015, 04:12 AM   #3
samhill5215
Member
 
Registered: Apr 2011
Posts: 46

Original Poster
Rep: Reputation: 1
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.
 
Old 01-07-2015, 05:59 AM   #4
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
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.
 
Old 01-08-2015, 05:53 AM   #5
samhill5215
Member
 
Registered: Apr 2011
Posts: 46

Original Poster
Rep: Reputation: 1
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoMount any/all USB drives READ-ONLY for security (RHEL5) proximous Linux - Security 1 03-24-2011 10:04 AM
Only root can automount CD drive and USB thumb drive km4hr Red Hat 3 03-25-2009 12:30 PM
Enable automount after installing Solaris Security Toolkit? snippy Solaris / OpenSolaris 4 01-14-2009 02:04 PM
Drive automount Bordeaux Fedora 0 08-06-2006 03:39 AM
NFS - Automount / Security Issues gene_gEnie Linux - Networking 0 02-08-2002 03:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration