Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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
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.
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
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.
Distribution: Originally Suse 9.1 Professional, currently Knoppix 3.7, migrating to Slackware
Posts: 75
Rep:
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:
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):
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:
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.
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...
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.
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:
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.