Score:1

Stop asking for sudo on reading or writing files on /mnt/My_partition

ph flag

I have a partition on my SSD that I store files on other than the partition of my system. I use this partition very often, but whenever I copy a file from my system to that partition, it asks me for the sudo password, and I want to remove that.

How do I stop it from asking me the sudo password for reading and writing for this partition?

For example:

sam@sam:~/Documents$ mv test.txt /mnt/Data
mv: cannot create regular file '/mnt/Data/test.txt': Permission denied
  • /Data/ :- the partition.

another example:

sam@sam:/mnt/Data$ touch something.txt
touch: cannot touch 'something.txt': Permission denied

If I wanted to perform those actions, I'll have to write sudo with the password, but that's not what I want.

David avatar
cn flag
What user owns the partition?
Normal avatar
ph flag
Just one note that might be useful, the /mnt/Data partition is ext4
Normal avatar
ph flag
@David, I believe the root,? it's only me on that laptop, my username is sam
Normal avatar
ph flag
@David drwxr-xr-x 11 root root 32768 Jan 1 1970 Data/
David avatar
cn flag
You just answered your own question. It works the way it should, Sam has no right to write to the partition.
Normal avatar
ph flag
Thanks for help :D
Normal avatar
ph flag
No really, I want it to stop asking for that password, so how do I give myself "sam" the permissions?
raj avatar
cn flag
raj
Change the owner of the partition to your user (sam), then you won't need sudo.
guiverc avatar
cn flag
Only Ubuntu and official flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic here, refer to https://askubuntu.com/help/on-topic where you'll find other SE sites where you question will be welcome if you don't want to use a Linux Mint forum. (*One advantage of Ubuntu is it's many support options, you opted for Linux Mint so take advantage of it's support options, or SE Unix & Linux*) *Details provided in subsequent question*
Score:2
cn flag
raj

Your /mnt/Data partition is owned by root, so your user "sam" has no permissions to write to it.

Change the ownership of the partition (and everything on it, recursively) to user "sam":

sudo chown -R sam:sam /mnt/Data
Normal avatar
ph flag
OK, `chown: changing ownership of '/mnt/Data/Downloads': Operation not permitted chown: changing ownership of '/mnt/Data': Operation not permitted` ... and for every file in the partition
ChanganAuto avatar
us flag
Use `sudo chown -R sam:sam /mnt/Data`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.