LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 12-18-2006, 01:07 AM   #1
jmding
LQ Newbie
 
Registered: Oct 2006
Posts: 13

Rep: Reputation: 0
change permissions of the second hard drive


I have two 160G hard drives. On the first one, I have two operating system: windows XP(pro) and Linux Red Hat. The second hard drive is only available in XP or root under Linux. as a common user in Linux, the second HD is only readable but not writable. I had tried to login as root and change the permission by chmod. But it didn't change anything.

For example: (/DATA is the folder of second HD)

ls -l /DATA
total 288
drwxr-xr-x 2 root root 32768 Nov 28 23:07 ancova
drwxr-xr-x 9 root root 32768 Nov 29 13:03 multi
drwxr-xr-x 9 root root 32768 Oct 11 13:41 oldbackupUCD
drwxr-xr-x 11 root root 32768 Nov 15 09:25 paper
drwxr-xr-x 3 root root 32768 Nov 23 16:24 projects
drwxr-xr-x 2 root root 32768 Sep 29 13:09 Recycled
drwxr-xr-x 3 root root 32768 Sep 28 12:49 System Volume Information
drwxr-xr-x 4 root root 32768 Oct 1 17:20 teaching
-rwxr-xr-x 1 root root 8 Dec 17 19:38 test.txt

When I type:
chmod o+w /DATA/test.txt
ls -l /DATA
............
-rwxr-xr-x 1 root root 8 Dec 17 19:38 test.txt

Nothing changed ???

Any suggestion?

I googled for a while and it seems that if I change /etc/fstab, it might be helpful. But I don't know how to change it. Here is my current /etc/fstab:

This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/dev/hdb /media/cdrom auto pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
/dev/hda /media/cdrecorder auto pamconsole,fscontext=system_ubject_r:removable_t,exec,noauto,managed 0 0
 
Old 12-18-2006, 01:30 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
I'm guessing that the second drive is formatted as a single NTFS partition. It isn't listed in your /etc/fstab.

If it is an ntfs partition, you determine the permissions for the entire partition when you mount it. You can use the "umask=" option, or use separate "fmask=" and "dmask=" options. The second options allows read-only access for files and "rx" permissions for directories. You can also use the "uid=youusername" and "gid=yourgroup" to change the ownership of the drive.

If the drive is formatted using the fat32 filesystem, then use the filesystem type "vfat" in your fstab line. Like ntfs, the permissions on the partition are set globally when the partition is mounted. You can have write access however.

You can read through "man mount" for more options, and general instructions. If you have the kernel source and kernel-docs packages installed, there is a ntfs.txt file in the kernel source.

Last edited by jschiwal; 12-18-2006 at 01:32 AM.
 
Old 12-18-2006, 01:39 AM   #3
jmding
LQ Newbie
 
Registered: Oct 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Sorry I am really new to Linux and I have spend all my this week on googling help Could you tell me how to tell whether it is fat or ntfs? And whether it should be /dev/hda ? or /dev/hdb?
or /dev/hdc? Any example lines?

Thanks!!!
 
Old 12-18-2006, 03:19 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Run as root: fdisk -l
This will list all of your drives and partitions.

( You caught me when I rarely reboot my laptop into Windows to keep up with the updates. No problem, I just used cygwin to ssh into the desktop for an example. )

My fstab entry may look different because Red Hat and FC like to use labels. Anyway, this is how the entry for my Windows XP partition is mounted:
Code:
/dev/sda1       /windows/C      ntfs    uid=jschiwal,gid=jschiwal,ro,defaults,umask=0002,utf8=true 0 0
Your devices are probably different. If the drive is the second ide drive it is probably /dev/hdb and the first partition is /dev/hdb1. However if you partitioned it as an extended partition, then it probably is /dev/hdb5.
 
Old 12-18-2006, 03:55 PM   #5
jmding
LQ Newbie
 
Registered: Oct 2006
Posts: 13

Original Poster
Rep: Reputation: 0
You are right that my second hard drive is NTFS (partition type). But the file system is vfat32, since it is shared with windows.
When I type df -k it shows:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 124928728 11072652 107510000 10% /
none 2073360 0 2073360 0% /dev/shm
/dev/sdb1 156242112 11787648 144454464 8% /DATA

So sda2 is the linux on the first hard drive and sdb1 is the second HDD.
But still I don't have those lines in /etc/fstab, so how should I change the fstab file?

BTW, I am using Red Hat.
 
Old 12-18-2006, 09:40 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
NTFS and FAT32 are two distinct filesystems. I already included a sample line from my desktop for reading an NTFS formatted partition.

For a fat32 drive you could use something like this:
sudo mount -t vfat /dev/sda1 /mnt/ -o defaults,uid=jschiwal,umask=0007
to mount it manually or add a line like
/dev/sda1 /windows/D vfat defaults,uid=jschiwal,umask=0007 0 0
to /etc/fstab. This is for a usb flash drive on my laptop. Use your own username of course, and you can select a different mount point.

The man mount command will give more options. For a flash drive, if it were using a different filesystem that stores individual inodes on the filesystem itself, using noatime would be recommended. Reducing the number of writes can extend the life of flash memory. Sometimes the noatime option is used on servers to speed up access.
For removable drives, you would want to use the noauto option. Then the device won't be mounted at boot automatically with the "mount -a" command. So if the device isn't plugged in, it won't cause booting to fail.
 
Old 12-19-2006, 04:42 PM   #7
jmding
LQ Newbie
 
Registered: Oct 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks! I got this problem solved under your help. In fact, my second hard drive is automatically mounted in the file /etc/rc.d/rc.local and adding a line in /etc/fstab doesnot work (it says too many mount... during booting). So I add the uid=jmding in that file. But umask does not work there. So I still cannot give permission to group. But at least I have the ownership now Thanks again!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Hard Drive Permissions djljjm Linux - Newbie 3 04-18-2005 04:35 PM
Hard Drive Permissions djljjm Linux - Newbie 1 04-18-2005 12:29 PM
Hard drive permissions R¬dical_úD Suse/Novell 3 01-10-2005 08:20 AM
Change permissions on ntfs drive PieEater Linux - Newbie 2 09-11-2004 10:26 AM
Permissions for second hard drive digi691 Linux - Newbie 29 09-03-2004 11:33 AM


All times are GMT -5. The time now is 07:19 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration