| |||
| mounting luks partition as normal user Hi, I just bought 1TB external hard drive and I've created 2 different partition in it, 1 with fat and another one with reiserfs (encrypted). I've added 2 lines in /etc/fstab so that I can mount them as normal user with option noauto,user for both of them. I can mount both fs as normal user with no problem, the problem is I can't write to encrypted partition because root is the owner even though I've mount it as normal user. How can I fix that ? I never use luks before and the information i get from the internet doesn't provide any help, or maybe I looked in the wrong place. > cat /etc/fstab /dev/sdc1 /mnt/win vfat noauto,user 0 0 /dev/mapper/cr_sdc2 /mnt/lin reiserfs noauto,user 0 0 > mount /dev/mapper/cr_sdc2 on /mnt/lin type reiserfs (rw,noexec,nosuid,nodev,user=snorzzz) /dev/sdc1 on /mnt/win type vfat (rw,noexec,nosuid,nodev,user=snorzzz) > ls -l /mnt drwxr-xr-x 5 root root 104 jul 13 00:04 lin drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win |
| |||
| Re: mounting luks partition as normal user On Sun, 13 Jul 2008, Canned wrote:- <snip> >drwxr-xr-x 5 root root 104 jul 13 00:04 lin >drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win Mount it and, as root, use these commands: chown root.users /mnt/lin chmod 2775 /mnt/lin The first one sets the ownership of the file system to root and users. The second one will set the permissions so that both owner and group members can write to it. The addition of the '2' means that the group ownership of files will be that of the file system, which is 'users', not that of the person that wrote them. These are what I use when adding shared file systems to my machines. Regards, David Bolt -- www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys SUSE 10.1 32 | | openSUSE 10.3 32bit | openSUSE 11.0 32bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit | openSUSE 11.0 64bit RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC | RISC OS 3.11 |
| |||
| Re: mounting luks partition as normal user David Bolt schreef: > On Sun, 13 Jul 2008, Canned wrote:- > > <snip> > >> drwxr-xr-x 5 root root 104 jul 13 00:04 lin >> drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win > > Mount it and, as root, use these commands: > > chown root.users /mnt/lin > chmod 2775 /mnt/lin > > The first one sets the ownership of the file system to root and users. > > The second one will set the permissions so that both owner and group > members can write to it. The addition of the '2' means that the group > ownership of files will be that of the file system, which is 'users', > not that of the person that wrote them. > > These are what I use when adding shared file systems to my machines. > > > Regards, > David Bolt > Thats not really what I had in my mind. I prefer to set the ownership to the user itself. But thats not really what I'm asking for. I just want to know why both fs shows different ownership while I'm mounted both of them as normal user. I thought if I use 'user' option in /etc/fstab the ownership would be set automatically to the user, like my fat partition. > ls -l /mnt drwxr-xr-x 5 root root 104 jul 13 00:04 lin ^^^^^^^^^^ drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win ^^^^^^^^^^^^^ |
| |||
| Re: mounting luks partition as normal user Canned wrote: > I thought if I use 'user' option in /etc/fstab the > ownership would be set automatically to the user, like my fat partition. This does not happen. The fat system has no notion of users owning files. So whoever mounts a fat partition can be given ownership of all its files. A reiserfs partition, on the other hand, keeps a record of the ownship of each file. -- Arthur. |
| |||
| Re: mounting luks partition as normal user On Sun, 13 Jul 2008, Canned wrote:- <snip> >Thats not really what I had in my mind. I prefer to set the ownership >to the user itself. But thats not really what I'm asking for. What was you originally asked for was: <quote> I can mount both fs as normal user with no problem, the problem is I can't write to encrypted partition because root is the owner even though I've mount it as normal user. How can I fix that ? </quote> The chown/chmod commands I gave you fixes that. >I just want to know why both fs shows different ownership while I'm >mounted both of them as normal user. As Arthur Buse said, VFAT file systems have no knowledge of ownership. They are "owned" by whoever mounted the file system, unless explicitly overridden in /etc/fstab or the mount command. Reiserfs is a normal Linux file system and knows all about file ownership. As /mnt/lin/. is owned by root.root and the permissions don't allow for non-owner or non-group writing, you can't write to that file system as a normal user. >I thought if I use 'user' option in /etc/fstab the ownership would be >set automatically to the user, like my fat partition. No, it just means that a user is able to mount it. It doesn't mean that it becomes owned by the user that mounted it. >> ls -l /mnt >drwxr-xr-x 5 root root 104 jul 13 00:04 lin > ^^^^^^^^^^ >drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win > ^^^^^^^^^^^^^ As I said before, use the chmod/chown commands and you can mount it as a user. What you'll see is something like this: davjam@playing:~> ls -la /local1 total 25159940 drwxrwsr-x 2 root users 116 2008-07-12 07:12 . drwxr-xr-x 25 root root 4096 2008-07-09 00:11 .. -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso This shows the file system is owned by root.users. As my normal user I can read and write to it, as shown by the six ISOs owned by davjam.users. davjam@playing:~> su - Password: playing:~ # touch /local1/root.owned playing:~ # ls -la /local1 total 25159940 drwxrwsr-x 2 root users 133 Jul 14 00:32 . drwxr-xr-x 25 root root 4096 Jul 9 00:11 .. -rw-r--r-- 1 davjam users 4293345280 Jul 12 05:12 avis-100.iso -rw-r--r-- 1 davjam users 4296239104 Jul 12 07:16 avis-101.iso -rw-r--r-- 1 davjam users 4292425728 Jun 21 15:07 avis-96.iso -rw-r--r-- 1 davjam users 4292923392 Jun 21 18:28 avis-97.iso -rw-r--r-- 1 davjam users 4293169152 Jun 21 20:03 avis-98.iso -rw-r--r-- 1 davjam users 4295663616 Jul 12 01:33 avis-99.iso -rw-r--r-- 1 root users 0 Jul 14 00:32 root.owned Okay, here I've become root and created a file on the file system as root. playing:~ # df /local1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdc2 72241144 25164192 47076952 35% /local1 And I forgot to show that /local1 was a separate file system, XFS if you're curious. playing:~ # logout davjam@playing:~> touch /local1/davjam.owned davjam@playing:~> ls -la /local1 total 25159940 drwxrwsr-x 2 root users 152 2008-07-14 00:33 . drwxr-xr-x 25 root root 4096 2008-07-09 00:11 .. -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso -rw-r--r-- 1 davjam users 0 2008-07-14 00:33 davjam.owned -rw-r--r-- 1 root users 0 2008-07-14 00:32 root.owned And, as a normal user, I created another file just to show it could be done. Now, if you're certain that you want the file system to be owned by yourself and that at no point are you going to be adding another user that might want to have read/write access to that file system, you can use virtually the same chown/chmod commands to do so. Just use this instead: chown snorzzz.users /mnt/lin chmod 755 /mnt/lin and when you do an 'ls -l /mnt' you'll see something like this: drwxr-xr-x 5 snorzzz users 104 jul 13 00:04 lin drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win Regards, David Bolt -- www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys SUSE 10.1 32 | | openSUSE 10.3 32bit | openSUSE 11.0 32bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit | openSUSE 11.0 64bit RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC | RISC OS 3.11 |
| |||
| Re: mounting luks partition as normal user David Bolt schreef: > On Sun, 13 Jul 2008, Canned wrote:- > > <snip> > >> Thats not really what I had in my mind. I prefer to set the ownership >> to the user itself. But thats not really what I'm asking for. > > What was you originally asked for was: > > <quote> > I can mount both fs as normal user > with no problem, the problem is I can't write to encrypted > partition because root is the owner even though I've mount it as normal > user. How can I fix that ? > </quote> > > The chown/chmod commands I gave you fixes that. > Hmm...yes, I guess I could ask it in different way. My english is bad, sorry for the misunderstanding. >> I just want to know why both fs shows different ownership while I'm >> mounted both of them as normal user. > > As Arthur Buse said, VFAT file systems have no knowledge of ownership. > They are "owned" by whoever mounted the file system, unless explicitly > overridden in /etc/fstab or the mount command. > Thats what I wanted to know. Why vfat can be owned by me after mounting it and reiserfs not. Thanks for both of you. > Reiserfs is a normal Linux file system and knows all about file > ownership. As /mnt/lin/. is owned by root.root and the permissions don't > allow for non-owner or non-group writing, you can't write to that file > system as a normal user. > >> I thought if I use 'user' option in /etc/fstab the ownership would be >> set automatically to the user, like my fat partition. > > No, it just means that a user is able to mount it. It doesn't mean that > it becomes owned by the user that mounted it. > I thought I saw something about permission from man page, but now I know I was wrong. This is really embarrassing. >>> ls -l /mnt >> drwxr-xr-x 5 root root 104 jul 13 00:04 lin >> ^^^^^^^^^^ >> drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win >> ^^^^^^^^^^^^^ > > As I said before, use the chmod/chown commands and you can mount it as a > user. What you'll see is something like this: > > davjam@playing:~> ls -la /local1 > total 25159940 > drwxrwsr-x 2 root users 116 2008-07-12 07:12 . > drwxr-xr-x 25 root root 4096 2008-07-09 00:11 .. > -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso > -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso > -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso > -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso > -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso > -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso > > This shows the file system is owned by root.users. As my normal user I > can read and write to it, as shown by the six ISOs owned by > davjam.users. > > davjam@playing:~> su - > Password: > playing:~ # touch /local1/root.owned > playing:~ # ls -la /local1 > total 25159940 > drwxrwsr-x 2 root users 133 Jul 14 00:32 . > drwxr-xr-x 25 root root 4096 Jul 9 00:11 .. > -rw-r--r-- 1 davjam users 4293345280 Jul 12 05:12 avis-100.iso > -rw-r--r-- 1 davjam users 4296239104 Jul 12 07:16 avis-101.iso > -rw-r--r-- 1 davjam users 4292425728 Jun 21 15:07 avis-96.iso > -rw-r--r-- 1 davjam users 4292923392 Jun 21 18:28 avis-97.iso > -rw-r--r-- 1 davjam users 4293169152 Jun 21 20:03 avis-98.iso > -rw-r--r-- 1 davjam users 4295663616 Jul 12 01:33 avis-99.iso > -rw-r--r-- 1 root users 0 Jul 14 00:32 root.owned > > Okay, here I've become root and created a file on the file system as > root. > > playing:~ # df /local1 > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/sdc2 72241144 25164192 47076952 35% /local1 > > And I forgot to show that /local1 was a separate file system, XFS if > you're curious. > > playing:~ # logout > davjam@playing:~> touch /local1/davjam.owned > davjam@playing:~> ls -la /local1 > total 25159940 > drwxrwsr-x 2 root users 152 2008-07-14 00:33 . > drwxr-xr-x 25 root root 4096 2008-07-09 00:11 .. > -rw-r--r-- 1 davjam users 4293345280 2008-07-12 05:12 avis-100.iso > -rw-r--r-- 1 davjam users 4296239104 2008-07-12 07:16 avis-101.iso > -rw-r--r-- 1 davjam users 4292425728 2008-06-21 15:07 avis-96.iso > -rw-r--r-- 1 davjam users 4292923392 2008-06-21 18:28 avis-97.iso > -rw-r--r-- 1 davjam users 4293169152 2008-06-21 20:03 avis-98.iso > -rw-r--r-- 1 davjam users 4295663616 2008-07-12 01:33 avis-99.iso > -rw-r--r-- 1 davjam users 0 2008-07-14 00:33 davjam.owned > -rw-r--r-- 1 root users 0 2008-07-14 00:32 root.owned > > And, as a normal user, I created another file just to show it could be > done. > > Now, if you're certain that you want the file system to be owned by > yourself and that at no point are you going to be adding another user > that might want to have read/write access to that file system, you can > use virtually the same chown/chmod commands to do so. Just use this > instead: > > chown snorzzz.users /mnt/lin > chmod 755 /mnt/lin > > and when you do an 'ls -l /mnt' you'll see something like this: > > drwxr-xr-x 5 snorzzz users 104 jul 13 00:04 lin > drwxr-xr-x 4 snorzzz users 16384 jan 1 1970 win > yes, thats what I did. > > Regards, > David Bolt > |
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Combinig LUKS and LVM | slaskbrev1@gmail.com | Linux | 2 | 05-15-2008 04:10 AM |
| hal mounting ntfs partition with ntfs-3g | heavytull | Linux | 1 | 03-24-2008 10:00 AM |
| Changing normal user to rootadmin in Vista | Bram Naus | Windows Vista | 0 | 05-08-2007 12:50 AM |
| Changing normal user to rootadmin in Vista | Bram Naus | Windows Vista | 0 | 05-08-2007 12:50 AM |
| normal user can install software on XP | richard.baird@btinternet.com | Windows XP | 2 | 01-18-2007 06:15 PM |