LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-25-2007, 02:22 PM   #1
r00tb33r
Member
 
Registered: Feb 2007
Distribution: Vector
Posts: 318

Rep: Reputation: 31
mounting windows partition as non-root


Its really advised against sitting in X as root all the time.
That is why I moved over all my stuff and settings to a regular account...
But how do I mount my NTFS patition under a non-root user to let all my programs on this account be able to access stuff there...?
This is what I get:

rootbeer:$ mount /dev/hda1 /windows
mount: only root can do that

Under root it works fine.
And running programs under root is not really an option either.
Is there a way?
I tried to chown -R the sucker but it doesn't work.
The reason I cant change owner or permissions is because even if I mount it as read and write, NTFS still stays read-only. So new settings cannot be applied. So the only way here would be mount it as the user its meant for.

Last edited by r00tb33r; 02-25-2007 at 02:31 PM.
 
Old 02-25-2007, 02:30 PM   #2
soldier228
Member
 
Registered: Jan 2007
Distribution: openSUSE 10.2
Posts: 103

Rep: Reputation: 15
su
enter password

root #

then run the normal mount command.
 
Old 02-25-2007, 02:34 PM   #3
r00tb33r
Member
 
Registered: Feb 2007
Distribution: Vector
Posts: 318

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by soldier228
su
enter password

root #

then run the normal mount command.
PFFT!!!
ARE YOU READING?
I can mount as root allright. Read-only filesystems can only be accessed by root if they are mounted by root.
I have no issues sudo-ing stuff. You totally missed the point.
***
I think I found where it goes into fstab.
I need help with fstab syntax now.

Last edited by r00tb33r; 02-25-2007 at 02:37 PM.
 
Old 02-25-2007, 02:43 PM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
The reason I cant change owner or permissions is because even if I mount it as read and write, NTFS still stays read-only.
True, with the native NTFS driver you can mount NTFS partitions read-only, not read-write. There are projects like Captive that provide a read-write access to NTFS partitions (don't know about Vista partitions, though), but last time I checked they weren't reliable enough. Better either use FAT drive to move files between Windows and Linux or just stick to read-only NTFS, before the NTFS read-write-driver projects evolve more.

To be able to mount partitions as root you'll probably need to add the desired user to the group mount and probably add the desired mount entry to your /etc/fstab file with appropriate options; this way your user(s) can mount the partition when needed, or automatically during boot, without having to become root. Using su to become root to mount the partition, as suggested in the previous post, is not good in the long run or for multiple users, because in that case you'll need to use the root account password, which means either giving it to regular users or make other users than the root user (who's using a regular account in this case) unable to mount anything. A better way to use root permissions to do the job would be to grant specified users permissions to use sudo which enables them to run commands as root (without root password; they'll use their own passwords instead); the good side in this is that the use can be restricted to only the mount command, or even to mount only a specified partition. If you want to use sudo, you must add the users to the sudo group (or 'sudoers', can't remember which one) and then alter /etc/sudoers to grant the permissions. I'd probably configure /etc/fstab myself and add the users to a group that lets them do the mounting without any root stuff, sudo or su, or if you like, configure sudo.

Additionally I recommend you to make friends with sudo command. It is a powerful way to let regular users do stuff that needs root privileges, without giving root password to anyone, restricting the usage to the needed commands only. I'm pretty sure there are always regular users that need to do tasks that need superuser permissions, and using su is not as good an idea as sudo is -- root password is only one reason. sudo also means that you won't be opening a login for root, if the program (that sudo runs) ends, sudo ends too and the user's permissions are back to normal. If you use su instead, you might end up in a situation where root login is left open, which isn't good idea. To stay secure, first step is to try and keep root logins at minimum -- only use root account when it's really needed, not just to "make things easier". Better spend a little time with configuring the system to be easy-to-use without root permissions hazzle than use su and root logins all the time.

EDIT: fstab syntax:
Code:
man fstab
That should explain enough, along with the lines that already exist in fstab. If you're unsure about the last two numbers in the line, leave them to zero; it's got to do with file system checking.

Last edited by b0uncer; 02-25-2007 at 02:45 PM.
 
Old 02-25-2007, 02:45 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
In /etc/fstab, add 'user' to the device or partition mount parameters.

http://www.linuxvoodoo.com/resources.../mounting2.php
 
Old 02-25-2007, 02:46 PM   #6
r00tb33r
Member
 
Registered: Feb 2007
Distribution: Vector
Posts: 318

Original Poster
Rep: Reputation: 31
Added this line to fstab:

/dev/hda1 /mnt/win ntfs umask=0,user 0 0

Looks like I am done.
Thanks everyone.
 
  


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
GRUB won't load windows partition - root (hd0,0), Filesystem type unknown partition.. cillm527 Linux - Software 4 04-27-2008 06:44 AM
mounting windows partition diablo_06 Linux - General 6 07-04-2006 05:28 AM
Mounting ext3 partition with rw permissions for non-root user ilyushin Linux - Newbie 5 06-27-2005 07:58 AM
root partition mounting error dc_cid Linux - Newbie 1 09-15-2004 07:45 AM
mounting a windows partition? codename000 Linux - Newbie 1 04-15-2003 09:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:13 PM.

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