Problem adding lines to /etc/fstab

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem adding lines to /etc/fstab

Richard Owlett-3
I am using Jessie with MATE.

I added these two lines to /etc/fstab:
/dev/sda7       /media/sda7     ext2    users,rw     0       0
/dev/sda8       /media/sda8     ext2    users,rw     0       0

Did not get what I expected after reading the man pages for fstab
and mount(8).

All users can mount and read.
However only root can create files or folders.

I want ALL users have full access to every thing in those partitions.
I understand that any user creating a file or folder will have to
set permissions appropriately.


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Greg Wooledge
On Thu, Dec 29, 2016 at 09:53:28AM -0600, Richard Owlett wrote:
> I added these two lines to /etc/fstab:
> /dev/sda7       /media/sda7     ext2    users,rw     0       0
> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>
> All users can mount and read.
> However only root can create files or folders.

We went over this already.

In an ext2 file system, the files and directories INSIDE THE FILE SYSTEM
have standard Unix owners, groups and permissions.

If you want every file and directory to be destroyable by every single
user on the system, then you have two choices.  Either you turn on the
"other" write permission bit for every single file and directory in
the file system (and make sure directories don't have the sticky bit),
or you use a non-Unix file system that does not store Unix owners,
groups and permissions at all (e.g. FAT32).

Xen
Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Xen
Greg Wooledge schreef op 29-12-2016 16:59:

> On Thu, Dec 29, 2016 at 09:53:28AM -0600, Richard Owlett wrote:
>> I added these two lines to /etc/fstab:
>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>>
>> All users can mount and read.
>> However only root can create files or folders.
>
> We went over this already.
>
> In an ext2 file system, the files and directories INSIDE THE FILE
> SYSTEM
> have standard Unix owners, groups and permissions.
>
> If you want every file and directory to be destroyable by every single
> user on the system, then you have two choices.  Either you turn on the
> "other" write permission bit for every single file and directory in
> the file system (and make sure directories don't have the sticky bit),
> or you use a non-Unix file system that does not store Unix owners,
> groups and permissions at all (e.g. FAT32).

If you don't like the standard colours you get from turning everything
to 777 (read write and execute for all) then you can also use the
too-powerful "setfacl" feature to just bypass all of that in one go:

sudo setfacl -R -m other:rwx mount_directory
sudo setfacl -R -d -m other:rwx mount_directory

Although I am not sure that will get rid of the colours. But this will:

sudo setfacl -R -m group:users:rwx mount_directory
sudo setfacl -R -d -m group:users:rwx mount_directory

Now all users that are part of group "users" will have full access.

New files will automatically inherit those permissions for as long as
you want.

You could restrict that to the "disk" user group if you wanted. But
these permissions are going to be a shadowy presence to the other
permissions. And just overrule them when necessary.


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Pascal Hambourg-2
In reply to this post by Richard Owlett-3
Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>
> I added these two lines to /etc/fstab:
> /dev/sda7       /media/sda7     ext2    users,rw     0       0
> /dev/sda8       /media/sda8     ext2    users,rw     0       0

Don't do that. Really.

1) Don't use drive or partition device names such as /dev/sda7. They are
unreliable. Use persistent identifiers such as UUID or LABEL instead.

2) The "users" option does not make sense without the "noauto" option
because the filesystem is going to be mounted automatically at startup,
so users do not need to mount it.

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

The Wanderer
On 2016-12-29 at 15:59, Pascal Hambourg wrote:

> Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>
>> I added these two lines to /etc/fstab:
>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>
> Don't do that. Really.
>
> 1) Don't use drive or partition device names such as /dev/sda7. They are
> unreliable. Use persistent identifiers such as UUID or LABEL instead.
How does that work if these are for removable devices (as I think from
past threads may well be the case here), and you may be plugging
half-a-dozen different devices into the same port at different times
(and want each one to be mounted to this same place)?

AFAIK, both UUID and LABEL are device- or FS-specific. If that's not the
case, I'd be interested to learn about it.

--
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Pascal Hambourg-2
Le 29/12/2016 à 22:14, The Wanderer a écrit :

> On 2016-12-29 at 15:59, Pascal Hambourg wrote:
>
>> Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>>
>>> I added these two lines to /etc/fstab:
>>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>>
>> Don't do that. Really.
>>
>> 1) Don't use drive or partition device names such as /dev/sda7. They are
>> unreliable. Use persistent identifiers such as UUID or LABEL instead.
>
> How does that work if these are for removable devices (as I think from
> past threads may well be the case here),

