Jump to content

Creating Files in Mounted Drive Requires sudo? Permissions problems

babadoctor
Go to solution Solved by Nayr438,

The correct command is chown user:group file and group isn't needed unless its for a multi user setup.

 

sudo chown -R $USER /media/2TB/

Will give you ownership over the entire directory.

 

sudo chown $USER aptpackages.txt

will only give you ownership of aptpackages.txt

 

If neither of those work, then the drive is mounted in read only and you will need to remount it.

fdisk -l to find the drive

mkdir /path/where/you/want/to/mount

sudo mount -o remount,rw /dev/pathtodrive /yournewdirectory

chown -R $USER /yournewdirectory

 

 

Example: mounted my hard drive on /media/2TB/

 

trying to use mkdir results in: 

 

image.png.13e7c335c8306921ac49ad48905298e9.png

 

ok lets create a file with sudo, fine

 

now i take ownership of said file using said command

 

sudo chown -R $USER:$USER aptpackages.txt

 

image.png.c96164ac886d7b55e866c3c05b37d773.png

 

ok permissions should be good too, it's essentially chmod 777

 

cool and good, i have ownership now, now i can delete it--

 

i cant without sudo??????????????????????????

 

why?

It makes no sense.

 

how can i make it so i can edit and delete it without sudo inside of the hard drive?

 

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Check your folder permissions, where the file lies.

HAL9000: AMD Ryzen 9 3900x | Noctua NH-D15 chromax.black | 32 GB Corsair Vengeance LPX DDR4 3200 MHz | Asus X570 Prime Pro | ASUS TUF 3080 Ti | 1 TB Samsung 970 Evo Plus + 1 TB Crucial MX500 + 6 TB WD RED | Corsair HX1000 | be quiet Pure Base 500DX | LG 34UM95 34" 3440x1440

Hydrogen server: Intel i3-10100 | Cryorig M9i | 64 GB Crucial Ballistix 3200MHz DDR4 | Gigabyte B560M-DS3H | 33 TB of storage | Fractal Design Define R5 | unRAID 6.9.2

Carbon server: Fujitsu PRIMERGY RX100 S7p | Xeon E3-1230 v2 | 16 GB DDR3 ECC | 60 GB Corsair SSD & 250 GB Samsung 850 Pro | Intel i340-T4 | ESXi 6.5.1

Big Mac cluster: 2x Raspberry Pi 2 Model B | 1x Raspberry Pi 3 Model B | 2x Raspberry Pi 3 Model B+

Link to comment
Share on other sites

Link to post
Share on other sites

Only do -R (recursive) on folders not individual files.

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

The correct command is chown user:group file and group isn't needed unless its for a multi user setup.

 

sudo chown -R $USER /media/2TB/

Will give you ownership over the entire directory.

 

sudo chown $USER aptpackages.txt

will only give you ownership of aptpackages.txt

 

If neither of those work, then the drive is mounted in read only and you will need to remount it.

fdisk -l to find the drive

mkdir /path/where/you/want/to/mount

sudo mount -o remount,rw /dev/pathtodrive /yournewdirectory

chown -R $USER /yournewdirectory

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Nayr438 said:

The correct command is chown user:group file and group isn't needed unless its for a multi user setup.

 

sudo chown -R $USER /media/2TB/

Will give you ownership over the entire directory.

 

sudo chown $USER aptpackages.txt

will only give you ownership of aptpackages.txt

 

If neither of those work, then the drive is mounted in read only and you will need to remount it.

fdisk -l to find the drive

mkdir /path/where/you/want/to/mount

sudo mount -o remount,rw /dev/pathtodrive /yournewdirectory

chown -R $USER /yournewdirectory

 

 

Well, it's silly that I need to take ownership of the drive after mounting it, but it fixed apparently. 

 

Thank you

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×