• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

How do I view an NTFS partition as a non-root user?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

daga5831

Member
Joined
Feb 6, 2003
Location
Canada, eh? (BC)
Well, I just installed slackware 10.0, and since I'm starting from scratch again, I decided to stop running as root constantly, as I've heard that it's a potential security risk. (Side question: Is that true?)

Anyways, since I'll be running as a non-root user, I'd like to know if there's any way for me to access my mounted NTFS partition. I did a su and tried to chmod 555 the dir - it didn't seem to like that...Also, when I viewed my /mnt dir in konqueror, winfiles-c had the folder icon, but with a lock in the corner.

Any ideas?

Thanks in advance.
 

Christoph

JAPH Senior
Joined
Oct 8, 2001
Location
Redmond, WA
You can either put an entry in /etc/fstab with these options: user,noauto , or you can mount it with mount -t ntfs -o uid=UID /dev/whatever /mnt/point. UID is whatever number is in $UID (echo $UID) for the user you want to own the files. Note that if you edit /etc/fstab , you'll have to manually mount the partition. If you don't feel like doing that, you can just add the uid stuff to the options in /etc/fstab . If it's just you on your computer, this is the simplest route to take.

As for running as root, yes it's a security risk. In the case of home users, the problem is that you can really screw things up. EG one stray rm -rf * and you could delete something really important. *
If you're running an important server, a big potential problem is that any expliot that takes down a service inherits that service's priveleges. If cracked service is running as root, I hope you had a recent backup.


* A neat trick to prevent rm -rf * from killing everything is to do touch -- -i in any directories you're worried about. That way when you do rm -rf * , -i will be the first thing passed to rm and rm will interpert it the option specifying that you want to confirm any deletions.
There are many other stupid things you could do as root. This is just a trick to prevent one of them and shouldn't be viewed as foolproof.
 

MisterEd

Member
Joined
May 10, 2004
Location
Alabama
The following is an example of a fstab entry that will give read-only access to everyone:
/dev/hda1 /mnt/windows ntfs defaults,umask=0222 0 0
 
OP
daga5831

daga5831

Member
Joined
Feb 6, 2003
Location
Canada, eh? (BC)
Christoph said:
As for running as root, yes it's a security risk. In the case of home users, the problem is that you can really screw things up. EG one stray rm -rf * and you could delete something really important.

I accidentally deleted /usr which is why I "decided" to upgrade to slackware 10.0.

And as for:
MisterEd said:
/dev/hda1 /mnt/windows ntfs defaults,umask=0222 0 0

THANK YOU! Every "solution" I found on google didn't work - but yours did! YAY! :clap:
 

MisterEd

Member
Joined
May 10, 2004
Location
Alabama
daga5831 said:
THANK YOU! Every "solution" I found on google didn't work - but yours did! YAY! :clap:
In case you wonder why this works: umask=0222
umask kind of works in reverse of normal permissions. To get the permissions take the negative of umask:
2 octal = 010 binary
negative (2 octal) = negative (010 binary) = 101 binary = 5 octal

Therefore the permissions are 555
Each digit represents a permission for a different level of user: uga
u = user (you)
g = group
a = everyone
For example the permissions for group is 5 octal = 101 binary

Each binary bit of this represents a different permission: rwx
r = read
w = write
x = execute

The permissions for the disk are then:
r = 1
w = 0
x = 1
The same permissions are set for the user (you), the group, and everyone else. This means that everyone can read and execute files on the disk but writing is not allowed.