Then you should use "noauto" so that the system does not try to mount a
non-existent filesystem at startup.

> and you may be plugging
> half-a-dozen different devices into the same port at different times
> (and want each one to be mounted to this same place)?

You can use the symlinks in /dev/disk/by-path/ which names are based on
the connection path of the device.

> AFAIK, both UUID and LABEL are device- or FS-specific. If that's not the
> case, I'd be interested to learn about it.

UUID and LABEL are metadata bound to the contents (filesystem or
whatever), not to the device. PARTUUID and PARTLABEL are bound to the
partitions and usable if the partition scheme (such as GPT), kernel and
libblkid support it. You can create several filesystems on separate
drives with the same UUID or LABEL, but I would not recommend it.

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Richard Owlett-3
In reply to this post by Pascal Hambourg-2
On 12/29/2016 2:59 PM, Pascal Hambourg wrote:

> Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>>
>> I added these two lines to /etc/fstab:
>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>
> Don't do that. Really.
>
> 1) Don't use drive or partition device names such as /dev/sda7.
> They are unreliable. Use persistent identifiers such as UUID or
> LABEL instead.

In general I agree. For this specific use case of this specific
machine at this specific moment, what I did is reasonable and
proper.

>
> 2) The "users" option does not make sense without the "noauto"
> option because the filesystem is going to be mounted
> automatically at startup, so users do not need to mount it.

That was just one iteration of me vainly attempting to grasp
mount(8).

>
>


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Richard Owlett-3
In reply to this post by The Wanderer
On 12/29/2016 3:14 PM, The Wanderer wrote:

> On 2016-12-29 at 15:59, Pascal Hambourg wrote:
>
>> Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>>
>>> I added these two lines to /etc/fstab:
>>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>>
>> Don't do that. Really.
>>
>> 1) Don't use drive or partition device names such as /dev/sda7. They are
>> unreliable. Use persistent identifiers such as UUID or LABEL instead.
>
> How does that work if these are for removable devices (as I think from
> past threads may well be the case here),

In this case I am dealing with the only hard drive existing
internal to the laptop.


>  and you may be plugging
> half-a-dozen different devices into the same port at different times
> (and want each one to be mounted to this same place)?
>
> AFAIK, both UUID and LABEL are device- or FS-specific. If that's not the
> case, I'd be interested to learn about it.
>


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Greg Wooledge
On Fri, Dec 30, 2016 at 05:17:21AM -0600, Richard Owlett wrote:
> >>>/dev/sda7       /media/sda7     ext2    users,rw     0       0
> >>>/dev/sda8       /media/sda8     ext2    users,rw     0       0

> In this case I am dealing with the only hard drive existing
> internal to the laptop.

Then why are you using "users" at all?  Just let it mount with the
default options.  You know, after you figure out what kind of file
system it should contain, and after you adjust the ownerships and
permissions on the files therein, if you select a Unix-type file
system.

You don't have a problem that in the realm of fstab yet.  You have
a problem with the basic understanding of file systems.  Once you
understand how a file system works, the fstab line for a static mount
from a self-constrained single device is just a trivial afterthought.

The ONLY way an fstab line will contain any interesting stuff is if you
opt to use a DOS-type file system, in which case you will need to use
mount options that lay some phony Unix-type metadata on top of it.
E.g. "mount -o uid=richard,gid=goodusers,umask=002  ..."
This would PRESENT the metadata-less files as if they are actually
owned by user richard, group goodusers, permissions 664 (-rw-rw-r--)
and 775 (drwxrwxr-x).  This is just one possible example.

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Richard Owlett-3
On 12/30/2016 7:09 AM, Greg Wooledge wrote:

