Unable to write to new partitions

Colin Watson cjwatson at ubuntu.com
Mon Mar 19 13:56:10 UTC 2018


On Mon, Mar 19, 2018 at 03:59:34AM +0800, Bret Busby wrote:
> On 18/03/2018, Colin Watson <cjwatson at ubuntu.com> wrote:
> > There's been an awful lot of verbiage on this thread, and while it was
> > accurate for technical users it didn't clearly and concisely point out
> > the mistake here, so I'll summarise.
> >
> > chmod 666 equates to the symbolic mode "rw-rw-rw-", i.e. read and write
> > permissions for everyone.  However, a directory must also be executable
> > in order to be able to open files inside it.  Therefore this should have
> > been chmod 777 ("rwxrwxrwx").
> >
> > It's entirely irrelevant which of your multiple installed operating
> > systems you do this from.  The actual storage of owners and groups of
> > files and directories uses numeric IDs, and root is always 0, so root on
> > each of your OSes is equivalent for this purpose.
> 
> I will not argue the point - I will merely say that when I changed the
> permissions from within the UbuntuMATE 16.04 installation, it did not
> allow me to write to the two partitions, and, when I did it from the
> operating systems that created each of the two partitions, it worked
> and I was able to write to the two partitions, from withiong
> UbuntuMATE 16.04.

I understand that it did not work for you; without an exact transcript
of what you did and what symptoms you observed, it isn't really possible
to speculate further.  However, I can definitely rule out the particular
conclusion you drew.

> My reasoning is based on my observations, of being prohibited from
> performing actions on the two partitions, in the role of the superuser
> of UbuntuMATE 16.04, until I had rand the chmod 777 comand on the two
> partitions, from the superusers that created each of the two
> partitions.

When you thought you were acting as root ("the superuser"), you must not
in fact have been doing so, perhaps due to some accident in the commands
you were running.  Otherwise the observations you report are impossible.

> > Note that world-writable files and directories are common security
> > vulnerabilities, and you should consider instead restricting the ability
> > to write to these file systems to just those users that actually need
> > it.
> 
> I am wondering, in this, whether, operhaps, it is not the chmod
> command,  that needed to be used, but, perhaps, thechown command.

Indeed, perhaps that's the case, but it depends on exactly what you're
trying to achieve.

> "
> On Sat, 17 Mar 2018 23:50:32 +0800, Bret Busby wrote:
> >bret at bret-Aspire-V3-772-UbuntuMATE:~$ ls -ld /media/bret/Data05
> >/media/bret/Data06
> >drw-rw-rw- 3 root root 4096 Mar 17 18:26 /media/bret/Data05
> >drw-rw-rw- 3 root root 4096 Mar 17 19:35 /media/bret/Data06
> "
> 
> I am wondering whether the problem may have been in the
> "root root"
> of those two lines; Does that text indicate, for one or both of those
> instantiations of "root", that root is the owner of the partition,

Yes.  (The first "root" is the user and the second is the group.)

> and, thence, as, as a user without superuser privilege (other than
> invoking the sudo command), the permissions would have been needed to
> be set at xx7, for me, as a user, to bw able to create directories,
> and, write to file both at the top level, and, within the directories,
> of tyhe two partitions?

Yes.  If for example you were to run:

  sudo chown -R bret:bret /media/bret/Data05 /media/bret/Data06
  chmod -R 700 /media/bret/Data05 /media/bret/Data06

... then that would assign ownership of those directories and everything
under them to the user "bret", and processes running as the user "bret"
or as root will be able to do what they will within those directories;
processes running as other users will not be able to see anything under
/media/bret/Data05 or /media/bret/Data06.  If that's what you want to
achieve, then that's what you should do.

If you want to achieve something else, then please explain your exact
goals.

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list