LinuxQuestions.org
Visit Jeremy's Blog.
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 07-12-2005, 02:06 PM   #1
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Rep: Reputation: 15
stupid permissions! *need your help*


ive been running smooth since i sarted using linux except for one thing, i have absolutely no way to enter my hdb1 storage drive unless i am in root, i understand that theres lots of permissions in linux to keep people from ruining thier pc but i really dislike having to log back in to view the contents of my hard drive, so if someone could tell me how i could view my second hard drive in my username please tell me, im an awful person at googling and i wouldnt come here unless i had no way of finding an answer ~_~ im using slackware 10.1, thanks
 
Old 07-12-2005, 02:15 PM   #2
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
what is your drive filesystem?
 
Old 07-12-2005, 02:16 PM   #3
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Original Poster
Rep: Reputation: 15
NTFS on hdb1, ext2 on my linux drive, a while back i had windows, my 80 gig hard drive was all just a big dump bin of files
 
Old 07-12-2005, 03:19 PM   #4
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
edit /etc/fstab and add "umask=022" to the option (4th column) for that partition, separated by a comma. If you only have "defaults" there, remove it and replace it with "umask=022" instead of adding it.

As example, here is my line about a FAT32 partition (I dont use NTFS here) :
/dev/hda7 /mnt/win_d vfat umask=022 1 2
 
Old 07-12-2005, 04:08 PM   #5
peter72
Member
 
Registered: Oct 2002
Location: Charlottesville, VA
Distribution: Ubuntu (home), SLES (work)
Posts: 196
Blog Entries: 1

Rep: Reputation: 30
2 things.
First be warned that writing to NTFS, as you could corrupt that partition totally and blow away your windows install.

2nd is, you can map the NTFS partition to a particular user or group which is a little nicer.

Code:
edit /etc/fstab

to write to that partition ( note above warning )
/dev/hda6 /mnt/win_d ntfs uid=linuxuser,gid=linuxgroup,umask=002 1 2

to just read from partition
/dev/hda6 /mnt/win_d ntfs uid=linuxuser,gid=linuxgroup,umask=222 1 2

The umask gives a the linuxgroup read/write access to that partition also. Also mapping to particular user works for fat32 partitions.

Last edited by peter72; 07-12-2005 at 04:13 PM.
 
Old 07-12-2005, 11:29 PM   #6
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Original Poster
Rep: Reputation: 15
thnks, and i dont really have windows installation, and i dont really want to ever use it again, it was just a formatted storage drive i used, all i really want is to read it, thnks tho ^_^

*edit* yeah, niether worked, the umask did absolutley nothing, and apparently ive forgotten what # is the gid, i was sure it was root, but it still wont let me connect.... so i dont know

Last edited by HKJGN; 07-12-2005 at 11:49 PM.
 
Old 07-18-2005, 12:08 AM   #7
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Original Poster
Rep: Reputation: 15
grrr, now even with these settings, it still wont let my user access it x_x please help.....
 
Old 07-18-2005, 06:30 AM   #8
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
can you show us the line you added exactly? This should work so I believe there is something wrong about your line.
 
Old 07-23-2005, 12:02 AM   #9
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Original Poster
Rep: Reputation: 15
/dev/hdb1 /storage ntfs uid=1001,gid=100,umask=222 1 2

worked, then didnt work, i checked and double checked and double doublechecked the uid gid.... i dunno anymore...
 
Old 07-23-2005, 05:20 PM   #10
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
Try to make your uid 1001 the owner of the /storage directory.

Also, you shoot yourself in the foot with umask=222 instead of 022. Those mean the bits that are OFF in the permissions. So the 222 mask means you get 555, or r-xr-xr-x, but you want rwx for the owner, 755 for the bits, so set 022 for the umask.

Also, you could add "user" to the mount options, allowing yourself, not root, to mount that area if you don't want it all the time. Then also add noauto so it gets mounted only on demand.

Good luck,

mlp
 