> On Fri, Dec 30, 2016 at 05:17:21AM -0600, Richard Owlett wrote:
>>>>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>>>>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>
>> In this case I am dealing with the only hard drive existing
>> internal to the laptop.
>
> Then why are you using "users" at all?  Just let it mount with the
> default options.  You know, after you figure out what kind of file
> system it should contain, and after you adjust the ownerships and
> permissions on the files therein, if you select a Unix-type file
> system.
>
> You don't have a problem that in the realm of fstab yet.  You have
> a problem with the basic understanding of file systems.  Once you
> understand how a file system works, the fstab line for a static mount
> from a self-constrained single device is just a trivial afterthought.
>
> The ONLY way an fstab line will contain any interesting stuff is if you
> opt to use a DOS-type file system, in which case you will need to use
> mount options that lay some phony Unix-type metadata on top of it.
> E.g. "mount -o uid=richard,gid=goodusers,umask=002  ..."
> This would PRESENT the metadata-less files as if they are actually
> owned by user richard, group goodusers, permissions 664 (-rw-rw-r--)
> and 775 (drwxrwxr-x).  This is just one possible example.
>
>

You were closer to an _applicable_ answer yesterday in stating
"We went over this already."

I don't know about other tallies, but I show ~100 posts.
Started reviewing them. Found a chain of links leading me to
https://wiki.debian.org/UserPrivateGroups . I've just started
reading it. It addresses my goal. It is not clear whether it or
something addressing ACL's poke me just right to clear my mental
logjam.


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Greg Wooledge
On Fri, Dec 30, 2016 at 10:13:26AM -0600, Richard Owlett wrote:
> "We went over this already."
>
> I don't know about other tallies, but I show ~100 posts.
> Started reviewing them. Found a chain of links leading me to
> https://wiki.debian.org/UserPrivateGroups . I've just started
> reading it. It addresses my goal.

Maybe if you would STATE your goal, someone could help you.

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

deloptes-2
Greg Wooledge wrote:

> On Fri, Dec 30, 2016 at 10:13:26AM -0600, Richard Owlett wrote:
>> "We went over this already."
>>
>> I don't know about other tallies, but I show ~100 posts.
>> Started reviewing them. Found a chain of links leading me to
>> https://wiki.debian.org/UserPrivateGroups . I've just started
>> reading it. It addresses my goal.
>
> Maybe if you would STATE your goal, someone could help you.

The goal described in the document is classic user groups and collaboration
via groups.

There are also nice examples. It has nothing to do with /etc/fstab however.
Admitted: users goal is still unclear.

@ Richard. Originally stated problem with fstab/mount, no saying the wiki
article addresses your goal. How could we conclude from to disconnected
topics what your goal is?

You usually mount the root of a partition to some directory. you create
subdirectories where you can set whatever permissions and groups you need
and add users to those groups, so that users can read/write where they have
access to. In most of the cases this has nothing to do with the mount. The
case where it has to do with mount is where user needs to mount/umount a
media (usually external or network drive)

regards

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Richard Owlett-3
On 12/30/2016 10:58 AM, deloptes wrote:

> Greg Wooledge wrote:
>
>> On Fri, Dec 30, 2016 at 10:13:26AM -0600, Richard Owlett wrote:
>>> "We went over this already."
>>>
>>> I don't know about other tallies, but I show ~100 posts.
>>> Started reviewing them. Found a chain of links leading me to
>>> https://wiki.debian.org/UserPrivateGroups . I've just started
>>> reading it. It addresses my goal.
>>
>> Maybe if you would STATE your goal, someone could help you.

I want a specific set of users to have unrestricted access to one
or more specific partitions.


>
> The goal described in the document is classic user groups and collaboration
> via groups.

Quoting from https://wiki.debian.org/UserPrivateGroups:

"It requires no action on the part of the end-user to work as
expected. Files and directories within a group directory can be
created, modified, and deleted, and (for the most part) have
their permissions modified as usual, whilst being shared with
other group members and protected from non-members."

and later

"Group directories (directories with the set-group-id flag) are
shared work spaces (that again all users are able to visit). All
members of the group that owns the directory can create and write
to files in it. Additionally, according to the set-group-id flag,
all newly created files in the group directory will belong to the
creating user who wrote the file and (this is special) to the
group the directory belongs to. The result is that all members of
the group can work on the files in their group directory. Other
than that, group directories work just like home directories. So
if a file for example should be readable only by group members,
again, put it into a private/ subdirectory!"

I see *NO DIFFERENCE* between that and my previously stated goal.



