LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mounting NTFS-partitions and getting readingrights for users. (https://www.linuxquestions.org/questions/linux-newbie-8/mounting-ntfs-partitions-and-getting-readingrights-for-users-106866/)

Festiz 10-21-2003 04:54 PM

Mounting NTFS-partitions and getting readingrights for users.
 
Hi guys an gals.
I have a little problem with my ntfs-disks. When I try to mount it as my ordinary user (festiz) , it complains about me not beeing root. Although my /etc/fstab looks like this:

Code:

/dev/hda3        /mnt/c                ntfs            users,noauto    0  0
/dev/hdb1      /mnt/h                ntfs        users,noauto    0  0
/dev/hdd1      /mnt/d          ntfs        users,noauto    0  0
/dev/hde1      /mnt/g          ntfs        users,noauto    0  0
/dev/hdf1      /mnt/i          ntfs        users,noauto    0  0

Now when I try running my little nice mounting script it says - You have to be root to do that.
My Script:

Code:

#/bin/bash
mount -t ntfs /dev/hda3 /mnt/c
mount -t ntfs /dev/hdb1 /mnt/h
mount -t ntfs /dev/hdd1 /mnt/d
mount -t ntfs /dev/hde1 /mnt/g
mount -t ntfs /dev/hdf1 /mnt/i

I'd be very happy for all help I could get.
btw. I'm sitting on a slackware 9.0 installation.

kc8tbe 10-21-2003 05:20 PM

You could use sudo, although I've been having a little trouble getting sudo to work myself.

http://www.peakpeak.com/~jallen/howtos/sudo-howto.html

Festiz 10-22-2003 06:19 AM

When I try to run my script modified for sudo this happens:
Code:

bash-2.05b$ /./montera
Password:
Sorry, user festiz is not allowed to execute '/bin/mount -t ntfs /dev/hda3 /mnt/c' as root on festiz.

The Script now looks like this:
Code:

#/bin/bash
sudo mount -t ntfs /dev/hda3 /mnt/c && mount -t ntfs /dev/hdb1 /mnt/h && mount -t ntfs /dev/hdd1 /mnt/d && mount -t ntfs /dev/hde1 /mnt/g && mount -t ntfs /dev/hdf1 /mnt/i

And my /etc/sudoers look like this:
Code:

# sudoers file.
....
root    ALL=(ALL) ALL
 %users  ALL=/bin/mount /dev/hda3 ,/bin/umount

I also tested with the sudoers like this:
Code:

# sudoers file.
....
root    ALL=(ALL) ALL
 %users  ALL=/bin/mount ,/bin/umount

But then it just said - u have to be root to run mount

JZL240I-U 10-22-2003 08:39 AM

Long shot:

you didn't specify read only in your /etc/fstab like
/dev/hda3 /mnt/c ntfs ro,users,noauto 0 0

Same in mount. Now, usually the kernel supports only reading, not writing to ntfs. Maybe your distro is crying foul? ;)

Also, after reboot and those lines in fstab there should be no reason to mount the partitions, since they are already mounted and you'd get an error.

Does sudo work from scripts? How is it passed the password?

Festiz 10-22-2003 05:29 PM

Quote:

Originally posted by JZL240I-U
Long shot:

you didn't specify read only in your /etc/fstab like
/dev/hda3 /mnt/c ntfs ro,users,noauto 0 0

Same in mount. Now, usually the kernel supports only reading, not writing to ntfs. Maybe your distro is crying foul? ;)

Also, after reboot and those lines in fstab there should be no reason to mount the partitions, since they are already mounted and you'd get an error.

Does sudo work from scripts? How is it passed the password?

Well since it says noauto in fstab it doesnt mount it automatically
The Password I have to put in manually. As it is now the discs get mounted when I log in with my festizuser from my .bash_profile.
I'd like them to automatically be mounted without me doing anything. But how do I do this? if I just let fstab do it it get rootrights.. If i place my script to be run from rc.local it still is root that runs the script and mounts. what preferences can I use so that ANY user can access the mounted partitions? If i need to specify the userid or groupid in fstab and thats the only way - how do I find these out without installing webmin?

megaspaz 10-22-2003 05:32 PM

Quote:

Originally posted by Festiz
Well since it says noauto in fstab it doesnt mount it automatically
The Password I have to put in manually. As it is now the discs get mounted when I log in with my festizuser from my .bash_profile.
I'd like them to automatically be mounted without me doing anything. But how do I do this? if I just let fstab do it it get rootrights.. If i place my script to be run from rc.local it still is root that runs the script and mounts. what preferences can I use so that ANY user can access the mounted partitions? If i need to specify the userid or groupid in fstab and thats the only way - how do I find these out without installing webmin?

change noauto to auto then they will be mounted when you boot up. and since you have listings in fstab you don't need to do mount with any flags. su into root and issue this command:

mount /dev/hda3
mount /dev/hdb1
etc...

Festiz 10-22-2003 05:54 PM

Well that doesnt give me the right rights now does it? It is still only root who can read it!! are you guys not reading my message clear enough?

I Want my nonsuperuserusers to be able to read a couple of NTFSpartiitons.

megaspaz 10-22-2003 05:57 PM

Quote:

Originally posted by Festiz
Well that doesnt give me the right rights now does it? It is still only root who can read it!! are you guys not reading my message clear enough?

I Want my nonsuperuserusers to be able to read a couple of NTFSpartiitons.

it should. the default mount permissions for mounting windows partitions is rwx-r-x-r-x.

try a line like this then if slack is doing things differently:

/dev/hda1 /mnt/c ntfs auto,owner,umask=0222,ro 0 0

and then mount.

edit: change the device block and mountpoints to yours. the above is just an example.

Festiz 10-25-2003 12:23 PM

I solved it so that my at the moment only local user (festiz) can access it by putting in the uid and gid preferences in fstab. Do you btw know how I get hold of those numbers without using webmin?

apepost 10-28-2003 08:34 AM

You can make all users run mount as root by logging into root and type "chmod u+s <full path to the mount file>"

I think the path is "/usr/bin/mount" or "/sbin"

i hope this helps

Wonderer 10-28-2003 10:45 AM

Quote:

Originally posted by Festiz
Do you btw know how I get hold of those numbers without using webmin?
# id username

;)


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