Old 07-26-2005, 01:30 PM   #11
ayteebee
Member
 
Registered: Jul 2005
Location: Derbyshire
Distribution: Originally Suse 9.1 Professional, currently Knoppix 3.7, migrating to Slackware
Posts: 75

Rep: Reputation: 16
I'm a newbie myself, but I know a very small amount about access permissions (ie, what it says in the Suse manual).

These are the things I would try:

Quote:
Also, you could add "user" to the mount options, allowing yourself, not root, to mount that area if you don't want it all the time. Then also add noauto so it gets mounted only on demand.
I would try that first... this is what mlp68 means (I don't know what level you are with linux, so I'll explain as best I can: a newbie is bound to read this at some stage!)

This is an example of the contents from my /etc/fstab file:

Code:
/dev/hdb1            /backup/hdb1         vfat       user,noauto           0 0
/dev/hdb2            /backup/hdb2         ext2       user,noauto,noacl     0 0
The first column is the device name, the second column is where it mounts to, the third column is the filesystem, fourth the mount options... And I don't know what the last column is!

Having "user" specified in the fourth column means that any user can mount it, not just root. However this only means that users can mount it. It doesn't mean that they can access it (I think that's what you were trying to resolve with "umask=222" and stuff, but I don't really understand that yet!)

The second thing I would try is this:

Mount the hard disk
Type the following:
Code:
cd /
ls -l storage
This brings up the following (on my system the directory is empty; I just created it for the demonstration):
Code:
linux:/ # ls -l storage
total 1
drwxr-xr-x   2 root root  48 2005-07-26 18:43 .
drwxr-xr-x  33 root root 784 2005-07-26 18:43 ..
linux:/ #
The "ls -l storage" command shows a detailed list of the contents of the directory "storage".
The part we are concerned about is the second line of the output from the command (that is, the line which has the single full stop at the end):
"drwxr-xr-x 2 root root 48 2005-07-26 18:43 ."
The "drwxr-xr-x" shows the access permissions, this is how to read them:
"d" signifies it is a directory ("-" is a file, "l" is a link, etc)
Then there is a bunch of characters, rwxr-xr-x
The first rwx means the owner can read files from the directory, write to files in the directory (including creating new files/directories) and execute the directory (executing a directory means opening it)
The second and third sets of "r-x" therefore signify that members of the group owning the file, and all other users, can only read files inside the directory, and look at what is in the directory. They cannot modify files or add files to the directory.

The access permissions can be changed using the following command (called from the root (/) directory):
Code:
chmod u+rwx,g+rwx,o+rwx storage
This will give EVERYONE (user, group and all others) permission to access, modify, delete etc anything inside /storage.
If you type "ls -l storage" again, you will see that the changes are reflected in the directory listing:
Code:
linux:/ # ls -l storage
total 1
drwxrwxrwx   2 root root  48 2005-07-26 18:43 .
drwxr-xr-x  33 root root 784 2005-07-26 18:43 ..
linux:/ #
If you now want to DENY other people permission to write to the file, type:
Code:
chmod o-w storage
You can play around with that, but I recommend doing it on an empty file first (just in case! :-P)

Possible problems with this could be:
1) I don't know whether the access permissions will be inheritable within the directory: If you create a new file, for example, I don't know what access permissions it will have. This could be what the whole "umask=022" stuff was about, but like I said, I don't understand that!

2) I don't know if this will work with NTFS filesystems. I think it should but I think you need the Linux ACL (Access Control Lists) on the filesystem, and I don't know much about filesystems so I couldn't tell you.


Well I think that's all I have to say on the issue! Probably nothing you didn't already know, but hey.
I don't know if any of this will work on your distro or anything, but it may be useful to someone.

Oh, This is my first post on a Forum, so if I'm talking Jack will someone please beat it out of me?!
Cheers.
 
Old 07-27-2005, 12:58 PM   #12
HKJGN
LQ Newbie
 
Registered: Feb 2005
Posts: 27