>
> There are also nice examples. It has nothing to do with /etc/fstab however.
> Admitted: users goal is still unclear.
>
> @ Richard. Originally stated problem with fstab/mount, no saying the wiki
> article addresses your goal. How could we conclude from to disconnected
> topics what your goal is?
>
> You usually mount the root of a partition to some directory. you create
> subdirectories where you can set whatever permissions and groups you need
> and add users to those groups, so that users can read/write where they have
> access to. In most of the cases this has nothing to do with the mount. The
> case where it has to do with mount is where user needs to mount/umount a
> media (usually external or network drive)
>
> regards
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Greg Wooledge
On Fri, Dec 30, 2016 at 11:32:05AM -0600, Richard Owlett wrote:
> I see *NO DIFFERENCE* between that and my previously stated goal.

If you want classic Unix permissions on a file system on a fixed partition
on a non-removable device, then you simply put the device into /etc/fstab
with DEFAULT mount options.  None of this crazy "user" or "users" option
stuff, since it's not a thing users are going to mount and unmount.

Then, inside the mounted file system, you use chown and chgrp and chmod.

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Nicholas Geovanis-2
This is the first time I've heard of this "solution" named "User Private Groups".
Reading the RedHat and Debian doc referred to, "User Private Groups" seems to be another name for setting the umask and the setgid bit in a directory intended for shared work. Did I miss something or is that all it is?

On Fri, Dec 30, 2016 at 11:37 AM, Greg Wooledge <[hidden email]> wrote:
On Fri, Dec 30, 2016 at 11:32:05AM -0600, Richard Owlett wrote:
> I see *NO DIFFERENCE* between that and my previously stated goal.

If you want classic Unix permissions on a file system on a fixed partition
on a non-removable device, then you simply put the device into /etc/fstab
with DEFAULT mount options.  None of this crazy "user" or "users" option
stuff, since it's not a thing users are going to mount and unmount.

Then, inside the mounted file system, you use chown and chgrp and chmod.


Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

John L. Ries
In reply to this post by Richard Owlett-3
Actually, I've never really understood the labeling business (another
case of exemplary documentation), so I use the actual device names
unless the OS labels them and generates the fstab entries for me.

--------------------------|
John L. Ries              |
Salford Systems           |
Phone: (619)543-8880 x107 |
or     (435)867-8885      |
--------------------------|


On Friday 2016-12-30 04:17, Richard Owlett wrote:

>Date: Fri, 30 Dec 2016 04:17:21
>From: Richard Owlett <[hidden email]>
>To: [hidden email]
>Subject: Re: Problem adding lines to /etc/fstab
>Resent-Date: Fri, 30 Dec 2016 11:17:50 +0000
>Resent-From: <[hidden email]>
>
> On 12/29/2016 3:14 PM, The Wanderer wrote:
>> On 2016-12-29 at 15:59, Pascal Hambourg wrote:
>>
>>> Le 29/12/2016 à 16:53, Richard Owlett a écrit :
>>>
>>>> I added these two lines to /etc/fstab:
>>>> /dev/sda7       /media/sda7     ext2    users,rw     0       0
>>>> /dev/sda8       /media/sda8     ext2    users,rw     0       0
>>>
>>> Don't do that. Really.
>>>
>>> 1) Don't use drive or partition device names such as /dev/sda7. They are
>>> unreliable. Use persistent identifiers such as UUID or LABEL instead.
>>
>> How does that work if these are for removable devices (as I think from
>> past threads may well be the case here),
>
> In this case I am dealing with the only hard drive existing internal to the
> laptop.
>
>
>> and you may be plugging
>> half-a-dozen different devices into the same port at different times
>> (and want each one to be mounted to this same place)?
>>
>> AFAIK, both UUID and LABEL are device- or FS-specific. If that's not the
>> case, I'd be interested to learn about it.
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

John L. Ries
In reply to this post by Richard Owlett-3
What do you mean by "unlimited access"?  That is normally a permission
issue (unless this is something like VFAT).

--------------------------|
John L. Ries              |
Salford Systems           |
Phone: (619)543-8880 x107 |
or     (435)867-8885      |
--------------------------|


On Friday 2016-12-30 10:32, Richard Owlett wrote:

