Another developer created partitions, one with mount point as root and another with mount point as home. Home is full, so I have no option other than to store new files in root.

Problem is, folders created in root always need sudo permissions. Even for copying files into it.

Is there a reason it is this way? For now, I just used sudo mkdir to create a folder in root and did a chmod 777, but I'm sure that's not the right way to deal with this.

  • I know those options too. They just weren't right for that situation. – Nav Aug 30 '17 at 6:29

If by "root" you mean the root partition (the partition mounted on /), then a simple way would be to make a folder somewhere in it that's owned by your user, and then put your files in it.

sudo mkdir -p /opt/mystuff
sudo chown $USER /opt/mystuff

Now /opt/mystuff should be writable by you, so use it for your files.

Long term, you should look into resizing the home partition, or moving it to a larger disk.

For convenience, you can make a link to this directory in your home directory:

ln -s /opt/mystuff ~

Now there will be a mystuff directory in your home directory.

| improve this answer | |
  • 2
    Additionally, the /opt/mystuff can be mounted somewhere in the home directory. – Melebius Aug 30 '17 at 6:18
  • @Melebius: How is that done? – Nav Aug 30 '17 at 6:27
  • 2
    @Nav IMO a (bind) mount is overkill; a simple link should do: ln -s /opt/mystuff ~/. Now there should be a mystuff directory in your home directory. – muru Aug 30 '17 at 6:29
  • I like bind mounts, pretty usefull especially if you want to make something available in a tftp pxe start – Ziazis Aug 30 '17 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.