Original Poster
Rep: Reputation: 15
the drive is mounted read only. i cant change permissions, even in root, if i could have made
it that easy i would have =P.i tried about a hundred times. its how the device is mounted. but
when i mount it rw it doesnt even mount, maybe because the entire drive is ntfs...
 
Old 07-28-2005, 06:58 PM   #13
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
Let's try again, give us a bit more info. Please send us some output of:

id <nameyouruserwithuid1001>

your current /etc/fstab

after the disk is mounted, the output of

mount

and a few lines of

ls -l /storage


It's true that you cannot *change* permission in a readonly filesystem. The idea is still that the mount options make it so that the files appear with the right permissions and, more importantly, owner from the beginning.

Then, you could recompile your kernel with NTFS write support, but it's still marked as dangerous. If all you need is to read the files that you already have on the disk, it's going to work this way.

mlp
 
Old 08-24-2005, 12:34 AM   #14
truthstreamdotorg
LQ Newbie
 
Registered: Aug 2005
Location: Orlando, FL
Distribution: Suse 9.2 64 bit athlon
Posts: 1

Rep: Reputation: 0
I appear to have the same exact problem as this person. I too have no permission, even as root, to change the permissions of the drive. I have an sata drive that somehow got partitioned into 3 parts that show up under the /windows mount as C, D and E. Here are the answers to the questions you asked the last guy for my situation:

Quote:
Originally posted by mlp68
Let's try again, give us a bit more info. Please send us some output of:

id <nameyouruserwithuid1001>


uid=1000(phish420) gid=100(users) groups=100(users),16(dialout),33(video)

Quote:
your current /etc/fstab
/dev/hdc2 / reiserfs acl,user_xattr 1 1
/dev/hdc1 swap swap pri=42 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
proc /proc proc defaults 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
sysfs /sys sysfs noauto 0 0
/dev/dvdrecorder /media/dvdrecorder subfs fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
/dev/fd0 /media/floppy subfs fs=floppyfss,procuid,nodev,nosuid,sync 0 0
/dev/sda4 /windows/c ntfs umask=022 0 0
/dev/sda5 /windows/d ntfs umask=022 0 0
/dev/sda6 /windows/e ntfs umask=022 0 0

Quote:
after the disk is mounted, the output of