>Date: Fri, 30 Dec 2016 10:32:05
>From: Richard Owlett <[hidden email]>
>To: [hidden email]
>Subject: Re: Problem adding lines to /etc/fstab
>Resent-Date: Fri, 30 Dec 2016 17:32:32 +0000
>Resent-From: <[hidden email]>
>
> On 12/30/2016 10:58 AM, deloptes wrote:
>> Greg Wooledge wrote:
>>
>>> On Fri, Dec 30, 2016 at 10:13:26AM -0600, Richard Owlett wrote:
>>>> "We went over this already."
>>>>
>>>> I don't know about other tallies, but I show ~100 posts.
>>>> Started reviewing them. Found a chain of links leading me to
>>>> https://wiki.debian.org/UserPrivateGroups . I've just started
>>>> reading it. It addresses my goal.
>>>
>>> Maybe if you would STATE your goal, someone could help you.
>
> I want a specific set of users to have unrestricted access to one or more
> specific partitions.
>
>
>>
>> The goal described in the document is classic user groups and collaboration
>> via groups.
>
> Quoting from https://wiki.debian.org/UserPrivateGroups:
>
> "It requires no action on the part of the end-user to work as expected. Files
> and directories within a group directory can be created, modified, and deleted,
> and (for the most part) have their permissions modified as usual, whilst being
> shared with other group members and protected from non-members."
>
> and later
>
> "Group directories (directories with the set-group-id flag) are shared work
> spaces (that again all users are able to visit). All members of the group that
> owns the directory can create and write to files in it. Additionally, according
> to the set-group-id flag, all newly created files in the group directory will
> belong to the creating user who wrote the file and (this is special) to the
> group the directory belongs to. The result is that all members of the group can
> work on the files in their group directory. Other than that, group directories
> work just like home directories. So if a file for example should be readable
> only by group members, again, put it into a private/ subdirectory!"
>
> I see *NO DIFFERENCE* between that and my previously stated goal.
>
>
>
>>
>> There are also nice examples. It has nothing to do with /etc/fstab however.
>> Admitted: users goal is still unclear.
>>
>> @ Richard. Originally stated problem with fstab/mount, no saying the wiki
>> article addresses your goal. How could we conclude from to disconnected
>> topics what your goal is?
>>
>> You usually mount the root of a partition to some directory. you create
>> subdirectories where you can set whatever permissions and groups you need
>> and add users to those groups, so that users can read/write where they have
>> access to. In most of the cases this has nothing to do with the mount. The
>> case where it has to do with mount is where user needs to mount/umount a
>> media (usually external or network drive)
>>
>> regards
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Ben Caradoc-Davies-3
In reply to this post by Nicholas Geovanis-2
On 31/12/16 06:52, Nicholas Geovanis wrote:
> This is the first time I've heard of this "solution" named "User Private
> Groups".
> Reading the RedHat and Debian doc referred to, "User Private Groups" seems
> to be another name for setting the umask and the setgid bit in a directory
> intended for shared work. Did I miss something or is that all it is?

Also, every ordinary user gets their own personal group on account
creation (hence the name); this is the default group for files created
by this user. Other than that and umask 002 or 007 and the setgid bit on
shared directories (with a different group for sharing), that is all
there is to it. This pattern has been popularised by Fedora / Red Hat /
CentOS for at least ten years.

Kind regards,

--
Ben Caradoc-Davies <[hidden email]>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

deloptes-2
In reply to this post by Nicholas Geovanis-2
Nicholas Geovanis wrote:

> Reading the RedHat and Debian doc referred to, "User Private Groups" seems
> to be another name for setting the umask and the setgid bit in a directory
> intended for shared work. Did I miss something or is that all it is?

This is the key to Richards problem - Richard I hope you understand what a
default UMASK means?
The mask can be set via umask command and also look into the meaning of
chmod Ss bits. Perhaps it will be useful.

regards



Reply | Threaded
Open this post in threaded view
|

Re: Problem adding lines to /etc/fstab

Richard Owlett-3
In reply to this post by Greg Wooledge
On 12/30/2016 11:37 AM, Greg Wooledge wrote:
> On Fri, Dec 30, 2016 at 11:32:05AM -0600, Richard Owlett wrote:
>> I see *NO DIFFERENCE* between that and my previously stated goal.
>
> If you want classic Unix permissions on a file system on a fixed partition
> on a non-removable device, then you simply put the device into /etc/fstab
> with DEFAULT mount options.  None of this crazy "user" or "users" option
> stuff, since it's not a thing users are going to mount and unmount.

I explicitly wish to manually mount/unmount them.
I have found it beneficial to force automount off.

>
> Then, inside the mounted file system, you use chown and chgrp and chmod.
>
>