mount
linux:/windows # mount
/dev/hdc2 on / type reiserfs (rw,acl,user_xattr)
proc on /proc type proc (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/hda on /media/dvdrecorder type subfs (ro,nosuid,nodev,fs=cdfss,procuid,iocharset=utf8)
/dev/fd0 on /media/floppy type subfs (rw,nosuid,nodev,sync,fs=floppyfss,procuid)
/dev/sda4 on /windows/c type ntfs (rw,umask=022)
/dev/sda5 on /windows/d type ntfs (rw,umask=022)
/dev/sda6 on /windows/e type ntfs (rw,umask=022)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sdc1 on /media/usb-0200387914:0:0:1p1 type subfs (rw,noexec,nosuid,nodev,sync,procuid,iocharset=utf8)

Quote:
and a few lines of

ls -l /storage
linux:/windows # cd /
linux:/ # ls -l /storage
/bin/ls: /storage: No such file or directory
linux:/ # ls -l /windows
total 21
drwxrwxrwx 5 root root 120 2005-08-23 21:58 .
drwxr-xr-x 23 root root 536 2005-08-24 01:02 ..
dr-xr-xr-x 1 root root 12288 2005-08-23 19:03 c
dr-xr-xr-x 1 root root 4096 2005-08-23 19:03 d
dr-xr-xr-x 1 root root 4096 2005-08-23 19:03 e

Quote:
It's true that you cannot *change* permission in a readonly filesystem. The idea is still that the mount options make it so that the files appear with the right permissions and, more importantly, owner from the beginning.

Then, you could recompile your kernel with NTFS write support, but it's still marked as dangerous. If all you need is to read the files that you already have on the disk, it's going to work this way.

mlp
I still dont know how to 'recompile a kernel' and would love to be pointed to a decent how to on how to do this with this ntfs write support you are talking about.
Also, here is the output of me trying to change the permissions as suggested above:

linux:/windows # chmod u+rwx,g+rwx,o+rwx c
chmod: changing permissions of `c': Read-only file system

Oh, and I am running Suse 9.2 on a 64bit athlon. The drive, as I said is sata and does not have any windows install that I am concerened about - only video files for the most part.

Last edited by truthstreamdotorg; 08-24-2005 at 12:38 AM.
 
Old 08-24-2005, 05:43 AM   #15
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
Again, in a read-only file system, you cannot change anything after it's mounted -- your chmod MUST fail. That's why we make the mount options so that the files ownerships appear right from the get-go. You will be able to read the files, but not be able to change anything, including permissions.

I looked it up on one of "my" machines that has a similar setup; /dev/hda1 is a NTFS winxp partition, the linux installation lives on hdb. I mount hda1 as /winxp.

The designated owner (Peter) is uid=199,gid=100.

Here is the line in /etc/fstab:

/dev/hda1 /winxp ntfs uid=199,gid=100,ro 0 0

This mounts the partition and all files in there appear to be owned by peter:

Code:
 # ls -l /winxp/
total 1966052
-r--------  1 peter users          0 Jan 16  2003 AUTOEXEC.BAT
-r--------  1 peter users          0 Jan 16  2003 CONFIG.SYS
dr-x------  1 peter users       4096 Apr 24 01:29 Documents and Settings
-r--------  1 peter users          0 Jan 16  2003 IO.SYS
-r--------  1 peter users         92 Apr  5  2004 IPH.PH
dr-x------  1 peter users       4096 Nov 20  2004 KPCMS
-r--------  1 peter users          0 Jan 16  2003 MSDOS.SYS
dr-x------  1 peter users          0 Dec 13  2003 MWASPI
-r--------  1 peter users      47580 Aug 29  2002 NTDETECT.COM
dr-x------  1 peter users      12288 Dec 24  2004 Palm
dr-x------  1 peter users      12288 May  6 21:52 Program Files
dr-x------  1 peter users       4096 Oct 12  2003 RECYCLER
dr-x------  1 peter users          0 Jan 16  2003 System Volume Information
dr-x------  1 peter users      45056 May  6 22:00 WINDOWS
-r--------  1 peter users        194 Jan 16  2003 boot.ini
dr-x------  1 peter users       4096 Jan 28  2003 cygwin
-r--------  1 peter users  804835328 Jun  3 15:52 hiberfil.sys
-r--------  1 peter users     233632 Aug 29  2002 ntldr
-r--------  1 peter users 1207959552 Jun  3 15:52 pagefile.sys
dr-x------  1 peter users      12288 May  8 20:07 w3av
and Mr Peter can read every file on there - they're his.

In your case, change the lines to

/dev/sda4 /windows/c ntfs uid=1000,gid=100,ro 0 0
/dev/sda5 /windows/d ntfs uid=1000,gid=100,ro 0 0
/dev/sda6 /windows/e ntfs uid=1000,gid=100,ro 0 0

The "ro" is just to be specific.

With the kernel, I have never used SuSE and there may be specific instructions where to find what, but there are plenty of step-by-step guides, e.g. http://www.linuxdocs.org/HOWTOs/Kernel-HOWTO.html

Still I would not mess with the ntfs partition if the above is good enough.

Hope it helps,
mlp
 
  


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
Stupid, stupid question; I lost Klaptop. :( Surfrider Slackware 2 08-31-2005 09:12 PM
Stupid Dumb Stupid Question... drigz Linux - Software 3 09-23-2004 03:09 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 12:52 PM
stupid stupid newb ? what to use instead of xconfigurator h00ligan Fedora 3 01-25-2004 09:51 PM
Hopefully a stupid Newbie Question - Sound/Permissions airsylph Linux - Newbie 2 01-26-2002 02:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:46 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